[vlc-devel] [PATCH 04/21] qml: add CheckedDelegate widget
Prince Gupta
guptaprince8832 at gmail.com
Fri Oct 23 15:20:58 CEST 2020
---
modules/gui/qt/Makefile.am | 1 +
modules/gui/qt/vlc.qrc | 1 +
.../gui/qt/widgets/qml/CheckedDelegate.qml | 62 +++++++++++++++++++
3 files changed, 64 insertions(+)
create mode 100644 modules/gui/qt/widgets/qml/CheckedDelegate.qml
diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am
index dbe2dc3b83..68ca5682d9 100644
--- a/modules/gui/qt/Makefile.am
+++ b/modules/gui/qt/Makefile.am
@@ -675,6 +675,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 50d0bfd478..5fc3971b45 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
+ }
+ }
+}
--
2.25.1
More information about the vlc-devel
mailing list