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),
|
||||
style_(nullptr),
|
||||
menu_(nullptr),
|
||||
mode_(Mode_None),
|
||||
bottom_widget_(nullptr),
|
||||
|
@ -454,7 +455,8 @@ FancyTabWidget::FancyTabWidget(QWidget *parent) : QTabWidget(parent),
|
|||
setElideMode(Qt::ElideNone);
|
||||
setUsesScrollButtons(true);
|
||||
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)));
|
||||
|
@ -462,7 +464,7 @@ FancyTabWidget::FancyTabWidget(QWidget *parent) : QTabWidget(parent),
|
|||
}
|
||||
|
||||
FancyTabWidget::~FancyTabWidget() {
|
||||
style()->deleteLater();
|
||||
if (style_) style_->deleteLater();
|
||||
}
|
||||
|
||||
void FancyTabWidget::Load(const QString &kSettingsGroup) {
|
||||
|
|
|
@ -37,6 +37,7 @@ class QMenu;
|
|||
class QActionGroup;
|
||||
class QContextMenuEvent;
|
||||
class QPaintEvent;
|
||||
class QProxyStyle;
|
||||
class TabData;
|
||||
|
||||
namespace Core {
|
||||
|
@ -102,6 +103,7 @@ class FancyTabWidget : public QTabWidget {
|
|||
private:
|
||||
void addMenuItem(QActionGroup* group, const QString& text, Mode mode);
|
||||
|
||||
QProxyStyle *style_;
|
||||
QPixmap background_pixmap_;
|
||||
QMenu *menu_;
|
||||
Mode mode_;
|
||||
|
|
Loading…
Reference in New Issue