aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2016-07-09 08:25:38 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2016-07-09 08:26:10 +0200
commit1db5df5a73d9cc7dfe24c07ea4f4d30ed377861b (patch)
treeff1d62ff1043a43484d6b069a7bbadfe26a5719f /src/quicktemplates2
parentcbfa64fd84cab95d909371a5e44146928e403c05 (diff)
parent38f7d855f2485cfb6a3a4328c1d31bac44ee0ae0 (diff)
Merge remote-tracking branch 'origin/5.7' into dev
Diffstat (limited to 'src/quicktemplates2')
-rw-r--r--src/quicktemplates2/qquickabstractbutton.cpp2
-rw-r--r--src/quicktemplates2/qquickcombobox.cpp11
-rw-r--r--src/quicktemplates2/qquickpopup.cpp2
-rw-r--r--src/quicktemplates2/qquickswipedelegate.cpp12
-rw-r--r--src/quicktemplates2/qquicktooltip.cpp10
5 files changed, 27 insertions, 10 deletions
diff --git a/src/quicktemplates2/qquickabstractbutton.cpp b/src/quicktemplates2/qquickabstractbutton.cpp
index cba6850a..c4b2b6f0 100644
--- a/src/quicktemplates2/qquickabstractbutton.cpp
+++ b/src/quicktemplates2/qquickabstractbutton.cpp
@@ -95,7 +95,7 @@ static const int AUTO_REPEAT_INTERVAL = 100;
/*!
\qmlsignal QtQuick.Controls::AbstractButton::pressAndHold()
- This signal is emitted when the button is interactively perssed and held down by the user.
+ This signal is emitted when the button is interactively pressed and held down by the user.
*/
/*!
diff --git a/src/quicktemplates2/qquickcombobox.cpp b/src/quicktemplates2/qquickcombobox.cpp
index 836d6806..cce61509 100644
--- a/src/quicktemplates2/qquickcombobox.cpp
+++ b/src/quicktemplates2/qquickcombobox.cpp
@@ -669,9 +669,16 @@ void QQuickComboBox::setPopup(QQuickPopup *popup)
QString QQuickComboBox::textAt(int index) const
{
Q_D(const QQuickComboBox);
- if (!d->delegateModel || index < 0 || index >= d->delegateModel->count() || !d->delegateModel->object(index))
+ if (!d->delegateModel || index < 0 || index >= d->delegateModel->count())
return QString();
- return d->delegateModel->stringValue(index, d->textRole.isEmpty() ? QStringLiteral("modelData") : d->textRole);
+
+ QString text;
+ QObject *object = d->delegateModel->object(index);
+ if (object) {
+ text = d->delegateModel->stringValue(index, d->textRole.isEmpty() ? QStringLiteral("modelData") : d->textRole);
+ d->delegateModel->release(object);
+ }
+ return text;
}
/*!
diff --git a/src/quicktemplates2/qquickpopup.cpp b/src/quicktemplates2/qquickpopup.cpp
index 25ab2b42..2c661a1b 100644
--- a/src/quicktemplates2/qquickpopup.cpp
+++ b/src/quicktemplates2/qquickpopup.cpp
@@ -231,8 +231,8 @@ void QQuickPopupPrivate::finalizeEnterTransition()
void QQuickPopupPrivate::finalizeExitTransition(bool hide)
{
Q_Q(QQuickPopup);
- positioner.setParentItem(nullptr);
if (hide) {
+ positioner.setParentItem(nullptr);
popupItem->setParentItem(nullptr);
popupItem->setVisible(false);
}
diff --git a/src/quicktemplates2/qquickswipedelegate.cpp b/src/quicktemplates2/qquickswipedelegate.cpp
index 140dd728..1edc5018 100644
--- a/src/quicktemplates2/qquickswipedelegate.cpp
+++ b/src/quicktemplates2/qquickswipedelegate.cpp
@@ -545,7 +545,7 @@ bool QQuickSwipeDelegatePrivate::handleMousePressEvent(QQuickItem *item, QMouseE
{
Q_Q(QQuickSwipeDelegate);
QQuickSwipePrivate *swipePrivate = QQuickSwipePrivate::get(&swipe);
- // If the position is 0, we want to handle events ourself - we don't want child items to steal them.
+ // If the position is 0, we want to handle events ourselves - we don't want child items to steal them.
// This code will only get called when a child item has been created;
// events will go through the regular channels (mousePressEvent()) until then.
if (qFuzzyIsNull(swipePrivate->position)) {
@@ -618,7 +618,7 @@ bool QQuickSwipeDelegatePrivate::handleMouseMoveEvent(QQuickItem *item, QMouseEv
// If the control was exposed before the drag begun, the distance should be inverted.
// For example, if the control had been swiped to the right, the position would be 1.0.
- // If the control was then swiped the left by a distance of -20 pixels, the normalized
+ // If the control was then swiped to the left by a distance of -20 pixels, the normalized
// distance might be -0.2, for example, which cannot be used as the position; the swipe
// started from the right, so we account for that by adding the position.
if (qFuzzyIsNull(normalizedDistance)) {
@@ -658,6 +658,9 @@ bool QQuickSwipeDelegatePrivate::handleMouseReleaseEvent(QQuickItem *, QMouseEve
QQuickSwipePrivate *swipePrivate = QQuickSwipePrivate::get(&swipe);
swipePrivate->velocityCalculator.stopMeasuring(event->pos(), event->timestamp());
+ const bool hadGrabbedMouse = q->keepMouseGrab();
+ q->setKeepMouseGrab(false);
+
// The control can be exposed by either swiping past the halfway mark, or swiping fast enough.
const qreal swipeVelocity = swipePrivate->velocityCalculator.velocity().x();
if (swipePrivate->position > 0.5 ||
@@ -676,9 +679,8 @@ bool QQuickSwipeDelegatePrivate::handleMouseReleaseEvent(QQuickItem *, QMouseEve
swipePrivate->wasComplete = false;
}
- q->setKeepMouseGrab(false);
-
- return true;
+ // Only consume child events if we had grabbed the mouse.
+ return hadGrabbedMouse;
}
void QQuickSwipeDelegatePrivate::resizeContent()
diff --git a/src/quicktemplates2/qquicktooltip.cpp b/src/quicktemplates2/qquicktooltip.cpp
index 09c07778..9cc9a0d9 100644
--- a/src/quicktemplates2/qquicktooltip.cpp
+++ b/src/quicktemplates2/qquicktooltip.cpp
@@ -195,6 +195,8 @@ void QQuickToolTip::setText(const QString &text)
This property holds the delay (milliseconds) after which the tool tip is
shown. A tooltip with a negative delay is shown immediately. The default
value is \c 0.
+
+ \sa {Delay and Timeout}
*/
int QQuickToolTip::delay() const
{
@@ -218,6 +220,8 @@ void QQuickToolTip::setDelay(int delay)
This property holds the timeout (milliseconds) after which the tool tip is
hidden. A tooltip with a negative timeout does not hide automatically. The
default value is \c -1.
+
+ \sa {Delay and Timeout}
*/
int QQuickToolTip::timeout() const
{
@@ -346,7 +350,7 @@ QQuickToolTipAttached::QQuickToolTipAttached(QQuickItem *item) :
/*!
\qmlattachedproperty string QtQuick.Controls::ToolTip::text
- This attached property holds the text of the shared tool tip instance.
+ This attached property holds the text of the shared tool tip.
The property can be attached to any item.
*/
QString QQuickToolTipAttached::text() const
@@ -373,6 +377,8 @@ void QQuickToolTipAttached::setText(const QString &text)
This attached property holds the delay (milliseconds) of the shared tool tip.
The property can be attached to any item.
+
+ \sa {Delay and Timeout}
*/
int QQuickToolTipAttached::delay() const
{
@@ -395,6 +401,8 @@ void QQuickToolTipAttached::setDelay(int delay)
This attached property holds the timeout (milliseconds) of the shared tool tip.
The property can be attached to any item.
+
+ \sa {Delay and Timeout}
*/
int QQuickToolTipAttached::timeout() const
{