Where in plasma-systemsettings does it define its minimum window size?

I ask because KCMs launched via kcmshell5 don’t do this, and I’d like to provide its code as an example in

Thanks. I don’t even know how to start to search for this.

Try searching for setMinimum in the System Setitngs repo: setminimum · Search · GitLab


That comes up with this: app/SettingsBase.cpp · master · Plasma / System Settings · GitLab

    // enforce minimum window size
    setMinimumSize(SettingsBase::sizeHint());

Which leads us to look where the sizeHint() is defined. That’s here: app/SettingsBase.cpp · master · Plasma / System Settings · GitLab

QSize SettingsBase::sizeHint() const
{
    // 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);
}

So the minimum window size for normal screens is (font size*102) x (font size*70), or 1020x700 for the default 10pt font size.

We do get a lot of complaints about this, and once more/all KCMs are ported to QtQuick which helps them to scale a lot better, it probably makes sense to substantially reduce these numbers.

1 Like