aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@qt.io>2018-05-11 10:24:18 +0200
committerMorten Johan Sørvig <morten.sorvig@qt.io>2018-05-11 11:13:04 +0200
commit809d305f938177cfb8488dc7fbfc28bc8eef9d20 (patch)
treed43688a9a3ef61af95c91bae3de8b00e6466c817 /src/quick/items
parentb742bf9415b42c6e34fab91d2f407eb23dc8e0da (diff)
parent1e82f11629e5572783e5bfc36f24ad10c235ca53 (diff)
Merge remote-tracking branch 'origin/5.11.0' into wip/webassembly
Diffstat (limited to 'src/quick/items')
-rw-r--r--src/quick/items/qquickanimatedsprite.cpp32
-rw-r--r--src/quick/items/qquickevents_p_p.h1
-rw-r--r--src/quick/items/qquickflickable.cpp10
-rw-r--r--src/quick/items/qquickimage.cpp46
-rw-r--r--src/quick/items/qquickitemgrabresult.cpp2
-rw-r--r--src/quick/items/qquickloader.cpp9
-rw-r--r--src/quick/items/qquicksprite.cpp4
-rw-r--r--src/quick/items/qquickspritesequence.cpp24
-rw-r--r--src/quick/items/qquicktext.cpp4
-rw-r--r--src/quick/items/qquickwindow.cpp12
10 files changed, 99 insertions, 45 deletions
diff --git a/src/quick/items/qquickanimatedsprite.cpp b/src/quick/items/qquickanimatedsprite.cpp
index 741e4607e5..190c48ac88 100644
--- a/src/quick/items/qquickanimatedsprite.cpp
+++ b/src/quick/items/qquickanimatedsprite.cpp
@@ -152,10 +152,10 @@ QT_BEGIN_NAMESPACE
/*!
\qmlproperty qreal QtQuick::AnimatedSprite::frameRate
- Frames per second to show in the animation. Values equal to or below 0 are invalid.
+ Frames per second to show in the animation. Values less than or equal to \c 0 are invalid.
- If frameRate is valid then it will be used to calculate the duration of the frames.
- If not, and frameDuration is valid , then frameDuration will be used.
+ If \c frameRate is valid, it will be used to calculate the duration of the frames.
+ If not, and \l frameDuration is valid, \c frameDuration will be used.
Changing this parameter will restart the animation.
*/
@@ -163,10 +163,10 @@ QT_BEGIN_NAMESPACE
/*!
\qmlproperty int QtQuick::AnimatedSprite::frameDuration
- Duration of each frame of the animation in milliseconds. Values equal to or below 0 are invalid.
+ Duration of each frame of the animation in milliseconds. Values less than or equal to \c 0 are invalid.
- If frameRate is valid then it will be used to calculate the duration of the frames.
- If not, and frameDuration is valid, then frameDuration will be used.
+ If frameRate is valid, it will be used to calculate the duration of the frames.
+ If not, and \l frameDuration is valid, \c frameDuration will be used.
Changing this parameter will restart the animation.
*/
@@ -218,21 +218,21 @@ QT_BEGIN_NAMESPACE
/*!
\qmlproperty bool QtQuick::AnimatedSprite::reverse
- If true, then the animation will be played in reverse.
+ If \c true, the animation will be played in reverse.
- Default is false.
+ Default is \c false.
*/
/*!
\qmlproperty bool QtQuick::AnimatedSprite::frameSync
- If true, then the animation will have no duration. Instead, the animation will advance
+ If \c true, the animation will have no duration. Instead, the animation will advance
one frame each time a frame is rendered to the screen. This synchronizes it with the painting
rate as opposed to elapsed time.
If frameSync is set to true, it overrides both frameRate and frameDuration.
- Default is false.
+ Default is \c false.
Changing this parameter will restart the animation.
*/
@@ -242,9 +242,9 @@ QT_BEGIN_NAMESPACE
After playing the animation this many times, the animation will automatically stop. Negative values are invalid.
- If this is set to AnimatedSprite.Infinite the animation will not stop playing on its own.
+ If this is set to \c AnimatedSprite.Infinite the animation will not stop playing on its own.
- Default is AnimatedSprite.Infinite
+ Default is \c AnimatedSprite.Infinite
*/
/*!
@@ -252,13 +252,13 @@ QT_BEGIN_NAMESPACE
When paused, the current frame can be advanced manually.
- Default is false.
+ Default is \c false.
*/
/*!
\qmlproperty int QtQuick::AnimatedSprite::currentFrame
- When paused, the current frame can be advanced manually by setting this property or calling advance().
+ When paused, the current frame can be advanced manually by setting this property or calling \l advance().
*/
@@ -452,7 +452,7 @@ void QQuickAnimatedSprite::maybeUpdate()
\qmlmethod int QtQuick::AnimatedSprite::pause()
Pauses the sprite animation. This does nothing if
- \l paused is true.
+ \l paused is \c true.
\sa resume()
*/
@@ -471,7 +471,7 @@ void QQuickAnimatedSprite::pause()
/*!
\qmlmethod int QtQuick::AnimatedSprite::resume()
- Resumes the sprite animation if \l paused is true;
+ Resumes the sprite animation if \l paused is \c true;
otherwise, this does nothing.
\sa pause()
diff --git a/src/quick/items/qquickevents_p_p.h b/src/quick/items/qquickevents_p_p.h
index c4f0b60d92..2a1e9dc184 100644
--- a/src/quick/items/qquickevents_p_p.h
+++ b/src/quick/items/qquickevents_p_p.h
@@ -597,6 +597,7 @@ public:
Area = QTouchDevice::Area,
Pressure = QTouchDevice::Pressure,
Velocity = QTouchDevice::Velocity,
+ MouseEmulation = QTouchDevice::MouseEmulation,
// some bits reserved in case we need more of QTouchDevice::Capabilities
Scroll = 0x0100, // mouse has a wheel, or there is OS-level scroll gesture recognition (dubious?)
Hover = 0x0200,
diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp
index d4f10a9fd9..cefe2de883 100644
--- a/src/quick/items/qquickflickable.cpp
+++ b/src/quick/items/qquickflickable.cpp
@@ -1652,10 +1652,12 @@ void QQuickFlickable::timerEvent(QTimerEvent *event)
}
} else if (event->timerId() == d->movementEndingTimer.timerId()) {
d->movementEndingTimer.stop();
- d->pressed = false;
- d->stealMouse = false;
- if (!d->velocityTimeline.isActive() && !d->timeline.isActive())
- movementEnding(true, true);
+ if (!d->scrollingPhase) {
+ d->pressed = false;
+ d->stealMouse = false;
+ if (!d->velocityTimeline.isActive() && !d->timeline.isActive())
+ movementEnding(true, true);
+ }
}
}
diff --git a/src/quick/items/qquickimage.cpp b/src/quick/items/qquickimage.cpp
index dc2cd17b4e..db5cfd2526 100644
--- a/src/quick/items/qquickimage.cpp
+++ b/src/quick/items/qquickimage.cpp
@@ -135,6 +135,48 @@ QQuickImagePrivate::QQuickImagePrivate()
\clearfloat
+ \section1 OpenGL Texture Files
+
+ When the default OpenGL \l{Qt Quick Scene Graph}{scene graph} backend is in
+ use, images can also be supplied in compressed texture files. The content
+ must be a simple RGB(A) format 2D texture. Supported compression schemes
+ are only limited by the underlying OpenGL driver and GPU. The following
+ container file formats are supported:
+
+ \list
+ \li \c PKM (since Qt 5.10)
+ \li \c KTX (since Qt 5.11)
+ \endlist
+
+ \note Semi-transparent original images require alpha pre-multiplication
+ prior to texture compression in order to be correctly displayed in Qt
+ Quick. This can be done with the following ImageMagick command
+ line:
+ \badcode
+ convert MYORIGIMAGE \( +clone -alpha Extract \) -channel RGB -compose Multiply -composite MYPMIMAGE
+ \endcode
+
+ \section1 Automatic Detection of File Extension
+
+ If the \l source URL indicates a non-existing local file or resource, the
+ Image element attempts to auto-detect the file extension. If an existing
+ file can be found by appending any of the supported image file extensions
+ to the \l source URL, then that file will be loaded.
+
+ If the OpenGL \l{Qt Quick Scene Graph}{scene graph} backend is in use, the
+ file search the attempts the OpenGL texture file extensions first. If the
+ search is unsuccessful, it attempts to search with the file extensions for
+ the \l{QImageReader::supportedImageFormats()}{conventional image file
+ types}. For example:
+
+ \snippet qml/image-ext.qml ext
+
+ This functionality facilitates deploying different image asset file types
+ on different target platforms. This can be useful in order to tune
+ application performance and adapt to different graphics hardware.
+
+ This functionality was introduced in Qt 5.11.
+
\section1 Performance
By default, locally available images are loaded immediately, and the user interface
@@ -154,7 +196,7 @@ QQuickImagePrivate::QQuickImagePrivate()
size bounded via the \l sourceSize property. This is especially important for content
that is loaded from external sources or provided by the user.
- \sa {Qt Quick Examples - Image Elements}, QQuickImageProvider
+ \sa {Qt Quick Examples - Image Elements}, QQuickImageProvider, QImageReader::setAutoDetectImageFormat()
*/
QQuickImage::QQuickImage(QQuickItem *parent)
@@ -461,7 +503,7 @@ qreal QQuickImage::paintedHeight() const
The URL may be absolute, or relative to the URL of the component.
- \sa QQuickImageProvider
+ \sa QQuickImageProvider {OpenGL Texture Files} {Automatic Detection of File Extension}
*/
/*!
diff --git a/src/quick/items/qquickitemgrabresult.cpp b/src/quick/items/qquickitemgrabresult.cpp
index 003fde8c9e..b45cb09c4b 100644
--- a/src/quick/items/qquickitemgrabresult.cpp
+++ b/src/quick/items/qquickitemgrabresult.cpp
@@ -139,7 +139,7 @@ public:
* This property holds the pixel results from a grab.
*
* If the grab is not yet complete or if it failed,
- * an empty image is returned.
+ * a null image is returned (\c {image.isNull()} will return \c true).
*/
/*!
diff --git a/src/quick/items/qquickloader.cpp b/src/quick/items/qquickloader.cpp
index 34f30e81a3..cd48896e58 100644
--- a/src/quick/items/qquickloader.cpp
+++ b/src/quick/items/qquickloader.cpp
@@ -102,7 +102,7 @@ void QQuickLoaderPrivate::clear()
// this we may get transient errors from use of 'parent', for example.
QQmlContext *context = qmlContext(object);
if (context)
- QQmlContextData::get(context)->invalidate();
+ QQmlContextData::get(context)->clearContextRecursively();
if (loadingFromSource && component) {
// disconnect since we deleteLater
@@ -311,10 +311,7 @@ QQuickLoader::QQuickLoader(QQuickItem *parent)
QQuickLoader::~QQuickLoader()
{
Q_D(QQuickLoader);
- if (d->item) {
- QQuickItemPrivate *p = QQuickItemPrivate::get(d->item);
- p->removeItemChangeListener(d, watchedChanges);
- }
+ d->clear();
}
/*!
@@ -363,7 +360,7 @@ void QQuickLoader::setActive(bool newVal)
// this we may get transient errors from use of 'parent', for example.
QQmlContext *context = qmlContext(d->object);
if (context)
- QQmlContextData::get(context)->invalidate();
+ QQmlContextData::get(context)->clearContextRecursively();
if (d->item) {
QQuickItemPrivate *p = QQuickItemPrivate::get(d->item);
diff --git a/src/quick/items/qquicksprite.cpp b/src/quick/items/qquicksprite.cpp
index 99b1b1f430..6b8567439b 100644
--- a/src/quick/items/qquicksprite.cpp
+++ b/src/quick/items/qquicksprite.cpp
@@ -51,8 +51,8 @@ QT_BEGIN_NAMESPACE
\ingroup qtquick-visual-utility
\brief Specifies sprite animations
- QQuickSprite renders sprites of one or more frames and animates them. The sprites
- can be in the middle of an image file, or split along multiple rows, as long as they form
+ Sprite defines a series of one or more frames to be animated and rendered by SpriteSequence.
+ The sprites can be in the middle of an image file, or split along multiple rows, as long as they form
a contiguous line wrapping to the next row of the file from the left edge of the file.
For full details, see the \l{Sprite Animations} overview.
diff --git a/src/quick/items/qquickspritesequence.cpp b/src/quick/items/qquickspritesequence.cpp
index 0a39c09ebc..72761ab82b 100644
--- a/src/quick/items/qquickspritesequence.cpp
+++ b/src/quick/items/qquickspritesequence.cpp
@@ -73,38 +73,38 @@ QT_BEGIN_NAMESPACE
Whether the sprite is animating or not.
- Default is true
+ Default is \c true.
*/
/*!
\qmlproperty bool QtQuick::SpriteSequence::interpolate
- If true, interpolation will occur between sprite frames to make the
+ If \c true, interpolation will occur between sprite frames to make the
animation appear smoother.
- Default is true.
+ Default is \c true.
*/
/*!
\qmlproperty string QtQuick::SpriteSequence::currentSprite
- The name of the Sprite which is currently animating.
+ The name of the \l Sprite that is currently animating.
*/
/*!
\qmlproperty string QtQuick::SpriteSequence::goalSprite
- The name of the Sprite which the animation should move to.
+ The name of the \l Sprite that the animation should move to.
- Sprite states have defined durations and transitions between them, setting goalState
- will cause it to disregard any path weightings (including 0) and head down the path
- which will reach the goalState quickest (fewest animations). It will pass through
+ Sprite states have defined durations and transitions between them; setting \c goalSprite
+ will cause it to disregard any path weightings (including \c 0) and head down the path
+ that will reach the \c goalSprite quickest (fewest animations). It will pass through
intermediate states on that path, and animate them for their duration.
- If it is possible to return to the goalState from the starting point of the goalState
- it will continue to do so until goalState is set to "" or an unreachable state.
+ If it is possible to return to the \c goalSprite from the starting point of the \c goalSprite,
+ it will continue to do so until \c goalSprite is set to \c "" or an unreachable state.
*/
/*! \qmlmethod QtQuick::SpriteSequence::jumpTo(string sprite)
- This function causes the SpriteSequence to jump to the specified sprite immediately, intermediate
- sprites are not played. The \a sprite argument is the name of the sprite you wish to jump to.
+ This function causes the SpriteSequence to jump to the specified \a sprite immediately;
+ intermediate sprites are not played.
*/
/*!
\qmlproperty list<Sprite> QtQuick::SpriteSequence::sprites
diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp
index 383aa2b821..9eaf9f8d6d 100644
--- a/src/quick/items/qquicktext.cpp
+++ b/src/quick/items/qquicktext.cpp
@@ -2318,8 +2318,10 @@ void QQuickText::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeo
if (!(widthChanged || widthMaximum) && !d->isLineLaidOutConnected()) { // only height has changed
if (newGeometry.height() > oldGeometry.height()) {
- if (!d->heightExceeded) // Height is adequate and growing.
+ if (!d->heightExceeded && !qFuzzyIsNull(oldGeometry.height())) {
+ // Height is adequate and growing, and it wasn't 0 previously.
goto geomChangeDone;
+ }
if (d->lineCount == d->maximumLineCount()) // Reached maximum line and height is growing.
goto geomChangeDone;
} else if (newGeometry.height() < oldGeometry.height()) {
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index 26b97d452a..02fe4809ab 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -656,6 +656,12 @@ bool QQuickWindowPrivate::deliverTouchAsMouse(QQuickItem *item, QQuickPointerEve
Q_Q(QQuickWindow);
auto device = pointerEvent->device();
+ // A touch event from a trackpad is likely to be followed by a mouse or gesture event, so mouse event synth is redundant
+ if (device->type() == QQuickPointerDevice::TouchPad && device->capabilities().testFlag(QQuickPointerDevice::MouseEmulation)) {
+ qCDebug(DBG_TOUCH_TARGET) << "skipping delivery of synth-mouse event from" << device;
+ return false;
+ }
+
// FIXME: make this work for mouse events too and get rid of the asTouchEvent in here.
Q_ASSERT(pointerEvent->asPointerTouchEvent());
QScopedPointer<QTouchEvent> event(pointerEvent->asPointerTouchEvent()->touchEventForItem(item));
@@ -2833,7 +2839,11 @@ bool QQuickWindowPrivate::sendFilteredPointerEventImpl(QQuickPointerEvent *event
// In versions prior to Qt 6, we can't trust item->acceptTouchEvents() here, because it defaults to true.
bool acceptsTouchEvents = false;
#endif
- if (acceptsTouchEvents || receiver->acceptedMouseButtons()) {
+ auto device = pte->device();
+ if (device->type() == QQuickPointerDevice::TouchPad &&
+ device->capabilities().testFlag(QQuickPointerDevice::MouseEmulation)) {
+ qCDebug(DBG_TOUCH_TARGET) << "skipping filtering of synth-mouse event from" << device;
+ } else if (acceptsTouchEvents || receiver->acceptedMouseButtons()) {
// get a touch event customized for delivery to filteringParent
QScopedPointer<QTouchEvent> filteringParentTouchEvent(pte->touchEventForItem(receiver, true));
if (filteringParentTouchEvent) {