mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 04:25:35 +08:00
Check the min. window sizes
* on smaller screens makes sure the min.sizes are not exceeded * normally not changing min.sizes
This commit is contained in:
@@ -97,6 +97,7 @@ namespace BlackGui
|
||||
this->setCurrentFontValues(); // most likely the default font and not any stylesheet font at this time
|
||||
sGui = this;
|
||||
connect(&m_styleSheetUtility, &CStyleSheetUtility::styleSheetsChanged, this, &CGuiApplication::onStyleSheetsChanged);
|
||||
connect(this, &CGuiApplication::startUpCompleted, this, &CGuiApplication::superviseWindowMinSizes);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -923,4 +924,9 @@ namespace BlackGui
|
||||
m_fontFamily = font.family();
|
||||
m_fontPointSize = font.pointSize();
|
||||
}
|
||||
|
||||
void CGuiApplication::superviseWindowMinSizes()
|
||||
{
|
||||
CGuiUtility::superviseMainWindowMinSizes();
|
||||
}
|
||||
} // ns
|
||||
|
||||
@@ -276,7 +276,7 @@ namespace BlackGui
|
||||
int m_minHeightChars = -1; //!< min. height characters (based on current font metrics)
|
||||
QCommandLineOption m_cmdWindowStateMinimized { "empty" }; //!< window state (minimized)
|
||||
QCommandLineOption m_cmdWindowMode { "empty" }; //!< window mode (flags: frameless ...)
|
||||
QCommandLineOption m_cmdWindowSizeReset {"empty"}; //!< window size resizing
|
||||
QCommandLineOption m_cmdWindowSizeReset { "empty" }; //!< window size resizing
|
||||
CStyleSheetUtility m_styleSheetUtility {{}, this}; //!< style sheet utility
|
||||
bool m_uiSetupCompleted = false; //!< ui setup completed
|
||||
bool m_saveMainWidgetState = true; //!< save/restore main widget's state
|
||||
@@ -303,6 +303,9 @@ namespace BlackGui
|
||||
|
||||
//! Set current font values
|
||||
void setCurrentFontValues();
|
||||
|
||||
//! \copydoc BlackGui::CGuiUtility::superviseMainWindowMinSizes
|
||||
void superviseWindowMinSizes();
|
||||
};
|
||||
} // ns
|
||||
|
||||
|
||||
@@ -510,4 +510,15 @@ namespace BlackGui
|
||||
if (!widget) { return; }
|
||||
widget->setStyleSheet(widget->styleSheet());
|
||||
}
|
||||
|
||||
void CGuiUtility::superviseMainWindowMinSizes(qreal wRatio, qreal hRatio)
|
||||
{
|
||||
QWidget *w = CGuiUtility::mainApplicationWidget();
|
||||
if (!w) { return; }
|
||||
const QSize s = CGuiUtility::desktopSize();
|
||||
const int minW = wRatio * s.width();
|
||||
const int minH = hRatio * s.height();
|
||||
w->setMinimumWidth(qMin(minW, w->minimumWidth()));
|
||||
w->setMinimumHeight(qMin(minH, w->minimumHeight()));
|
||||
}
|
||||
} // ns
|
||||
|
||||
@@ -170,6 +170,9 @@ namespace BlackGui
|
||||
//! Forces a stylesheet update
|
||||
static void forceStyleSheetUpdate(QWidget *widget);
|
||||
|
||||
//! Make sure that the min.sizes to not exceed the screen resolution
|
||||
static void superviseMainWindowMinSizes(qreal wRatio = 0.85, qreal hRatio = 0.85);
|
||||
|
||||
private:
|
||||
//! Constructor, use static methods only
|
||||
CGuiUtility() {}
|
||||
|
||||
Reference in New Issue
Block a user