diff --git a/src/private/TitleBar.cpp b/src/private/TitleBar.cpp index 3fd1a8cd..bc067df6 100644 --- a/src/private/TitleBar.cpp +++ b/src/private/TitleBar.cpp @@ -39,9 +39,6 @@ TitleBar::TitleBar(Frame *parent) if (Config::self().flags() & Config::Flag_TitleBarIsFocusable) setFocusPolicy(Qt::StrongFocus); - - QTimer::singleShot(0, this, &TitleBar::updateAutoHideButton); // have to wait after the frame is constructed - updateAutoHideButton(); } TitleBar::TitleBar(FloatingWindow *parent) @@ -55,7 +52,6 @@ TitleBar::TitleBar(FloatingWindow *parent) connect(m_floatingWindow, &FloatingWindow::windowStateChanged, this, &TitleBar::updateMaximizeButton); connect(m_floatingWindow, &FloatingWindow::activatedChanged , this, &TitleBar::isFocusedChanged); init(); - updateAutoHideButton(); // always hidden when we're in a FloatingWindow. } void TitleBar::init() @@ -68,6 +64,8 @@ void TitleBar::init() }); updateButtons(); + QTimer::singleShot(0, this, &TitleBar::updateAutoHideButton); // have to wait after the frame is + // constructed } TitleBar::~TitleBar() diff --git a/src/private/widgets/TitleBarWidget.cpp b/src/private/widgets/TitleBarWidget.cpp index 87b39ad2..0aa92cd0 100644 --- a/src/private/widgets/TitleBarWidget.cpp +++ b/src/private/widgets/TitleBarWidget.cpp @@ -171,14 +171,10 @@ void TitleBarWidget::updateAutoHideButton() m_autoHideButton->setIcon(factory->iconForButtonType(TitleBarButtonType::UnautoHide, devicePixelRatioF())); m_autoHideButton->setToolTip(tr("Disable auto-hide")); } - - m_autoHideButton->setVisible(true); - } else { - m_autoHideButton->setVisible(false); } - } else { - m_autoHideButton->setVisible(false); } + + m_autoHideButton->setVisible(supportsAutoHideButton()); } void TitleBarWidget::updateMaximizeButton()