mirror of
https://invent.kde.org/graphics/okular
synced 2024-06-30 22:54:24 +00:00
Implementation of sizeHint based on systemsettings
BUG: 397678
This commit is contained in:
parent
cc64011e3b
commit
e3f8102a9d
|
@ -9,6 +9,10 @@
|
|||
|
||||
#include <KLocalizedString>
|
||||
|
||||
#include <QFontDatabase>
|
||||
#include <QGuiApplication>
|
||||
#include <QScreen>
|
||||
|
||||
// single config pages
|
||||
#include "dlgaccessibility.h"
|
||||
#include "dlgannotations.h"
|
||||
|
@ -21,6 +25,7 @@
|
|||
PreferencesDialog::PreferencesDialog(QWidget *parent, KConfigSkeleton *skeleton, Okular::EmbedMode embedMode)
|
||||
: KConfigDialog(parent, QStringLiteral("preferences"), skeleton)
|
||||
{
|
||||
setMinimumSize(PreferencesDialog::sizeHint());
|
||||
setWindowModality(Qt::ApplicationModal);
|
||||
|
||||
m_general = new DlgGeneral(this, embedMode);
|
||||
|
@ -66,3 +71,14 @@ void PreferencesDialog::switchToAnnotationsPage()
|
|||
if (m_annotationsPage)
|
||||
setCurrentPage(m_annotationsPage);
|
||||
}
|
||||
|
||||
QSize PreferencesDialog::sizeHint() const
|
||||
{ // Code based on the implementation of sizeHint of the systemsettings project
|
||||
// Take the font size into account for the window size, as we do for UI elements
|
||||
const float fontSize = QFontDatabase::systemFont(QFontDatabase::GeneralFont).pointSizeF();
|
||||
const QSize targetSize = QSize(qRound(102 * fontSize), qRound(70 * fontSize));
|
||||
|
||||
// on smaller or portrait-rotated screens, do not max out height and/or width
|
||||
const QSize screenSize = (QGuiApplication::primaryScreen()->availableSize() * 0.9);
|
||||
return targetSize.boundedTo(screenSize);
|
||||
}
|
||||
|
|
|
@ -33,7 +33,9 @@ public:
|
|||
void switchToAccessibilityPage();
|
||||
void switchToAnnotationsPage();
|
||||
|
||||
|
||||
protected:
|
||||
QSize sizeHint() const override;
|
||||
// void updateSettings(); // Called when OK/Apply is pressed.
|
||||
// void updateWidgets(); // Called upon construction or when Reset is pressed
|
||||
// void updateWidgetsDefault(); // Called when Defaults button is pressed
|
||||
|
|
Loading…
Reference in New Issue
Block a user