[vlc-commits] qml: provide specialized time header and column delegates for KeyNavigableTableView

Prince Gupta git at videolan.org
Fri Jun 19 09:54:04 CEST 2020


vlc | branch: master | Prince Gupta <guptaprince8832 at gmail.com> | Wed Jun  3 18:21:15 2020 +0530| [e52c3db0388eefc65c87be07f95f6a9b6a2ba979] | committer: Pierre Lamot

qml: provide specialized time header and column delegates for KeyNavigableTableView

introduce new qml file where we can put special delegates for columns in
KeyNavigableTableView

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e52c3db0388eefc65c87be07f95f6a9b6a2ba979
---

 modules/gui/qt/Makefile.am                  |  1 +
 modules/gui/qt/vlc.qrc                      |  1 +
 modules/gui/qt/widgets/qml/TableColumns.qml | 52 +++++++++++++++++++++++++++++
 3 files changed, 54 insertions(+)

diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am
index 58082e5439..f804bcbd6a 100644
--- a/modules/gui/qt/Makefile.am
+++ b/modules/gui/qt/Makefile.am
@@ -681,6 +681,7 @@ libqt_plugin_la_QML = \
 	gui/qt/widgets/qml/SpinBoxExt.qml \
 	gui/qt/widgets/qml/StackViewExt.qml \
 	gui/qt/widgets/qml/TabButtonExt.qml \
+	gui/qt/widgets/qml/TableColumns.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 c349029c81..9fbf88ad31 100644
--- a/modules/gui/qt/vlc.qrc
+++ b/modules/gui/qt/vlc.qrc
@@ -186,6 +186,7 @@
         <file alias="ToolTipArea.qml">widgets/qml/ToolTipArea.qml</file>
         <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="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/TableColumns.qml b/modules/gui/qt/widgets/qml/TableColumns.qml
new file mode 100644
index 0000000000..b04839677c
--- /dev/null
+++ b/modules/gui/qt/widgets/qml/TableColumns.qml
@@ -0,0 +1,52 @@
+/*****************************************************************************
+ * Copyright (C) 2019 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 "qrc:///widgets/" as Widgets
+import "qrc:///style/"
+
+Item {
+
+    property Component timeHeaderDelegate: Widgets.IconLabel {
+        width: timeTextMetric.width
+        horizontalAlignment: Text.AlignHCenter
+        text: VLCIcons.time
+        color: VLCStyle.colors.caption
+    }
+
+    property Component timeColDelegate: Item {
+        property var rowModel: parent.rowModel
+        property var model: parent.colModel
+
+        Widgets.ListLabel {
+            width: timeTextMetric.width
+            height: parent.height
+            horizontalAlignment: Text.AlignHCenter
+            text: !rowModel ? "" : rowModel[model.criteria] || ""
+        }
+    }
+
+    TextMetrics {
+        id: timeTextMetric
+
+        font.pixelSize: VLCStyle.fontSize_normal
+        text: "00h00"
+    }
+
+}



More information about the vlc-commits mailing list