Commit 669fca18 authored by Nate Graham's avatar Nate Graham
Browse files

Set default window sizes properly using sizeHint()

parent fa5acc42
......@@ -255,7 +255,6 @@ void KSMainWindow::init()
} else if (!mShutterModes.testFlag(Platform::ShutterMode::Immediate)) {
mKSWidget->lockOnClickEnabled();
}
resize(QSize(DEFAULT_WINDOW_WIDTH, DEFAULT_WINDOW_HEIGHT).expandedTo(minimumSize()));
// Allow Ctrl+Q to quit the app
QAction *actionQuit = KStandardAction::quit(qApp, &QApplication::quit, this);
......@@ -273,6 +272,11 @@ void KSMainWindow::init()
// done with the init
}
QSize KSMainWindow::sizeHint() const
{
return QSize(DEFAULT_WINDOW_WIDTH, DEFAULT_WINDOW_HEIGHT).expandedTo(minimumSize());
}
int KSMainWindow::windowWidth(const QPixmap &pixmap) const
{
// Calculates what the width of the window should be for the captured image to perfectly fit
......
......@@ -84,6 +84,7 @@ class KSMainWindow: public QDialog
protected:
void moveEvent(QMoveEvent *event) override;
QSize sizeHint() const override;
private:
......
......@@ -28,10 +28,14 @@ SettingsDialog::SettingsDialog(QWidget *parent) :
connect(mShortcutsPage, &ShortcutsOptionsPage::shortCutsChanged, this, [this] {
updateButtons();
});
resize(600, 590);
connect(this, &KConfigDialog::currentPageChanged, this, &SettingsDialog::updateButtons);
}
QSize SettingsDialog::sizeHint() const
{
return QSize(600, 590);
}
bool SettingsDialog::hasChanged()
{
return mShortcutsPage->isModified() || KConfigDialog::hasChanged();
......
......@@ -19,6 +19,10 @@ class SettingsDialog : public KConfigDialog
explicit SettingsDialog(QWidget *parent = nullptr);
protected:
QSize sizeHint() const override;
private:
bool hasChanged() override;
......
Markdown is supported
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