Fix hidding the pin/auto-hide icon when side-by-side in floating

An else {} branch was missing.

Also just simplify the code, and call supportsAutoHideButton()
which wasn't being used.

Also removed some bogus updateAutoHideButton() calls from
the CTOR, needs to use singleShot() since the method is virtual,
the derived class isn't constructed yet
This commit is contained in:
Sergio Martins
2021-04-28 22:06:42 +01:00
parent c4d3ba71b2
commit 0f2edfdb4e
2 changed files with 4 additions and 10 deletions

View File

@@ -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()

View File

@@ -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()