mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-03 15:45:46 +08:00
Ref T447, toggleStayOnTop for CGuiApplication
This commit is contained in:
@@ -697,7 +697,7 @@ namespace BlackGui
|
||||
|
||||
void CGuiApplication::addMenuWindow(QMenu &menu)
|
||||
{
|
||||
QPointer<QWidget> w = mainApplicationWidget();
|
||||
QPointer<QWidget> w = CGuiApplication::mainApplicationWidget();
|
||||
if (!w) { return; }
|
||||
const QSize iconSize = CIcons::empty16().size();
|
||||
QPixmap icon = w->style()->standardIcon(QStyle::SP_TitleBarMaxButton).pixmap(iconSize);
|
||||
@@ -731,10 +731,7 @@ namespace BlackGui
|
||||
c = connect(a, &QAction::triggered, this, [ = ]()
|
||||
{
|
||||
if (!w) { return; }
|
||||
const bool onTop = CGuiUtility::toggleStayOnTop(w);
|
||||
CLogMessage(w.data()).info(onTop ?
|
||||
QStringLiteral("Window on top") :
|
||||
QStringLiteral("Window not always on top"));
|
||||
this->toggleStayOnTop();
|
||||
});
|
||||
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
|
||||
Q_UNUSED(c);
|
||||
@@ -993,6 +990,15 @@ namespace BlackGui
|
||||
arg(w->fontMetrics().averageCharWidth());
|
||||
}
|
||||
|
||||
bool CGuiApplication::toggleStayOnTop()
|
||||
{
|
||||
QWidget *w = CGuiApplication::mainApplicationWidget();
|
||||
if (!w) { return false; }
|
||||
const bool onTop = CGuiUtility::toggleStayOnTop(w);
|
||||
CLogMessage(w).info(onTop ? QStringLiteral("Window on top") : QStringLiteral("Window not always on top"));
|
||||
return onTop;
|
||||
}
|
||||
|
||||
void CGuiApplication::triggerNewVersionCheck(int delayedMs)
|
||||
{
|
||||
if (!m_updateSetting.get()) { return; }
|
||||
|
||||
@@ -210,6 +210,9 @@ namespace BlackGui
|
||||
//! \copydoc BlackCore::CApplication::gracefulShutdown
|
||||
virtual void gracefulShutdown() override;
|
||||
|
||||
//! Toggle stay on top
|
||||
bool toggleStayOnTop();
|
||||
|
||||
//! Save the main widget state?
|
||||
void setSaveMainWidgetState(bool save) { m_saveMainWidgetState = save; }
|
||||
|
||||
|
||||
@@ -354,19 +354,13 @@ void SwiftGuiStd::onChangedWindowOpacity(int opacity)
|
||||
|
||||
void SwiftGuiStd::toogleWindowStayOnTop()
|
||||
{
|
||||
CGuiUtility::toggleStayOnTop(this);
|
||||
if (sGui) { sGui->toggleStayOnTop(); }
|
||||
}
|
||||
|
||||
void SwiftGuiStd::toggleWindowVisibility()
|
||||
{
|
||||
if (this->isVisible())
|
||||
{
|
||||
this->hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
this->show();
|
||||
}
|
||||
if (this->isVisible()) { this->hide(); return; }
|
||||
this->show();
|
||||
}
|
||||
|
||||
void SwiftGuiStd::onStyleSheetsChanged()
|
||||
|
||||
@@ -88,16 +88,13 @@ protected:
|
||||
//! @}
|
||||
|
||||
//! Get a minimize action which minimizes the window
|
||||
|
||||
//! Actions for navigator @{
|
||||
QAction *getWindowMinimizeAction(QObject *parent);
|
||||
|
||||
//! Get a normal window action which minimizes the window
|
||||
QAction *getWindowNormalAction(QObject *parent);
|
||||
|
||||
//! Toggle window visibility action
|
||||
QAction *getToggleWindowVisibilityAction(QObject *parent);
|
||||
|
||||
//! Toggle window stay on top action
|
||||
QAction *getToggleStayOnTopAction(QObject *parent);
|
||||
//! @}
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::SwiftGuiStd> ui;
|
||||
|
||||
Reference in New Issue
Block a user