vlc | branch: master | Prince Gupta <[email protected]> | Mon Sep 28 22:38:49 2020 +0530| [6b74dafe6b8c519193e8d4a76f7204a1f31af93e] | committer: Pierre Lamot
qml: add CheckedDelegate widget Signed-off-by: Pierre Lamot <[email protected]> > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6b74dafe6b8c519193e8d4a76f7204a1f31af93e --- modules/gui/qt/Makefile.am | 1 + modules/gui/qt/vlc.qrc | 1 + modules/gui/qt/widgets/qml/CheckedDelegate.qml | 62 ++++++++++++++++++++++++++ 3 files changed, 64 insertions(+) diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am index f61025ff01..aa2570f8c1 100644 --- a/modules/gui/qt/Makefile.am +++ b/modules/gui/qt/Makefile.am @@ -674,6 +674,7 @@ libqt_plugin_la_QML = \ gui/qt/widgets/qml/BannerTabButton.qml \ gui/qt/widgets/qml/BusyIndicatorExt.qml \ gui/qt/widgets/qml/CaptionLabel.qml \ + gui/qt/widgets/qml/CheckedDelegate.qml \ gui/qt/widgets/qml/ComboBoxExt.qml \ gui/qt/widgets/qml/ContextButton.qml \ gui/qt/widgets/qml/CSDWindowButton.qml \ diff --git a/modules/gui/qt/vlc.qrc b/modules/gui/qt/vlc.qrc index 55b26e0b63..11839a54b2 100644 --- a/modules/gui/qt/vlc.qrc +++ b/modules/gui/qt/vlc.qrc @@ -232,6 +232,7 @@ <file alias="HorizontalResizeHandle.qml">widgets/qml/HorizontalResizeHandle.qml</file> <file alias="PointingTooltip.qml">widgets/qml/PointingTooltip.qml</file> <file alias="FrostedGlassEffect.qml">widgets/qml/FrostedGlassEffect.qml</file> + <file alias="CheckedDelegate.qml">widgets/qml/CheckedDelegate.qml</file> <file alias="PageLoader.qml">widgets/qml/PageLoader.qml</file> </qresource> <qresource prefix="/network"> diff --git a/modules/gui/qt/widgets/qml/CheckedDelegate.qml b/modules/gui/qt/widgets/qml/CheckedDelegate.qml new file mode 100644 index 0000000000..0aaf1f2c17 --- /dev/null +++ b/modules/gui/qt/widgets/qml/CheckedDelegate.qml @@ -0,0 +1,62 @@ + +/***************************************************************************** + * 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:///style/" +import "qrc:///util/KeyHelper.js" as KeyHelper + +T.ItemDelegate { + id: control + + checkable: true + leftPadding: VLCStyle.margin_xlarge + rightPadding: VLCStyle.margin_xsmall + + background: Rectangle { + color: control.hovered || control.activeFocus ? "#2A2A2A" : "transparent" + } + + contentItem: Item { // don't use a row, it will move text when control is unchecked + IconLabel { + id: checkIcon + + text: VLCIcons.check + visible: control.checked + height: parent.height + font.pixelSize: 24 + color: "white" + verticalAlignment: Text.AlignVCenter + } + + MenuLabel { + id: text + + anchors.left: checkIcon.right + height: parent.height + font: control.font + text: control.text + color: "white" + verticalAlignment: Text.AlignVCenter + leftPadding: VLCStyle.margin_normal + width: parent.width - checkIcon.width + } + } +} _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
