Index: src/activities/menu/ConfigurationItem.qml =================================================================== --- src/activities/menu/ConfigurationItem.qml +++ src/activities/menu/ConfigurationItem.qml @@ -1,4 +1,3 @@ - /* GCompris - ConfigurationItem.qml * * Copyright (C) 2014-2016 Johnny Jazeix @@ -279,27 +278,14 @@ Flow { spacing: 5 width: parent.width - Slider { + GCSlider { id: baseFontSizeSlider width: 250 * ApplicationInfo.ratio - style: GCSliderStyle {} maximumValue: ApplicationSettings.baseFontSizeMax minimumValue: ApplicationSettings.baseFontSizeMin - stepSize: 1.0 - tickmarksEnabled: true - updateValueWhileDragging: true value: baseFontSize onValueChanged: ApplicationSettings.baseFontSize = value; - MouseArea { // Removes scrolling when hovering sliders - anchors.fill: parent - onWheel: {} - onPressed: { - mouse.accepted = false - } - onReleased: { - mouse.accepted = false - } - } + scrollEnabled: false } GCText { id: baseFontSizeText @@ -327,27 +313,14 @@ Flow { spacing: 5 width: parent.width - Slider { + GCSlider { id: fontLetterSpacingSlider width: 250 * ApplicationInfo.ratio - style: GCSliderStyle {} maximumValue: ApplicationSettings.fontLetterSpacingMax minimumValue: ApplicationSettings.fontLetterSpacingMin - stepSize: 1.0 - tickmarksEnabled: true - updateValueWhileDragging: true value: fontLetterSpacing - onValueChanged: ApplicationSettings.fontLetterSpacing = value - MouseArea { // Removes scrolling when hovering sliders - anchors.fill: parent - onWheel: {} - onPressed: { - mouse.accepted = false - } - onReleased: { - mouse.accepted = false - } - } + onValueChanged: ApplicationSettings.fontLetterSpacing = value; + scrollEnabled: false } GCText { id: fontLetterSpacingText Index: src/core/GCSlider.qml =================================================================== --- /dev/null +++ src/core/GCSlider.qml @@ -0,0 +1,62 @@ +/* GCompris - GCSlider.qml + * + * Copyright (C) 2018 Alexis Breton + * + * Authors: + * Alexis Breton + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ +import QtQuick 2.6 +import QtQuick.Controls 1.5 + + +/** + * A Slider component with GCompris' style. + * @ingroup components + * + * Provides the "scrollEnabled" property to replace "wheelEnabled" + * that is only available with QtQuick.Controls > 1.6. If using + * QtQuick.Controls >= 1.6, please use the built-in "wheelEnabled" property + * + * @inherit QtQuick.Controls.Slider + */ +Slider { + + /** + * type:bool + * Set to false to disable changing the value by scrolling the mouse. + * Default is true. + * + * If false, the mouse scrolling is disabled while hovering the slider. + * + * Deprecated if using QtQuick.Controls >= 1.6 + */ + property bool scrollEnabled : true + + + style: GCSliderStyle {} + stepSize: 1.0 + tickmarksEnabled: true + + // Removes scrolling when hovering sliders if scrollEnabled = false + MouseArea { + anchors.fill: parent + enabled: !scrollEnabled + onWheel: {} + onPressed: mouse.accepted = false + onReleased: mouse.accepted = false + } + +}