D6392: [Panel Config] Scrolling over size button increments size by 1 and shows current thickness
Kai Uwe Broulik
noreply at phabricator.kde.org
Mon Jun 26 13:42:55 UTC 2017
broulik added a comment.
I like the idea of showing the thickness in the button. My suggestion would be add a `Timer` which you `restart()` when you change the panel thickness (you need to try whether in `onThicknessChanged` is sufficient or doing that explicitly in `onWheelEvent` and/or `onPositionChanged` and then bind the text to whether it's running, this way you don't break any bindings but just have it work like magic ;) for example:
Timer {
id: panelResizeSizeHintTimer
interval: 1000
}
...
Button {
text: panelResizeHintTimer.running ? panel.thickness : i18n("Width") // don't forget "Height" for horizontal panels
...
onWheel: {
// wheel stuff here
panelResizeHintTimer.restart()
...
}
(QtQuick `Timer` `restart` will start it if not running and restart it if already running, it also runs only once by default which is what we want here)
INLINE COMMENTS
> SizeHandle.qml:123
> +
> + onWheelMoved: {
> + if (wheel.delta > 0) {
I don't know exactly how `MouseEventListener` behaves but in `MouseArea` you get a ton of `onWheel` events for touchpads (which scroll pixel-precisely), potentially causing you to making your panel enormous accidentally
> SizeHandle.qml:125
> + if (wheel.delta > 0) {
> + panel.thickness = Math.max(units.gridUnit, panel.thickness + 1);
> + } else if (wheel.delta < 0) {
I think there's also a maximum size enforced (half of `screenToFollow.geometry`), it's somewhat hidden in the complex `onPositionChanged` code
> SizeHandle.qml:129
> + } else {
> + return
> + }
Missing semicolon here and below, also can it ever get 0 anyway?
REPOSITORY
R119 Plasma Desktop
REVISION DETAIL
https://phabricator.kde.org/D6392
To: Zren, #plasma
Cc: broulik, plasma-devel, ZrenBot, progwolff, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart, lukas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20170626/9ef7f391/attachment.html>
More information about the Plasma-devel
mailing list