1010#include < DMenu>
1111#include < DDialog>
1212#include < DDesktopServices>
13+ #include < DGuiApplicationHelper>
1314
1415#include < QSignalBlocker>
1516#include < QFileInfo>
@@ -40,11 +41,25 @@ void TabBarPrivate::initUI()
4041 closeBtn->setIcon (QIcon::fromTheme (" edit-closeBtn" ));
4142
4243 QHBoxLayout *mainLayout = new QHBoxLayout (q);
44+
4345 mainLayout->setContentsMargins (0 , 0 , 0 , 0 );
4446 mainLayout->addWidget (tabBar, 1 , Qt::AlignLeft);
4547 mainLayout->addWidget (hSplitBtn, 0 , Qt::AlignRight);
4648 mainLayout->addWidget (vSplitBtn, 0 , Qt::AlignRight);
4749 mainLayout->addWidget (closeBtn, 0 , Qt::AlignRight);
50+
51+ updateBackgroundColor ();
52+ }
53+
54+ void TabBarPrivate::updateBackgroundColor ()
55+ {
56+ q->setAutoFillBackground (true );
57+ auto p = q->palette ();
58+ if (Dtk::Gui::DGuiApplicationHelper::instance ()->themeType () == Dtk::Gui::DGuiApplicationHelper::LightType)
59+ p.setColor (QPalette::Window, QColor (225 , 225 , 225 ));
60+ else
61+ p.setColor (QPalette::Window, QColor (47 , 47 , 47 ));
62+ q->setPalette (p);
4863}
4964
5065void TabBarPrivate::initConnection ()
@@ -55,6 +70,7 @@ void TabBarPrivate::initConnection()
5570 connect (hSplitBtn, &DToolButton::clicked, this , [this ] { emit q->spliterClicked (Qt::Horizontal); });
5671 connect (vSplitBtn, &DToolButton::clicked, this , [this ] { emit q->spliterClicked (Qt::Vertical); });
5772 connect (closeBtn, &DToolButton::clicked, q, &TabBar::closeRequested);
73+ connect (Dtk::Gui::DGuiApplicationHelper::instance (), &Dtk::Gui::DGuiApplicationHelper::themeTypeChanged, this , &TabBarPrivate::updateBackgroundColor);
5874}
5975
6076void TabBarPrivate::onCurrentTabChanged (int index)
0 commit comments