diff options
4 files changed, 36 insertions, 7 deletions
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-combobox-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-combobox-custom.qml index 9db3eb20..12d56a56 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-combobox-custom.qml +++ b/src/imports/controls/doc/snippets/qtquickcontrols2-combobox-custom.qml @@ -35,12 +35,18 @@ ComboBox { delegate: ItemDelegate { width: control.width - text: modelData - font.weight: control.currentIndex === index ? Font.DemiBold : Font.Normal + contentItem: Text { + text: modelData + color: "#21be2b" + 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 @@ -49,7 +55,7 @@ ComboBox { Connections { target: control - onPressedChanged: indicator.requestPaint() + onPressedChanged: canvas.requestPaint() } onPaint: { @@ -82,5 +88,26 @@ ComboBox { border.width: control.visualFocus ? 2 : 1 radius: 2 } + + popup: Popup { + y: control.height - 1 + width: control.width + implicitHeight: listview.contentHeight + padding: 1 + + contentItem: ListView { + id: listview + clip: true + model: control.popup.visible ? control.delegateModel : null + currentIndex: control.highlightedIndex + + ScrollIndicator.vertical: ScrollIndicator { } + } + + background: Rectangle { + border.color: "#21be2b" + radius: 2 + } + } } //! [file] diff --git a/src/imports/controls/doc/src/qtquickcontrols2-differences.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-differences.qdoc index 39213458..e6fdcb10 100644 --- a/src/imports/controls/doc/src/qtquickcontrols2-differences.qdoc +++ b/src/imports/controls/doc/src/qtquickcontrols2-differences.qdoc @@ -166,8 +166,9 @@ With this in mind, a good way to prepare for a migration to Qt Quick Controls 2 is to place each control that you have a custom style for in its - own QML file. For example, the Qt Quick Controls button above could be moved to a - file named Button.qml, and used in the following manner: + own QML file. For example, the Qt Quick Controls button above could be + moved to a file named \c Button.qml in a directory named \c controls, and + used in the following manner: \badcode import "controls" as Controls diff --git a/src/quicktemplates2/qquickcontainer.cpp b/src/quicktemplates2/qquickcontainer.cpp index be70f540..31a92b5d 100644 --- a/src/quicktemplates2/qquickcontainer.cpp +++ b/src/quicktemplates2/qquickcontainer.cpp @@ -55,11 +55,11 @@ QT_BEGIN_NAMESPACE \section2 Using Containers - Container provides API to \l {addItem}{add}, \l {insertItem}{insert}, + Container provides an API to \l {addItem}{add}, \l {insertItem}{insert}, \l {moveItem}{move} and \l {removeItem}{remove} items dynamically. The items in a container can be accessed using \l itemAt() or \l contentChildren. - Most containers have a concept of a "current" item. The current item is + Most containers have the concept of a "current" item. The current item is specified via the \l currentIndex property, and can be accessed using the read-only \l currentItem property. diff --git a/src/quicktemplates2/qquickstackview_p.cpp b/src/quicktemplates2/qquickstackview_p.cpp index 5d25793e..0f5674c2 100644 --- a/src/quicktemplates2/qquickstackview_p.cpp +++ b/src/quicktemplates2/qquickstackview_p.cpp @@ -155,6 +155,7 @@ void QQuickStackElement::incubate(QObject *object) item = qmlobject_cast<QQuickItem *>(object); if (item) { QQmlEngine::setObjectOwnership(item, QQmlEngine::CppOwnership); + item->setParent(view); initialize(); } } |