vlc | branch: master | Rohan Rajpal <[email protected]> | Fri Jun 28 15:34:03 2019 +0530| [6b3275d7306eeabd0b7ebd6da37e21a100106a67] | committer: Jean-Baptiste Kempf
Revert "qml: remove no longer used ComboBoxExt control" This reverts commit 4e76113fcd7f8dfd36f2ff07676d237c4ae4171f. Signed-off-by: Jean-Baptiste Kempf <[email protected]> > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6b3275d7306eeabd0b7ebd6da37e21a100106a67 --- modules/gui/qt/Makefile.am | 1 + modules/gui/qt/qml/utils/ComboBoxExt.qml | 119 +++++++++++++++++++++++++++++++ modules/gui/qt/vlc.qrc | 1 + 3 files changed, 121 insertions(+) diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am index 197857fee1..17e4708fb0 100644 --- a/modules/gui/qt/Makefile.am +++ b/modules/gui/qt/Makefile.am @@ -561,6 +561,7 @@ libqt_plugin_la_QML = \ gui/qt/qml/utils/KeyNavigableListView.qml \ gui/qt/qml/utils/KeyNavigableTableView.qml \ gui/qt/qml/utils/SelectableDelegateModel.qml \ + gui/qt/qml/utils/ComboBoxExt.qml \ gui/qt/qml/utils/StackViewExt.qml \ gui/qt/qml/utils/ScanProgressBar.qml \ gui/qt/qml/utils/SearchBox.qml \ diff --git a/modules/gui/qt/qml/utils/ComboBoxExt.qml b/modules/gui/qt/qml/utils/ComboBoxExt.qml new file mode 100644 index 0000000000..6e2b037b13 --- /dev/null +++ b/modules/gui/qt/qml/utils/ComboBoxExt.qml @@ -0,0 +1,119 @@ +/***************************************************************************** + * 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:///style/" + +ComboBox { + id: control + + font.pixelSize: VLCStyle.fontSize_normal + + delegate: ItemDelegate { + width: control.width + leftPadding: control.leftPadding + background: Item {} + contentItem: Text { + text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData + color: VLCStyle.colors.buttonText + font: control.font + elide: Text.ElideRight + verticalAlignment: Text.AlignVCenter + } + highlighted: control.highlightedIndex === index + } + + indicator: Canvas { + id: canvas + x: control.width - width - control.rightPadding + y: control.topPadding + (control.availableHeight - height) / 2 + width: 12 + height: 8 + contextType: "2d" + + Connections { + target: control + onPressedChanged: canvas.requestPaint() + } + + onPaint: { + context.reset(); + context.moveTo(0, 0); + context.lineTo(width, 0); + context.lineTo(width / 2, height); + context.closePath(); + context.fillStyle = control.activeFocus ? VLCStyle.colors.accent : VLCStyle.colors.buttonText; + context.fill(); + } + } + + contentItem: Text { + leftPadding: 0 + rightPadding: control.indicator.width + control.spacing + + text: control.displayText + font: control.font + color: VLCStyle.colors.buttonText + verticalAlignment: Text.AlignVCenter + elide: Text.ElideRight + } + + background: Rectangle { + implicitWidth: 120 + implicitHeight: 40 + color: VLCStyle.colors.button + border.color: control.activeFocus ? VLCStyle.colors.accent : VLCStyle.colors.buttonBorder + border.width: control.activeFocus ? 2 : 1 + radius: 2 + } + + popup: Popup { + y: control.height - 1 + width: control.width + implicitHeight: contentItem.implicitHeight + padding: 1 + + contentItem: ListView { + clip: true + implicitHeight: contentHeight + model: control.popup.visible ? control.delegateModel : null + currentIndex: control.highlightedIndex + + highlight: Rectangle { + color: VLCStyle.colors.accent + } + + Rectangle { + z: 10 + width: parent.width + height: parent.height + color: "transparent" + border.color: VLCStyle.colors.accent + } + + ScrollIndicator.vertical: ScrollIndicator { } + } + + background: Rectangle { + color: VLCStyle.colors.button + border.color: VLCStyle.colors.buttonBorder + radius: 2 + } + } +} diff --git a/modules/gui/qt/vlc.qrc b/modules/gui/qt/vlc.qrc index 61f45d6e77..311897bb5d 100644 --- a/modules/gui/qt/vlc.qrc +++ b/modules/gui/qt/vlc.qrc @@ -190,6 +190,7 @@ <file alias="TextToolButton.qml">qml/utils/TextToolButton.qml</file> <file alias="IconToolButton.qml">qml/utils/IconToolButton.qml</file> <file alias="StackViewExt.qml">qml/utils/StackViewExt.qml</file> + <file alias="ComboBoxExt.qml">qml/utils/ComboBoxExt.qml</file> <file alias="MenuExt.qml">qml/utils/MenuExt.qml</file> <file alias="MenuItemExt.qml">qml/utils/MenuItemExt.qml</file> <file alias="ExpandGridView.qml">qml/utils/ExpandGridView.qml</file> _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
