From b2056dabff3d3e1f949b21020ca05fce92ad70b4 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Fri, 19 Jan 2018 06:14:08 +0100 Subject: Link to Customizing doc from Styling doc These two things are closely related. Change-Id: I1b4586f7835af6bd9f82aaa6eeb75fe1ef6ba65d Reviewed-by: J-P Nurmi --- src/imports/controls/doc/src/qtquickcontrols2-styles.qdoc | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/imports/controls/doc/src/qtquickcontrols2-styles.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-styles.qdoc index f2df16ce..e006d41f 100644 --- a/src/imports/controls/doc/src/qtquickcontrols2-styles.qdoc +++ b/src/imports/controls/doc/src/qtquickcontrols2-styles.qdoc @@ -122,6 +122,7 @@ \li \l {Default Style} \li \l {Material Style} \li \l {Universal Style} + \li \l {Customizing Qt Quick Controls 2} \li \l {Using File Selectors with Qt Quick Controls 2} \li \l {Deploying Qt Quick Controls 2 Applications} \li \l {Qt Quick Controls 2 Configuration File} -- cgit v1.2.3 From ffda6894cc80909f900447d4de24bcc0effd467b Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Fri, 19 Jan 2018 06:28:15 +0100 Subject: Explain the benefits of customizing a control vs creating a style Mention that customizing a control is nice because you don't need to start from scratch with a template. Add a third requirement for "Definition of a Style" that mentions that the top level item must be a template, and why. Change-Id: I4db4ec8311baed46fb45271d107204808ba42592 Reviewed-by: J-P Nurmi --- src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc index a4a9fb44..b645633b 100644 --- a/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc +++ b/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc @@ -122,6 +122,9 @@ their actual counterparts in the Qt Quick Controls 2 module. You can repeat this process for any control that you wish to add. + An added benefit of these three methods is that it's not necessary to + implement the template from scratch. + \section1 Creating a Custom Style There are several ways to go about creating your own styles. Below, we'll @@ -130,12 +133,19 @@ \section2 Definition of a Style In Qt Quick Controls 2, a style is essentially an interchangeable set of - QML files within a single directory. There are two requirements for a style + QML files within a single directory. There are three requirements for a style to be \l {Using Styles in Qt Quick Controls 2}{usable}: \list \li At least one QML file whose name matches a control (for example, \c Button.qml) must exist. + \li Each QML file must contain the relevant type from the \l {Qt Quick Templates 2} + {QtQuick.Templates} import as the root item. For example, + Button.qml must contain a Button template as its root item. + + If we instead used the corresponding type from the \l {Qt Quick Controls 2} + {QtQuick.Controls} import as we did in the previous section, it would not work: + the control we were defining would try to derive from itself. \li The files must be in a directory in the filesystem or in the \l {The Qt Resource System}{resource system}. -- cgit v1.2.3 From aca950e43a25f4b80707ff4e2f17d71aef441d52 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Mon, 22 Jan 2018 10:58:06 +0100 Subject: Control: fix background size regression caused by deferred execution Task-number: QTBUG-65880 Change-Id: Ic4f9fb087f4a78bd4c6257828011240186b6b22e Reviewed-by: Mitch Curtis --- src/quicktemplates2/qquickcontrol.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/quicktemplates2/qquickcontrol.cpp b/src/quicktemplates2/qquickcontrol.cpp index 809c9f94..8d571c34 100644 --- a/src/quicktemplates2/qquickcontrol.cpp +++ b/src/quicktemplates2/qquickcontrol.cpp @@ -1320,6 +1320,7 @@ void QQuickControl::componentComplete() d->executeBackground(true); d->executeContentItem(true); QQuickItem::componentComplete(); + d->resizeBackground(); d->resizeContent(); if (!d->hasLocale) d->locale = QQuickControlPrivate::calcLocale(d->parentItem); -- cgit v1.2.3 From 0dbbfc2f2824aa3891fde0b219fb4951e94a64c9 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Mon, 22 Jan 2018 11:32:48 +0100 Subject: Fix Action shortcuts in Repeater QQuickRepeater does not set a QObject-parent, so make QQuickShortcutContext::matcher() start from the object itself and if no window is found, then iterate to the QObject parents. Task-number: QTBUG-65889 Change-Id: I30a1ed0616edd002abcf28d1b8dc7e2d87e99c13 Reviewed-by: Mitch Curtis --- src/quicktemplates2/qquickshortcutcontext.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/quicktemplates2/qquickshortcutcontext.cpp b/src/quicktemplates2/qquickshortcutcontext.cpp index b491cab2..e94de722 100644 --- a/src/quicktemplates2/qquickshortcutcontext.cpp +++ b/src/quicktemplates2/qquickshortcutcontext.cpp @@ -76,14 +76,16 @@ bool QQuickShortcutContext::matcher(QObject *obj, Qt::ShortcutContext context) return true; case Qt::WindowShortcut: while (obj && !obj->isWindowType()) { - obj = obj->parent(); item = qobject_cast(obj); if (item) { obj = item->window(); + break; } else if (QQuickPopup *popup = qobject_cast(obj)) { obj = popup->window(); item = popup->popupItem(); + break; } + obj = obj->parent(); } if (QWindow *renderWindow = QQuickRenderControl::renderWindowFor(qobject_cast(obj))) obj = renderWindow; -- cgit v1.2.3 From c3858bd53974e486e03537d1937deb0020828556 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Wed, 24 Jan 2018 13:44:00 +0100 Subject: QQuickComboBox: fix popup's deferred execution Unlike other delegates, such as background and contentItem, popup is not unconditionally executed upon component completion. For performance reasons, its execution is delayed until the popup is needed, that is, the popup is accessed or shown. When the popup is accessed, we use the current completion status via isComponentComplete() to determine whether its execution must be completed immediately, or if we can wait until componentComplete(). However, if the popup was accessed while the combobox itself was being completed (used in ComboBox's bindings), the popup was never completed because isComponentComplete() was still returning false even though the popup was actually being indirectly accessed from componentComplete(). A simple execution order change, to complete the combobox itself before the popup, fixes the problem. Task-number: QTBUG-65962 Change-Id: I4764eb7e273e7f6fa1dab1a65a02b87722ee7cba Reviewed-by: Mitch Curtis --- src/quicktemplates2/qquickcombobox.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/quicktemplates2/qquickcombobox.cpp b/src/quicktemplates2/qquickcombobox.cpp index fb10730e..55ff0e55 100644 --- a/src/quicktemplates2/qquickcombobox.cpp +++ b/src/quicktemplates2/qquickcombobox.cpp @@ -1603,9 +1603,9 @@ void QQuickComboBox::componentComplete() { Q_D(QQuickComboBox); d->executeIndicator(true); + QQuickControl::componentComplete(); if (d->popup) d->executePopup(true); - QQuickControl::componentComplete(); if (d->delegateModel && d->ownModel) static_cast(d->delegateModel)->componentComplete(); -- cgit v1.2.3 From bad503ca690ab6f31958c049105b70e23b9406ea Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Mon, 22 Jan 2018 12:34:13 +0100 Subject: Doc: provide examples of setting Imagine path Remove any ambiguity about how the paths might be specified. Change-Id: I004e13349a54ded9a41586a8f5a564731a821585 Reviewed-by: J-P Nurmi --- .../doc/src/includes/qquickimaginestyle.qdocinc | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'src') diff --git a/src/imports/controls/doc/src/includes/qquickimaginestyle.qdocinc b/src/imports/controls/doc/src/includes/qquickimaginestyle.qdocinc index 8acec2a8..f6fe5a97 100644 --- a/src/imports/controls/doc/src/includes/qquickimaginestyle.qdocinc +++ b/src/imports/controls/doc/src/includes/qquickimaginestyle.qdocinc @@ -8,6 +8,21 @@ \li Specifies the \l {imagine-path-attached-prop}{path} to the directory that contains the Imagine style assets. If not specified, the built-in assets are used. + For example, to specify a path to a directory stored in the + \l {The Qt Resource System}{resource system}: + + \badcode + [Imagine] + Path=:/imagine-assets + \endcode + + To specify a relative path to a local directory: + + \badcode + [Imagine] + Path=imagine-assets + \endcode + \note Due to a technical limitation, the path should not be named \e "imagine" if it is relative to the \c qtquickcontrols2.conf file. \endtable @@ -23,6 +38,19 @@ \li Specifies the path to the directory that contains the Imagine style assets. If not specified, the built-in assets are used. + For example, to specify a path to a directory stored in the + \l {The Qt Resource System}{resource system}: + + \badcode + QT_QUICK_CONTROLS_IMAGINE_PATH=:/imagine-assets + \endcode + + To specify a relative path to a local directory: + + \badcode + QT_QUICK_CONTROLS_IMAGINE_PATH=imagine-assets + \endcode + \note Due to a technical limitation, the path should not be named \e "imagine" if it is relative to the \c qtquickcontrols2.conf file. \endtable -- cgit v1.2.3