Only call deleteLater when proxystyle is set
This commit is contained in:
parent
35301dc79e
commit
1ff1bf3292
|
@ -438,6 +438,7 @@ class FancyTabWidgetProxyStyle : public QProxyStyle {
|
||||||
};
|
};
|
||||||
|
|
||||||
FancyTabWidget::FancyTabWidget(QWidget *parent) : QTabWidget(parent),
|
FancyTabWidget::FancyTabWidget(QWidget *parent) : QTabWidget(parent),
|
||||||
|
style_(nullptr),
|
||||||
menu_(nullptr),
|
menu_(nullptr),
|
||||||
mode_(Mode_None),
|
mode_(Mode_None),
|
||||||
bottom_widget_(nullptr),
|
bottom_widget_(nullptr),
|
||||||
|
@ -454,7 +455,8 @@ FancyTabWidget::FancyTabWidget(QWidget *parent) : QTabWidget(parent),
|
||||||
setElideMode(Qt::ElideNone);
|
setElideMode(Qt::ElideNone);
|
||||||
setUsesScrollButtons(true);
|
setUsesScrollButtons(true);
|
||||||
if (QApplication::style() && QApplication::style()->objectName().toLower().contains(QRegularExpression("^adwaita.*$"))) {
|
if (QApplication::style() && QApplication::style()->objectName().toLower().contains(QRegularExpression("^adwaita.*$"))) {
|
||||||
setStyle(new FancyTabWidgetProxyStyle(style()));
|
style_ = new FancyTabWidgetProxyStyle(style());
|
||||||
|
setStyle(style_);
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(tabBar, SIGNAL(currentChanged(int)), this, SLOT(currentTabChanged(int)));
|
connect(tabBar, SIGNAL(currentChanged(int)), this, SLOT(currentTabChanged(int)));
|
||||||
|
@ -462,7 +464,7 @@ FancyTabWidget::FancyTabWidget(QWidget *parent) : QTabWidget(parent),
|
||||||
}
|
}
|
||||||
|
|
||||||
FancyTabWidget::~FancyTabWidget() {
|
FancyTabWidget::~FancyTabWidget() {
|
||||||
style()->deleteLater();
|
if (style_) style_->deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FancyTabWidget::Load(const QString &kSettingsGroup) {
|
void FancyTabWidget::Load(const QString &kSettingsGroup) {
|
||||||
|
|
|
@ -37,6 +37,7 @@ class QMenu;
|
||||||
class QActionGroup;
|
class QActionGroup;
|
||||||
class QContextMenuEvent;
|
class QContextMenuEvent;
|
||||||
class QPaintEvent;
|
class QPaintEvent;
|
||||||
|
class QProxyStyle;
|
||||||
class TabData;
|
class TabData;
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
|
@ -102,6 +103,7 @@ class FancyTabWidget : public QTabWidget {
|
||||||
private:
|
private:
|
||||||
void addMenuItem(QActionGroup* group, const QString& text, Mode mode);
|
void addMenuItem(QActionGroup* group, const QString& text, Mode mode);
|
||||||
|
|
||||||
|
QProxyStyle *style_;
|
||||||
QPixmap background_pixmap_;
|
QPixmap background_pixmap_;
|
||||||
QMenu *menu_;
|
QMenu *menu_;
|
||||||
Mode mode_;
|
Mode mode_;
|
||||||
|
|
Loading…
Reference in New Issue