mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-20 15:37:26 -06:00
MainWindow cleanups.
All MainWindow child widgets use constructors with 'parent' parameter that allows parent widget to delete them at its destruction. Some other MainWindow cleanup code replaced to destructor. Application manages MainWindow instance and remove it when aboutToQuit() signal emitted.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Bittorrent Client using Qt4 and libtorrent.
|
||||
* Bittorrent Client using Qt and libtorrent.
|
||||
* Copyright (C) 2006 Christophe Dumez
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -34,31 +34,27 @@
|
||||
#include <QTabWidget>
|
||||
#include <QTabBar>
|
||||
|
||||
class HidableTabWidget : public QTabWidget {
|
||||
class HidableTabWidget : public QTabWidget
|
||||
{
|
||||
public:
|
||||
|
||||
void showTabBar(bool show) {
|
||||
tabBar()->setVisible(show);
|
||||
}
|
||||
explicit HidableTabWidget(QWidget *parent = 0)
|
||||
: QTabWidget(parent)
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
void tabInserted(int index) {
|
||||
QTabWidget::tabInserted(index);
|
||||
if (count() == 1) {
|
||||
showTabBar(false);
|
||||
} else {
|
||||
showTabBar(true);
|
||||
void tabInserted(int index)
|
||||
{
|
||||
QTabWidget::tabInserted(index);
|
||||
tabBar()->setVisible(count() != 1);
|
||||
}
|
||||
}
|
||||
|
||||
void tabRemoved(int index) {
|
||||
QTabWidget::tabInserted(index);
|
||||
if (count() == 1) {
|
||||
showTabBar(false);
|
||||
} else {
|
||||
showTabBar(true);
|
||||
void tabRemoved(int index)
|
||||
{
|
||||
//QTabWidget::tabInserted(index);
|
||||
QTabWidget::tabRemoved(index);
|
||||
tabBar()->setVisible(count() != 1);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
#endif // HIDABLETABWIDGET_H
|
||||
|
||||
Reference in New Issue
Block a user