aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-03-02 03:02:29 +0100
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-03-02 03:02:29 +0100
commit6f5bc03ecbf0e8233ae638a54457557c6c32cba2 (patch)
tree742032e0cdadb6328c180be35718ecf9dd9b7116 /src
parent3725155f6c5cdfad0e99d232f09c7ae0d0de617f (diff)
parent9fdbdea176007ed7b470e317e9002aa77ddd4ead (diff)
Merge remote-tracking branch 'origin/5.12' into 5.13
Diffstat (limited to 'src')
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-imagine.qdoc29
-rw-r--r--src/quicktemplates2/qquickabstractbutton.cpp11
-rw-r--r--src/quicktemplates2/qquickabstractbutton_p_p.h2
-rw-r--r--src/quicktemplates2/qquickaction.cpp34
-rw-r--r--src/quicktemplates2/qquickaction_p.h6
-rw-r--r--src/quicktemplates2/qquickaction_p_p.h8
-rw-r--r--src/quicktemplates2/qquickdrawer.cpp3
-rw-r--r--src/quicktemplates2/qquickmenuitem.cpp5
-rw-r--r--src/quicktemplates2/qquickmenuitem_p_p.h2
-rw-r--r--src/quicktemplates2/qquickpage.cpp12
-rw-r--r--src/quicktemplates2/qquickpage_p_p.h1
-rw-r--r--src/quicktemplates2/qquickpopup.cpp4
-rw-r--r--src/quicktemplates2/qquickpopuppositioner_p_p.h1
-rw-r--r--src/quicktemplates2/qquickscrollview.cpp17
-rw-r--r--src/quicktemplates2/qquickspinbox.cpp3
-rw-r--r--src/quicktemplates2/quicktemplates2.pro1
16 files changed, 116 insertions, 23 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