Read and use WheelScrollLines configuration on KDE
Qt supports changing the default lines a scroll wheel click scroll, but wasn't trying to read the system settings. The patch adds support for platform themes to set the default. Change-Id: I53fdcec7984941d1d1285d927d70460356613f81 Reviewed-by: Kevin Ottens <kevin.ottens@kdab.com> Reviewed-by: David Faure <david.faure@kdab.com>
This commit is contained in:
parent
2ad5d62f11
commit
fac71528cc
@ -513,6 +513,8 @@ QVariant QPlatformTheme::defaultThemeHint(ThemeHint hint)
|
||||
int dist = qgetenv("QT_DBL_CLICK_DIST").toInt(&ok);
|
||||
return QVariant(ok ? dist : 5);
|
||||
}
|
||||
case WheelScrollLines:
|
||||
return QVariant(3);
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
@ -109,7 +109,8 @@ public:
|
||||
DialogSnapToDefaultButton,
|
||||
ContextMenuOnMouseRelease,
|
||||
MousePressAndHoldInterval,
|
||||
MouseDoubleClickDistance
|
||||
MouseDoubleClickDistance,
|
||||
WheelScrollLines
|
||||
};
|
||||
|
||||
enum DialogType {
|
||||
|
@ -178,6 +178,7 @@ public:
|
||||
, toolButtonStyle(Qt::ToolButtonTextBesideIcon)
|
||||
, toolBarIconSize(0)
|
||||
, singleClick(true)
|
||||
, wheelScrollLines(3)
|
||||
{ }
|
||||
|
||||
static QString kdeGlobals(const QString &kdeDir)
|
||||
@ -201,6 +202,7 @@ public:
|
||||
int toolButtonStyle;
|
||||
int toolBarIconSize;
|
||||
bool singleClick;
|
||||
int wheelScrollLines;
|
||||
};
|
||||
|
||||
void QKdeThemePrivate::refresh()
|
||||
@ -250,6 +252,10 @@ void QKdeThemePrivate::refresh()
|
||||
toolButtonStyle = Qt::ToolButtonTextUnderIcon;
|
||||
}
|
||||
|
||||
const QVariant wheelScrollLinesValue = readKdeSetting(QStringLiteral("KDE/WheelScrollLines"), kdeDirs, kdeSettings);
|
||||
if (wheelScrollLinesValue.isValid())
|
||||
wheelScrollLines = wheelScrollLinesValue.toInt();
|
||||
|
||||
// Read system font, ignore 'smallestReadableFont'
|
||||
if (QFont *systemFont = kdeFont(readKdeSetting(QStringLiteral("font"), kdeDirs, kdeSettings)))
|
||||
resources.fonts[QPlatformTheme::SystemFont] = systemFont;
|
||||
@ -436,6 +442,8 @@ QVariant QKdeTheme::themeHint(QPlatformTheme::ThemeHint hint) const
|
||||
return QVariant(int(KdeKeyboardScheme));
|
||||
case QPlatformTheme::ItemViewActivateItemOnSingleClick:
|
||||
return QVariant(d->singleClick);
|
||||
case QPlatformTheme::WheelScrollLines:
|
||||
return QVariant(d->wheelScrollLines);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -666,8 +666,12 @@ void QApplicationPrivate::initialize()
|
||||
initializeMultitouch();
|
||||
|
||||
if (QApplication::desktopSettingsAware())
|
||||
if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
|
||||
if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) {
|
||||
QApplicationPrivate::enabledAnimations = theme->themeHint(QPlatformTheme::UiEffects).toInt();
|
||||
#ifndef QT_NO_WHEELEVENT
|
||||
QApplicationPrivate::wheel_scroll_lines = theme->themeHint(QPlatformTheme::WheelScrollLines).toInt();
|
||||
#endif
|
||||
}
|
||||
|
||||
is_app_running = true; // no longer starting up
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user