vlc | branch: master | Prince Gupta <[email protected]> | Wed Sep 30 23:32:18 2020 +0530| [2a28364b566da24e8ee3c4667187aa644a863556] | committer: Pierre Lamot
qml: add TransparentSpinbox widget Signed-off-by: Pierre Lamot <[email protected]> > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2a28364b566da24e8ee3c4667187aa644a863556 --- modules/gui/qt/Makefile.am | 1 + modules/gui/qt/vlc.qrc | 1 + modules/gui/qt/widgets/qml/TransparentSpinBox.qml | 115 ++++++++++++++++++++++ 3 files changed, 117 insertions(+) diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am index aa2570f8c1..426c6cc45c 100644 --- a/modules/gui/qt/Makefile.am +++ b/modules/gui/qt/Makefile.am @@ -716,6 +716,7 @@ libqt_plugin_la_QML = \ gui/qt/widgets/qml/PageLoader.qml \ gui/qt/widgets/qml/TabButtonExt.qml \ gui/qt/widgets/qml/TableColumns.qml \ + gui/qt/widgets/qml/TransparentSpinBox.qml \ gui/qt/widgets/qml/TextToolButton.qml \ gui/qt/widgets/qml/ToolTipArea.qml \ gui/qt/widgets/qml/VideoProgressBar.qml \ diff --git a/modules/gui/qt/vlc.qrc b/modules/gui/qt/vlc.qrc index 11839a54b2..6df5e937c1 100644 --- a/modules/gui/qt/vlc.qrc +++ b/modules/gui/qt/vlc.qrc @@ -196,6 +196,7 @@ <file alias="DNDLabel.qml">widgets/qml/DNDLabel.qml</file> <file alias="KeyNavigableTableView.qml">widgets/qml/KeyNavigableTableView.qml</file> <file alias="TableColumns.qml">widgets/qml/TableColumns.qml</file> + <file alias="TransparentSpinBox.qml">widgets/qml/TransparentSpinBox.qml</file> <file alias="NavigableFocusScope.qml">widgets/qml/NavigableFocusScope.qml</file> <file alias="FocusBackground.qml">widgets/qml/FocusBackground.qml</file> <file alias="ImageToolButton.qml">widgets/qml/ImageToolButton.qml</file> diff --git a/modules/gui/qt/widgets/qml/TransparentSpinBox.qml b/modules/gui/qt/widgets/qml/TransparentSpinBox.qml new file mode 100644 index 0000000000..45476e31ec --- /dev/null +++ b/modules/gui/qt/widgets/qml/TransparentSpinBox.qml @@ -0,0 +1,115 @@ + +/***************************************************************************** + * Copyright (C) 2020 VLC authors and VideoLAN + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. + *****************************************************************************/ +import QtQuick 2.11 +import QtQuick.Controls 2.4 +import QtQuick.Templates 2.4 as T + +import "qrc:///widgets/" as Widgets +import "qrc:///style/" + +T.SpinBox { + id: control + + property color color: "white" + property int borderWidth: VLCStyle.dp(1, VLCStyle.scale) + property color borderColor: control.activeFocus + || control.hovered ? VLCStyle.colors.accent : Qt.rgba( + 1, 1, 1, .2) + value: 50 + editable: true + from: 0 + to: 99999 + font.pixelSize: VLCStyle.fontSize_normal + + contentItem: TextField { + z: 2 + text: control.textFromValue(control.value, control.locale) + color: control.color + font: control.font + horizontalAlignment: Qt.AlignHCenter + verticalAlignment: Qt.AlignVCenter + readOnly: !control.editable + validator: control.validator + inputMethodHints: Qt.ImhFormattedNumbersOnly + + background: Item {} + } + + background: Rectangle { + implicitHeight: VLCStyle.dp(28, VLCStyle.scale) + implicitWidth: VLCStyle.dp(128, VLCStyle.scale) + color: "transparent" + border.width: control.borderWidth + border.color: control.borderColor + } + + up.indicator: Label { + x: control.mirrored ? 0 : parent.width - width + z: 4 + height: parent.height + width: implicitWidth + text: "\uff0b" // Full-width Plus + font.pixelSize: control.font.pixelSize + color: !control.up.pressed ? control.color : VLCStyle.colors.accent + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + padding: VLCStyle.margin_xsmall + + MouseArea { + anchors.fill: parent + acceptedButtons: Qt.LeftButton + onPressed: { + control.up.pressed = true + control.increase() + mouse.accepted = true + } + onReleased: { + control.up.pressed = false + mouse.accepted = true + } + } + } + + down.indicator: Label { + x: control.mirrored ? parent.width - width : 0 + z: 4 + height: parent.height + width: implicitWidth + text: "\uff0d" // Full-width Hyphen-minus + font.pixelSize: control.font.pixelSize + color: !control.down.pressed ? control.color : VLCStyle.colors.accent + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + padding: VLCStyle.margin_xsmall + + MouseArea { + anchors.fill: parent + acceptedButtons: Qt.LeftButton + onPressed: { + control.down.pressed = true + control.decrease() + mouse.accepted = true + } + onReleased: { + control.down.pressed = false + mouse.accepted = true + } + } + } +} _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
