Verified Commit 4b691491 authored by Fushan Wen's avatar Fushan Wen 💬
Browse files

Change window size limit after screen resolution is changed

It allows to show the button group at the bottom after the screen is
selected to use a smaller resolution.
parent 6020e3d4
Pipeline #197017 passed with stage
in 1 minute and 46 seconds
......@@ -125,6 +125,18 @@ void SettingsBase::initApplication()
// enforce minimum window size
setMinimumSize(SettingsBase::sizeHint());
activateWindow();
// Change size limit after screen resolution is changed
m_screen = qGuiApp->primaryScreen();
connect(qGuiApp, &QGuiApplication::primaryScreenChanged, this, [this](QScreen *screen) {
if (m_screen) {
disconnect(m_screen, &QScreen::geometryChanged, this, &SettingsBase::slotGeometryChanged);
}
m_screen = screen;
slotGeometryChanged();
connect(m_screen, &QScreen::geometryChanged, this, &SettingsBase::slotGeometryChanged);
});
connect(m_screen, &QScreen::geometryChanged, this, &SettingsBase::slotGeometryChanged);
}
void SettingsBase::initToolBar()
......@@ -453,3 +465,8 @@ void SettingsBase::changeAboutMenu(const KAboutData *menuAbout, QAction *menuIte
menuItem->setEnabled(false);
}
}
void SettingsBase::slotGeometryChanged()
{
setMinimumSize(SettingsBase::sizeHint());
}
......@@ -20,6 +20,8 @@
#include <KLineEdit>
#include <KXmlGuiWindow>
class QScreen;
class SettingsBase : public KXmlGuiWindow
{
Q_OBJECT
......@@ -48,6 +50,12 @@ private Q_SLOTS:
void changeToolBar(BaseMode::ToolBarItems toolbar);
void changeAboutMenu(const KAboutData *menuAbout, QAction *menuItem, const QString &fallback);
private Q_SLOTS:
/**
* Updates the window size limit
*/
void slotGeometryChanged();
private:
/**
* @return the plugin controller if the current view is found in the plugin list and successfully loaded,
......@@ -55,6 +63,9 @@ private:
*/
BaseMode *loadCurrentView();
// Follow screen resolution
QScreen *m_screen = nullptr;
// The plugins
QVector<KPluginMetaData> m_plugins;
QMap<QString, BaseMode *> m_loadedViews;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment