diff options
27 files changed, 786 insertions, 24 deletions
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-imagine.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-imagine.qdoc index c7ad71cf..2a9f1c5d 100644 --- a/src/imports/controls/doc/src/qtquickcontrols2-imagine.qdoc +++ b/src/imports/controls/doc/src/qtquickcontrols2-imagine.qdoc @@ -2417,10 +2417,10 @@ The \l {https://developers.google.com/speed/webp/}{WebP} and GIF animated image formats are supported by the Imagine style. - \section2 Palette - \section2 Customization + \section3 Path + The Imagine style allows customizing the \l {imagine-path-attached-prop}{path} that is used to do the image asset selection. The path can be specified for any window or item, and it automatically propagates to children in the same manner as @@ -2454,23 +2454,40 @@ \endtable In addition to specifying the path in QML, it is also possible to specify - it via an environment variable or in a configuration file. Attributes - specified in QML take precedence over all other methods. + it via an \l {imagine-customization-environment-variable}{environment variable} + or in a \l {imagine-customization-configuration-file}{configuration file}. + Attributes specified in QML take precedence over all other methods. - \section3 Configuration File + \section4 Configuration File + \target imagine-customization-configuration-file \include qquickimaginestyle.qdocinc conf See \l {Qt Quick Controls 2 Configuration File} for more details about the configuration file. - \section3 Environment Variables + \section4 Environment Variables + \target imagine-customization-environment-variable \include qquickimaginestyle.qdocinc env See \l {Supported Environment Variables in Qt Quick Controls 2} for the full list of supported environment variables. + \section3 Palette + + The Imagine style supports palette customization via the \l {Control::}{palette} + property and the \l {Palette Configuration}{qtquickcontrols2.conf} file. + As with other styles, the exact \l {palette QML Basic Type}{palette roles} + that the Imagine style uses are style-dependent. However, as most of the visual + appearance of controls (for example: backgrounds) are managed through image assets, + only the roles that are typically used for text will have an effect. + + \section3 Font + + Custom fonts can be set via the \l {Control::}{font} property and the + \l {Font Configuration}{configuration} file. + \section2 Dependency The Imagine style must be separately imported to gain access to the diff --git a/src/quicktemplates2/qquickabstractbutton.cpp b/src/quicktemplates2/qquickabstractbutton.cpp index 3b41f34c..a2992191 100644 --- a/src/quicktemplates2/qquickabstractbutton.cpp +++ b/src/quicktemplates2/qquickabstractbutton.cpp @@ -201,6 +201,11 @@ void QQuickAbstractButtonPrivate::handleUngrab() emit q->canceled(); } +bool QQuickAbstractButtonPrivate::acceptKeyClick(Qt::Key key) const +{ + return key == Qt::Key_Space; +} + bool QQuickAbstractButtonPrivate::isPressAndHoldConnected() { Q_Q(QQuickAbstractButton); @@ -449,7 +454,9 @@ QQuickAbstractButton::~QQuickAbstractButton() d->removeImplicitSizeListener(d->indicator); if (d->group) d->group->removeButton(this); +#if QT_CONFIG(shortcut) d->ungrabShortcut(); +#endif } /*! @@ -1029,7 +1036,7 @@ void QQuickAbstractButton::keyPressEvent(QKeyEvent *event) { Q_D(QQuickAbstractButton); QQuickControl::keyPressEvent(event); - if (event->key() == Qt::Key_Space) { + if (d->acceptKeyClick(static_cast<Qt::Key>(event->key()))) { d->setPressPoint(QPoint(qRound(width() / 2), qRound(height() / 2))); setPressed(true); @@ -1045,7 +1052,7 @@ void QQuickAbstractButton::keyReleaseEvent(QKeyEvent *event) { Q_D(QQuickAbstractButton); QQuickControl::keyReleaseEvent(event); - if (event->key() == Qt::Key_Space) { + if (d->acceptKeyClick(static_cast<Qt::Key>(event->key()))) { setPressed(false); nextCheckState(); diff --git a/src/quicktemplates2/qquickabstractbutton_p_p.h b/src/quicktemplates2/qquickabstractbutton_p_p.h index 718498a8..7394f115 100644 --- a/src/quicktemplates2/qquickabstractbutton_p_p.h +++ b/src/quicktemplates2/qquickabstractbutton_p_p.h @@ -75,6 +75,8 @@ public: void handleRelease(const QPointF &point) override; void handleUngrab() override; + virtual bool acceptKeyClick(Qt::Key key) const; + bool isPressAndHoldConnected(); void startPressAndHold(); void stopPressAndHold(); diff --git a/src/quicktemplates2/qquickaction.cpp b/src/quicktemplates2/qquickaction.cpp index 6ff3a183..e83fd353 100644 --- a/src/quicktemplates2/qquickaction.cpp +++ b/src/quicktemplates2/qquickaction.cpp @@ -113,6 +113,7 @@ QT_BEGIN_NAMESPACE when \l trigger() is called directly. */ +#if QT_CONFIG(shortcut) static QKeySequence variantToKeySequence(const QVariant &var) { if (var.type() == QVariant::Int) @@ -193,6 +194,7 @@ void QQuickActionPrivate::setShortcut(const QVariant &var) emit q->shortcutChanged(keySequence); } +#endif // QT_CONFIG(shortcut) void QQuickActionPrivate::setEnabled(bool enable) { @@ -202,9 +204,11 @@ void QQuickActionPrivate::setEnabled(bool enable) enabled = enable; +#if QT_CONFIG(shortcut) defaultShortcutEntry->setEnabled(enable); for (QQuickActionPrivate::ShortcutEntry *entry : qAsConst(shortcutEntries)) entry->setEnabled(enable); +#endif emit q->enabledChanged(enable); } @@ -236,16 +240,19 @@ void QQuickActionPrivate::registerItem(QQuickItem *item) if (!watchItem(item)) return; +#if QT_CONFIG(shortcut) QQuickActionPrivate::ShortcutEntry *entry = new QQuickActionPrivate::ShortcutEntry(item); if (item->isVisible()) entry->grab(keySequence, enabled); shortcutEntries += entry; updateDefaultShortcutEntry(); +#endif } void QQuickActionPrivate::unregisterItem(QQuickItem *item) { +#if QT_CONFIG(shortcut) QQuickActionPrivate::ShortcutEntry *entry = findShortcutEntry(item); if (!entry || !unwatchItem(item)) return; @@ -254,10 +261,12 @@ void QQuickActionPrivate::unregisterItem(QQuickItem *item) delete entry; updateDefaultShortcutEntry(); +#endif } void QQuickActionPrivate::itemVisibilityChanged(QQuickItem *item) { +#if QT_CONFIG(shortcut) QQuickActionPrivate::ShortcutEntry *entry = findShortcutEntry(item); if (!entry) return; @@ -268,6 +277,7 @@ void QQuickActionPrivate::itemVisibilityChanged(QQuickItem *item) entry->ungrab(); updateDefaultShortcutEntry(); +#endif } void QQuickActionPrivate::itemDestroyed(QQuickItem *item) @@ -275,6 +285,7 @@ void QQuickActionPrivate::itemDestroyed(QQuickItem *item) unregisterItem(item); } +#if QT_CONFIG(shortcut) bool QQuickActionPrivate::handleShortcutEvent(QObject *object, QShortcutEvent *event) { Q_Q(QQuickAction); @@ -316,12 +327,15 @@ void QQuickActionPrivate::updateDefaultShortcutEntry() else if (!defaultShortcutEntry->shortcutId()) defaultShortcutEntry->grab(keySequence, enabled); } +#endif // QT_CONFIG(shortcut) QQuickAction::QQuickAction(QObject *parent) : QObject(*(new QQuickActionPrivate), parent) { Q_D(QQuickAction); +#if QT_CONFIG(shortcut) d->defaultShortcutEntry = new QQuickActionPrivate::ShortcutEntry(this); +#endif } QQuickAction::~QQuickAction() @@ -330,11 +344,13 @@ QQuickAction::~QQuickAction() if (d->group) d->group->removeAction(this); +#if QT_CONFIG(shortcut) for (QQuickActionPrivate::ShortcutEntry *entry : qAsConst(d->shortcutEntries)) d->unwatchItem(qobject_cast<QQuickItem *>(entry->target())); qDeleteAll(d->shortcutEntries); delete d->defaultShortcutEntry; +#endif } /*! @@ -460,6 +476,7 @@ void QQuickAction::setCheckable(bool checkable) emit checkableChanged(checkable); } +#if QT_CONFIG(shortcut) /*! \qmlproperty keysequence QtQuick.Controls::Action::shortcut @@ -486,6 +503,7 @@ void QQuickAction::setShortcut(const QKeySequence &shortcut) Q_D(QQuickAction); d->setShortcut(shortcut.toString()); } +#endif // QT_CONFIG(shortcut) /*! \qmlmethod void QtQuick.Controls::Action::toggle(QtObject source = null) @@ -537,17 +555,21 @@ void QQuickActionPrivate::trigger(QObject* source, bool doToggle) bool QQuickAction::event(QEvent *event) { Q_D(QQuickAction); - if (event->type() != QEvent::Shortcut) - return QObject::event(event); - return d->handleShortcutEvent(this, static_cast<QShortcutEvent *>(event)); +#if QT_CONFIG(shortcut) + if (event->type() == QEvent::Shortcut) + return d->handleShortcutEvent(this, static_cast<QShortcutEvent *>(event)); +#endif + return QObject::event(event); } bool QQuickAction::eventFilter(QObject *object, QEvent *event) { Q_D(QQuickAction); - if (event->type() != QEvent::Shortcut) - return false; - return d->handleShortcutEvent(object, static_cast<QShortcutEvent *>(event)); +#if QT_CONFIG(shortcut) + if (event->type() == QEvent::Shortcut) + return d->handleShortcutEvent(object, static_cast<QShortcutEvent *>(event)); +#endif + return false; } QT_END_NAMESPACE diff --git a/src/quicktemplates2/qquickaction_p.h b/src/quicktemplates2/qquickaction_p.h index ce989bed..cbe0d8fe 100644 --- a/src/quicktemplates2/qquickaction_p.h +++ b/src/quicktemplates2/qquickaction_p.h @@ -66,7 +66,9 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickAction : public QObject Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged RESET resetEnabled FINAL) Q_PROPERTY(bool checked READ isChecked WRITE setChecked NOTIFY checkedChanged FINAL) Q_PROPERTY(bool checkable READ isCheckable WRITE setCheckable NOTIFY checkableChanged FINAL) +#if QT_CONFIG(shortcut) Q_PRIVATE_PROPERTY(QQuickAction::d_func(), QVariant shortcut READ shortcut WRITE setShortcut NOTIFY shortcutChanged FINAL) +#endif public: explicit QQuickAction(QObject *parent = nullptr); @@ -88,8 +90,10 @@ public: bool isCheckable() const; void setCheckable(bool checkable); +#if QT_CONFIG(shortcut) QKeySequence shortcut() const; void setShortcut(const QKeySequence &shortcut); +#endif public Q_SLOTS: void toggle(QObject *source = nullptr); @@ -101,7 +105,9 @@ Q_SIGNALS: void enabledChanged(bool enabled); void checkedChanged(bool checked); void checkableChanged(bool checkable); +#if QT_CONFIG(shortcut) void shortcutChanged(const QKeySequence &shortcut); +#endif void toggled(QObject *source = nullptr); void triggered(QObject *source = nullptr); diff --git a/src/quicktemplates2/qquickaction_p_p.h b/src/quicktemplates2/qquickaction_p_p.h index 98b0973b..7c70bab1 100644 --- a/src/quicktemplates2/qquickaction_p_p.h +++ b/src/quicktemplates2/qquickaction_p_p.h @@ -69,8 +69,10 @@ public: return action->d_func(); } +#if QT_CONFIG(shortcut) QVariant shortcut() const; void setShortcut(const QVariant &shortcut); +#endif void setEnabled(bool enable); @@ -87,6 +89,7 @@ public: void trigger(QObject*, bool doToggle); +#if QT_CONFIG(shortcut) class ShortcutEntry { public: @@ -108,6 +111,7 @@ public: ShortcutEntry *findShortcutEntry(QObject *target) const; void updateDefaultShortcutEntry(); +#endif // QT_CONFIG(shortcut) bool explicitEnabled = false; bool enabled = true; @@ -115,10 +119,12 @@ public: bool checkable = false; QString text; QQuickIcon icon; - QVariant vshortcut; QKeySequence keySequence; +#if QT_CONFIG(shortcut) + QVariant vshortcut; ShortcutEntry *defaultShortcutEntry = nullptr; QVector<ShortcutEntry *> shortcutEntries; +#endif QQuickActionGroup *group = nullptr; }; diff --git a/src/quicktemplates2/qquickdrawer.cpp b/src/quicktemplates2/qquickdrawer.cpp index 95b27512..9cc38791 100644 --- a/src/quicktemplates2/qquickdrawer.cpp +++ b/src/quicktemplates2/qquickdrawer.cpp @@ -222,6 +222,9 @@ QQuickPopupPositioner *QQuickDrawerPrivate::getPositioner() void QQuickDrawerPositioner::reposition() { + if (m_positioning) + return; + QQuickDrawer *drawer = static_cast<QQuickDrawer*>(popup()); QQuickWindow *window = drawer->window(); if (!window) diff --git a/src/quicktemplates2/qquickmenuitem.cpp b/src/quicktemplates2/qquickmenuitem.cpp index b02b8e60..22fe664a 100644 --- a/src/quicktemplates2/qquickmenuitem.cpp +++ b/src/quicktemplates2/qquickmenuitem.cpp @@ -147,6 +147,11 @@ void QQuickMenuItemPrivate::executeArrow(bool complete) quickCompleteDeferred(q, arrowName(), arrow); } +bool QQuickMenuItemPrivate::acceptKeyClick(Qt::Key key) const +{ + return key == Qt::Key_Space || key == Qt::Key_Return || key == Qt::Key_Enter; +} + /*! \qmlsignal void QtQuick.Controls::MenuItem::triggered() diff --git a/src/quicktemplates2/qquickmenuitem_p_p.h b/src/quicktemplates2/qquickmenuitem_p_p.h index 034a199a..58a0ff20 100644 --- a/src/quicktemplates2/qquickmenuitem_p_p.h +++ b/src/quicktemplates2/qquickmenuitem_p_p.h @@ -73,6 +73,8 @@ public: void cancelArrow(); void executeArrow(bool complete = false); + bool acceptKeyClick(Qt::Key key) const override; + bool highlighted = false; QQuickDeferredPointer<QQuickItem> arrow; QQuickMenu *menu = nullptr; diff --git a/src/quicktemplates2/qquickpage.cpp b/src/quicktemplates2/qquickpage.cpp index 56034297..cb90ac48 100644 --- a/src/quicktemplates2/qquickpage.cpp +++ b/src/quicktemplates2/qquickpage.cpp @@ -149,10 +149,12 @@ void QQuickPagePrivate::itemVisibilityChanged(QQuickItem *item) Q_Q(QQuickPage); QQuickPanePrivate::itemVisibilityChanged(item); if (item == header) { + QBoolBlocker signalGuard(emittingImplicitSizeChangedSignals); emit q->implicitHeaderWidthChanged(); emit q->implicitHeaderHeightChanged(); relayout(); } else if (item == footer) { + QBoolBlocker signalGuard(emittingImplicitSizeChangedSignals); emit q->implicitFooterWidthChanged(); emit q->implicitFooterHeightChanged(); relayout(); @@ -163,6 +165,11 @@ void QQuickPagePrivate::itemImplicitWidthChanged(QQuickItem *item) { Q_Q(QQuickPage); QQuickPanePrivate::itemImplicitWidthChanged(item); + + // Avoid binding loops by skipping signal emission if we're already doing it. + if (emittingImplicitSizeChangedSignals) + return; + if (item == header) emit q->implicitHeaderWidthChanged(); else if (item == footer) @@ -173,6 +180,11 @@ void QQuickPagePrivate::itemImplicitHeightChanged(QQuickItem *item) { Q_Q(QQuickPage); QQuickPanePrivate::itemImplicitHeightChanged(item); + + // Avoid binding loops by skipping signal emission if we're already doing it. + if (emittingImplicitSizeChangedSignals) + return; + if (item == header) emit q->implicitHeaderHeightChanged(); else if (item == footer) diff --git a/src/quicktemplates2/qquickpage_p_p.h b/src/quicktemplates2/qquickpage_p_p.h index b7d89ac4..6c8b0371 100644 --- a/src/quicktemplates2/qquickpage_p_p.h +++ b/src/quicktemplates2/qquickpage_p_p.h @@ -71,6 +71,7 @@ public: QString title; QQuickItem *header = nullptr; QQuickItem *footer = nullptr; + bool emittingImplicitSizeChangedSignals = false; }; QT_END_NAMESPACE diff --git a/src/quicktemplates2/qquickpopup.cpp b/src/quicktemplates2/qquickpopup.cpp index 72e4f042..dd7dede6 100644 --- a/src/quicktemplates2/qquickpopup.cpp +++ b/src/quicktemplates2/qquickpopup.cpp @@ -1972,8 +1972,8 @@ void QQuickPopup::setOpacity(qreal opacity) This property holds the scale factor of the popup. The default value is \c 1.0. A scale of less than \c 1.0 causes the popup to be rendered at a smaller size, - and a scale greater than \c 1.0 renders the popup at a larger size. A negative - scale causes the popup to be mirrored when rendered. + and a scale greater than \c 1.0 renders the popup at a larger size. Negative + scales are not supported. */ qreal QQuickPopup::scale() const { diff --git a/src/quicktemplates2/qquickpopuppositioner_p_p.h b/src/quicktemplates2/qquickpopuppositioner_p_p.h index 6eb990a7..64f57a3f 100644 --- a/src/quicktemplates2/qquickpopuppositioner_p_p.h +++ b/src/quicktemplates2/qquickpopuppositioner_p_p.h @@ -73,7 +73,6 @@ protected: void itemParentChanged(QQuickItem *, QQuickItem *parent) override; void itemChildRemoved(QQuickItem *, QQuickItem *child) override; -private: void removeAncestorListeners(QQuickItem *item); void addAncestorListeners(QQuickItem *item); diff --git a/src/quicktemplates2/qquickscrollview.cpp b/src/quicktemplates2/qquickscrollview.cpp index 57b0177e..7890a30a 100644 --- a/src/quicktemplates2/qquickscrollview.cpp +++ b/src/quicktemplates2/qquickscrollview.cpp @@ -154,6 +154,7 @@ public: bool wasTouched = false; QQuickFlickable *flickable = nullptr; + bool ownsFlickable = false; }; QList<QQuickItem *> QQuickScrollViewPrivate::contentChildItems() const @@ -174,8 +175,10 @@ QQuickItem *QQuickScrollViewPrivate::getContentItem() QQuickFlickable *QQuickScrollViewPrivate::ensureFlickable(bool content) { Q_Q(QQuickScrollView); - if (!flickable) + if (!flickable) { setFlickable(new QQuickFlickable(q), content); + ownsFlickable = true; + } return flickable; } @@ -563,8 +566,16 @@ void QQuickScrollView::contentSizeChange(const QSizeF &newSize, const QSizeF &ol Q_D(QQuickScrollView); QQuickPane::contentSizeChange(newSize, oldSize); if (d->flickable) { - d->flickable->setContentWidth(newSize.width()); - d->flickable->setContentHeight(newSize.height()); + // Only set the content size on the flickable if we created the + // flickable ourselves. Otherwise we can end up overwriting + // assignments done to those properties by the application. The + // exception is if the application has assigned a content size + // directly to the scrollview, which will then win even if the + // application has assigned something else to the flickable. + if (d->hasContentWidth || d->ownsFlickable) + d->flickable->setContentWidth(newSize.width()); + if (d->hasContentHeight || d->ownsFlickable) + d->flickable->setContentHeight(newSize.height()); } } diff --git a/src/quicktemplates2/qquickspinbox.cpp b/src/quicktemplates2/qquickspinbox.cpp index 7f4f59fa..6af1d8e8 100644 --- a/src/quicktemplates2/qquickspinbox.cpp +++ b/src/quicktemplates2/qquickspinbox.cpp @@ -629,7 +629,8 @@ void QQuickSpinBox::setValidator(QValidator *validator) is the value to be converted, and the optional second argument is the locale that should be used for the conversion, if applicable. - The default implementation does the conversion using \l {QtQml::Locale}{Number.toLocaleString()}: + The default implementation does the conversion using + \l {QtQml::Number::toLocaleString()}{Number.toLocaleString}(): \code textFromValue: function(value, locale) { return Number(value).toLocaleString(locale, 'f', 0); } diff --git a/src/quicktemplates2/quicktemplates2.pro b/src/quicktemplates2/quicktemplates2.pro index 59871a54..13b4f0e8 100644 --- a/src/quicktemplates2/quicktemplates2.pro +++ b/src/quicktemplates2/quicktemplates2.pro @@ -1,6 +1,5 @@ TARGET = QtQuickTemplates2 MODULE = quicktemplates2 -CONFIG += internal_module QT += quick QT_PRIVATE += core-private gui-private qml-private quick-private diff --git a/tests/auto/cursor/tst_cursor.cpp b/tests/auto/cursor/tst_cursor.cpp index 0f24a29e..d59e7091 100644 --- a/tests/auto/cursor/tst_cursor.cpp +++ b/tests/auto/cursor/tst_cursor.cpp @@ -44,6 +44,11 @@ #include <QtQuickTemplates2/private/qquickscrollbar_p.h> #include <QtQuickTemplates2/private/qquicktextarea_p.h> +#if QT_CONFIG(cursor) +# include <QtGui/qscreen.h> +# include <QtGui/qcursor.h> +#endif + using namespace QQuickVisualTestUtil; class tst_cursor : public QQmlDataTest @@ -51,6 +56,7 @@ class tst_cursor : public QQmlDataTest Q_OBJECT private slots: + void init(); void controls_data(); void controls(); void editable(); @@ -58,6 +64,17 @@ private slots: void scrollBar(); }; +void tst_cursor::init() +{ +#if QT_CONFIG(cursor) + // Ensure mouse cursor was not left by previous tests where widgets + // will appear, as it could cause events and interfere with the tests. + const QScreen *screen = QGuiApplication::primaryScreen(); + const QRect availableGeometry = screen->availableGeometry(); + QCursor::setPos(availableGeometry.topLeft()); +#endif +} + void tst_cursor::controls_data() { QTest::addColumn<QString>("testFile"); diff --git a/tests/auto/qquickdrawer/data/topEdgeScreenEdge.qml b/tests/auto/qquickdrawer/data/topEdgeScreenEdge.qml new file mode 100644 index 00000000..02b5a10f --- /dev/null +++ b/tests/auto/qquickdrawer/data/topEdgeScreenEdge.qml @@ -0,0 +1,78 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.12 +import QtQuick.Controls 2.5 + +ApplicationWindow { + id: window + width: 400 + height: 400 + + property alias drawer: drawer + + header: Rectangle { + color: "red" + height: 40 + } + + Drawer { + id: drawer + width: window.width + height: window.height * 0.2 + parent: window.contentItem + edge: Qt.TopEdge + + Label { + anchors.centerIn: parent + text: "a drawer" + } + } +} diff --git a/tests/auto/qquickdrawer/tst_qquickdrawer.cpp b/tests/auto/qquickdrawer/tst_qquickdrawer.cpp index e3a6ccf2..816f9b67 100644 --- a/tests/auto/qquickdrawer/tst_qquickdrawer.cpp +++ b/tests/auto/qquickdrawer/tst_qquickdrawer.cpp @@ -109,6 +109,8 @@ private slots: void slider_data(); void slider(); + void topEdgeScreenEdge(); + private: struct TouchDeviceDeleter { @@ -1316,6 +1318,20 @@ void tst_QQuickDrawer::slider() QTest::touchEvent(window, touchDevice.data()).release(0, to); } +void tst_QQuickDrawer::topEdgeScreenEdge() +{ + QQuickApplicationHelper helper(this, QStringLiteral("topEdgeScreenEdge.qml")); + QQuickWindow *window = helper.window; + window->show(); + QVERIFY(QTest::qWaitForWindowActive(window)); + + QQuickDrawer *drawer = window->property("drawer").value<QQuickDrawer *>(); + QVERIFY(drawer); + + QVERIFY(QMetaObject::invokeMethod(drawer, "open")); + QTRY_COMPARE(drawer->position(), 1.0); +} + QTEST_QUICKCONTROLS_MAIN(tst_QQuickDrawer) #include "tst_qquickdrawer.moc" diff --git a/tests/auto/qquickmenu/tst_qquickmenu.cpp b/tests/auto/qquickmenu/tst_qquickmenu.cpp index a24305b7..e1f5d35f 100644 --- a/tests/auto/qquickmenu/tst_qquickmenu.cpp +++ b/tests/auto/qquickmenu/tst_qquickmenu.cpp @@ -316,9 +316,38 @@ void tst_QQuickMenu::contextMenuKeyboard() QCOMPARE(menu->currentIndex(), -1); QCOMPARE(menu->contentItem()->property("currentIndex"), QVariant(-1)); + // Enter/return should also work. + // Open the menu. menu->open(); QCOMPARE(visibleSpy.count(), 3); QVERIFY(menu->isVisible()); + // Give the first item focus. + QTest::keyClick(window, Qt::Key_Tab); + QVERIFY(firstItem->hasActiveFocus()); + QVERIFY(firstItem->hasVisualFocus()); + QVERIFY(firstItem->isHighlighted()); + QCOMPARE(firstItem->focusReason(), Qt::TabFocusReason); + QCOMPARE(menu->currentIndex(), 0); + QCOMPARE(menu->contentItem()->property("currentIndex"), QVariant(0)); + // Press enter. + QSignalSpy firstTriggeredSpy(firstItem, SIGNAL(triggered())); + QTest::keyClick(window, Qt::Key_Return); + QCOMPARE(firstTriggeredSpy.count(), 1); + QCOMPARE(visibleSpy.count(), 4); + QVERIFY(!menu->isVisible()); + QVERIFY(!window->overlay()->childItems().contains(menu->contentItem())); + QVERIFY(!firstItem->hasActiveFocus()); + QVERIFY(!firstItem->hasVisualFocus()); + QVERIFY(!firstItem->isHighlighted()); + QVERIFY(!secondItem->hasActiveFocus()); + QVERIFY(!secondItem->hasVisualFocus()); + QVERIFY(!secondItem->isHighlighted()); + QCOMPARE(menu->currentIndex(), -1); + QCOMPARE(menu->contentItem()->property("currentIndex"), QVariant(-1)); + + menu->open(); + QCOMPARE(visibleSpy.count(), 5); + QVERIFY(menu->isVisible()); QVERIFY(window->overlay()->childItems().contains(menu->contentItem()->parentItem())); QVERIFY(!firstItem->hasActiveFocus()); QVERIFY(!firstItem->hasVisualFocus()); @@ -393,7 +422,7 @@ void tst_QQuickMenu::contextMenuKeyboard() QVERIFY(!thirdItem->isHighlighted()); QTest::keyClick(window, Qt::Key_Escape); - QCOMPARE(visibleSpy.count(), 4); + QCOMPARE(visibleSpy.count(), 6); QVERIFY(!menu->isVisible()); } diff --git a/tests/manual/dialogs/CustomDialog.qml b/tests/manual/dialogs/CustomDialog.qml new file mode 100644 index 00000000..0e86fbb8 --- /dev/null +++ b/tests/manual/dialogs/CustomDialog.qml @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick.Controls 2.12 + +Dialog { + id: root + x: previousDialog ? previousDialog.x + previousDialog.width + space : 0 + y: previousDialog ? previousDialog.y : 0 + closePolicy: Dialog.NoAutoClose + visible: true + + property Dialog previousDialog + property int space: dialogSpacing + + Marker { + parent: root.footer.contentItem + visible: visualizeDialogButtonBoxContentItem + text: "footer.contentItem" + } + Marker { + parent: root.footer + visible: visualizeDialogButtonBox + text: "footer" + border.color: "red" + } +} diff --git a/tests/manual/dialogs/DialogLabel.qml b/tests/manual/dialogs/DialogLabel.qml new file mode 100644 index 00000000..c4775aea --- /dev/null +++ b/tests/manual/dialogs/DialogLabel.qml @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick.Controls 2.12 + +Label { + x: dialog.x + (dialog.width - width) / 2 + y: dialog.y - height + width: dialog.width + wrapMode: Label.Wrap + + property Dialog dialog +} diff --git a/tests/manual/dialogs/Marker.qml b/tests/manual/dialogs/Marker.qml new file mode 100644 index 00000000..439b50f2 --- /dev/null +++ b/tests/manual/dialogs/Marker.qml @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.12 + +Rectangle { + anchors.fill: parent + color: "transparent" + border.color: "darkorange" + + property alias text: label.text + + Text { + id: label + font.pixelSize: Qt.application.font.pixelSize * 0.6 + color: parent.border.color + anchors.left: parent.left + anchors.bottom: parent.bottom + anchors.margins: 4 + } +} diff --git a/tests/manual/dialogs/dialogs.cpp b/tests/manual/dialogs/dialogs.cpp new file mode 100644 index 00000000..73faa175 --- /dev/null +++ b/tests/manual/dialogs/dialogs.cpp @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QGuiApplication> +#include <QQmlApplicationEngine> + +int main(int argc, char *argv[]) +{ + QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + QGuiApplication app(argc, argv); + + QQmlApplicationEngine engine; + engine.load(QUrl("qrc:/dialogs.qml")); + + return app.exec(); +} diff --git a/tests/manual/dialogs/dialogs.pro b/tests/manual/dialogs/dialogs.pro new file mode 100644 index 00000000..4863923f --- /dev/null +++ b/tests/manual/dialogs/dialogs.pro @@ -0,0 +1,11 @@ +TEMPLATE = app +TARGET = dialogs +QT += qml quickcontrols2 + +SOURCES += dialogs.cpp +RESOURCES += \ + qtquickcontrols2.conf \ + dialogs.qml \ + Marker.qml \ + CustomDialog.qml \ + DialogLabel.qml diff --git a/tests/manual/dialogs/dialogs.qml b/tests/manual/dialogs/dialogs.qml new file mode 100644 index 00000000..a3048c34 --- /dev/null +++ b/tests/manual/dialogs/dialogs.qml @@ -0,0 +1,247 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.12 +import QtQuick.Controls 2.12 +import QtQuick.Layouts 1.12 + +ApplicationWindow { + id: window + width: 1200 + height: 800 + title: "Buttons" + visible: true + + property alias visualizeDialogButtonBoxContentItem: visualizeDialogButtonBoxContentItemMenuItem.checked + property alias visualizeDialogButtonBox: visualizeDialogButtonBoxMenuItem.checked + + property int dialogSpacing: 60 + + header: ToolBar { + RowLayout { + anchors.fill: parent + Item { + Layout.fillWidth: true + } + + ToolButton { + text: "Settings" + onClicked: settingsMenu.open() + + Menu { + id: settingsMenu + width: 400 + + MenuItem { + id: visualizeDialogButtonBoxContentItemMenuItem + text: "Visualize DialogButtonBox contentItem" + checkable: true + } + + MenuItem { + id: visualizeDialogButtonBoxMenuItem + text: "Visualize DialogButtonBox" + checkable: true + } + } + } + } + } + + + DialogLabel { + text: "implicit width" + dialog: dialogImplicitWidthNoButtons + width: 100 + } + CustomDialog { + id: dialogImplicitWidthNoButtons + x: dialogSpacing + y: dialogSpacing + space: 200 + } + + DialogLabel { + text: "title, implicit width" + dialog: dialogImplicitWidthTitleNoButtons + width: 150 + } + CustomDialog { + id: dialogImplicitWidthTitleNoButtons + y: dialogSpacing + title: "Test" + previousDialog: dialogImplicitWidthNoButtons + space: 200 + } + + DialogLabel { + text: "title, fixed width" + dialog: dialogFixedWidthTitleNoButtons + } + CustomDialog { + id: dialogFixedWidthTitleNoButtons + y: dialogSpacing + width: 300 + title: "Test" + previousDialog: dialogImplicitWidthTitleNoButtons + space: 200 + } + + + DialogLabel { + text: "one standard button, implicit width" + dialog: dialogImplicitWidthOneButton + } + CustomDialog { + id: dialogImplicitWidthOneButton + x: dialogSpacing + y: dialogFixedWidthTitleNoButtons.y + dialogFixedWidthTitleNoButtons.height + dialogSpacing + standardButtons: Dialog.Ok + } + + DialogLabel { + text: "two standard buttons, implicit width" + dialog: dialogImplicitWidthTwoButtons + } + CustomDialog { + id: dialogImplicitWidthTwoButtons + standardButtons: Dialog.Ok | Dialog.Cancel + previousDialog: dialogImplicitWidthOneButton + } + + DialogLabel { + text: "three standard buttons, implicit width" + dialog: dialogImplicitWidthThreeButtons + } + CustomDialog { + id: dialogImplicitWidthThreeButtons + standardButtons: Dialog.Apply | Dialog.RestoreDefaults | Dialog.Cancel + previousDialog: dialogImplicitWidthTwoButtons + } + + + DialogLabel { + text: "text, one standard button, implicit width" + dialog: dialogTextImplicitWidthOneButton + } + CustomDialog { + id: dialogTextImplicitWidthOneButton + x: dialogSpacing + y: dialogImplicitWidthThreeButtons.y + dialogImplicitWidthThreeButtons.height + dialogSpacing + standardButtons: Dialog.Ok + + Label { + text: "A Label" + } + } + + DialogLabel { + text: "text, two standard buttons, implicit width" + dialog: dialogTextImplicitWidthTwoButtons + } + CustomDialog { + id: dialogTextImplicitWidthTwoButtons + standardButtons: Dialog.Ok | Dialog.Cancel + previousDialog: dialogTextImplicitWidthOneButton + + Label { + text: "A Label" + } + } + + DialogLabel { + text: "text, three standard buttons, implicit width" + dialog: dialogTextImplicitWidthThreeButtons + } + CustomDialog { + id: dialogTextImplicitWidthThreeButtons + standardButtons: Dialog.Apply | Dialog.RestoreDefaults | Dialog.Cancel + previousDialog: dialogTextImplicitWidthTwoButtons + + Label { + text: "A Label" + } + } + + + DialogLabel { + text: "one standard button, fixed width (300)" + dialog: dialogFixedWidthOneButton + } + CustomDialog { + id: dialogFixedWidthOneButton + x: dialogSpacing + y: dialogTextImplicitWidthThreeButtons.y + dialogTextImplicitWidthThreeButtons.height + dialogSpacing + width: 300 + standardButtons: Dialog.Ok + } + + DialogLabel { + text: "two standard buttons, fixed width (300)" + dialog: dialogFixedWidthTwoButtons + } + CustomDialog { + id: dialogFixedWidthTwoButtons + width: 300 + standardButtons: Dialog.Ok | Dialog.Cancel + previousDialog: dialogFixedWidthOneButton + } + + DialogLabel { + text: "three standard buttons, fixed width (300)" + dialog: dialogFixedWidthThreeButtons + } + CustomDialog { + id: dialogFixedWidthThreeButtons + width: 300 + standardButtons: Dialog.Apply | Dialog.RestoreDefaults | Dialog.Cancel + previousDialog: dialogFixedWidthTwoButtons + } +} diff --git a/tests/manual/dialogs/qtquickcontrols2.conf b/tests/manual/dialogs/qtquickcontrols2.conf new file mode 100644 index 00000000..7ac31807 --- /dev/null +++ b/tests/manual/dialogs/qtquickcontrols2.conf @@ -0,0 +1,6 @@ +[Controls] +Style=Default +;Style=Fusion +;Style=Imagine +;Style=Material +;Style=Universal |