aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items
diff options
context:
space:
mode:
authorAndy Nichols <andy.nichols@theqtcompany.com>2016-04-05 12:09:51 +0200
committerAndy Nichols <andy.nichols@theqtcompany.com>2016-04-05 12:11:13 +0200
commit60da655dff4ffcc94d32a05bb5fa32240b0eaa0b (patch)
tree3f3f9d427570d505d8249053e9646af69a95e783 /src/quick/items
parent17d435fd8b2ed3a8ac6f93d17d0e78cd61bd7851 (diff)
parentfcbbedc3c21ff69d9251264dd708d6ca66c09359 (diff)
Merge remote-tracking branch 'origin/5.7' into dev
Diffstat (limited to 'src/quick/items')
-rw-r--r--src/quick/items/qquickanimatedsprite.cpp92
-rw-r--r--src/quick/items/qquickanimatedsprite_p.h10
-rw-r--r--src/quick/items/qquickdrag.cpp1
-rw-r--r--src/quick/items/qquickevents.cpp50
-rw-r--r--src/quick/items/qquickevents_p_p.h6
-rw-r--r--src/quick/items/qquickframebufferobject.h2
-rw-r--r--src/quick/items/qquickitem.cpp2
-rw-r--r--src/quick/items/qquickitem.h6
-rw-r--r--src/quick/items/qquickitemgrabresult.h2
-rw-r--r--src/quick/items/qquickitemsmodule.cpp2
-rw-r--r--src/quick/items/qquickitemview.cpp3
-rw-r--r--src/quick/items/qquickmousearea.cpp10
-rw-r--r--src/quick/items/qquickmousearea_p.h2
-rw-r--r--src/quick/items/qquickpainteditem.h4
-rw-r--r--src/quick/items/qquickrendercontrol.cpp4
-rw-r--r--src/quick/items/qquickrendercontrol.h6
-rw-r--r--src/quick/items/qquickscalegrid_p_p.h2
-rw-r--r--src/quick/items/qquickshadereffect.cpp8
-rw-r--r--src/quick/items/qquickshadereffect_p.h1
-rw-r--r--src/quick/items/qquickshadereffectnode.cpp1
-rw-r--r--src/quick/items/qquickshadereffectnode_p.h1
-rw-r--r--src/quick/items/qquickshadereffectsource.cpp2
-rw-r--r--src/quick/items/qquicksprite.cpp5
-rw-r--r--src/quick/items/qquicksprite_p.h4
-rw-r--r--src/quick/items/qquicktextedit.cpp3
-rw-r--r--src/quick/items/qquicktextinput.cpp20
-rw-r--r--src/quick/items/qquickview.h4
-rw-r--r--src/quick/items/qquickwindow.cpp2
-rw-r--r--src/quick/items/qquickwindow.h6
29 files changed, 173 insertions, 88 deletions
diff --git a/src/quick/items/qquickanimatedsprite.cpp b/src/quick/items/qquickanimatedsprite.cpp
index f5df5763bb..c32e9546a5 100644
--- a/src/quick/items/qquickanimatedsprite.cpp
+++ b/src/quick/items/qquickanimatedsprite.cpp
@@ -316,8 +316,6 @@ struct AnimatedSpriteVertices {
//TODO: Implicitly size element to size of sprite
QQuickAnimatedSprite::QQuickAnimatedSprite(QQuickItem *parent) :
QQuickItem(parent)
- , m_node(0)
- , m_material(0)
, m_sprite(new QQuickSprite(this))
, m_spriteEngine(0)
, m_curFrame(0)
@@ -331,9 +329,9 @@ QQuickAnimatedSprite::QQuickAnimatedSprite(QQuickItem *parent) :
{
setFlag(ItemHasContents);
connect(this, SIGNAL(widthChanged()),
- this, SLOT(sizeVertices()));
+ this, SLOT(reset()));
connect(this, SIGNAL(heightChanged()),
- this, SLOT(sizeVertices()));
+ this, SLOT(reset()));
}
bool QQuickAnimatedSprite::isCurrentFrameChangedConnected()
@@ -461,12 +459,9 @@ static QSGGeometry::AttributeSet AnimatedSprite_AttributeSet =
AnimatedSprite_Attributes
};
-void QQuickAnimatedSprite::sizeVertices()
+void QQuickAnimatedSprite::sizeVertices(QSGGeometryNode *node)
{
- if (!m_node)
- return;
-
- AnimatedSpriteVertices *p = (AnimatedSpriteVertices *) m_node->geometry()->vertexData();
+ AnimatedSpriteVertices *p = (AnimatedSpriteVertices *) node->geometry()->vertexData();
p->v1.x = 0;
p->v1.y = 0;
@@ -494,21 +489,21 @@ QSGGeometryNode* QQuickAnimatedSprite::buildNode()
return 0;
}
- m_material = new QQuickAnimatedSpriteMaterial();
+ QQuickAnimatedSpriteMaterial *material = new QQuickAnimatedSpriteMaterial();
QImage image = m_spriteEngine->assembledImage(); //Engine prints errors if there are any
if (image.isNull())
return 0;
m_sheetSize = QSizeF(image.size());
- m_material->texture = window()->createTextureFromImage(image);
+ material->texture = window()->createTextureFromImage(image);
m_spriteEngine->start(0);
- m_material->animT = 0;
- m_material->animX1 = m_spriteEngine->spriteX() / m_sheetSize.width();
- m_material->animY1 = m_spriteEngine->spriteY() / m_sheetSize.height();
- m_material->animX2 = m_material->animX1;
- m_material->animY2 = m_material->animY1;
- m_material->animW = m_spriteEngine->spriteWidth() / m_sheetSize.width();
- m_material->animH = m_spriteEngine->spriteHeight() / m_sheetSize.height();
+ material->animT = 0;
+ material->animX1 = m_spriteEngine->spriteX() / m_sheetSize.width();
+ material->animY1 = m_spriteEngine->spriteY() / m_sheetSize.height();
+ material->animX2 = material->animX1;
+ material->animY2 = material->animY1;
+ material->animW = m_spriteEngine->spriteWidth() / m_sheetSize.width();
+ material->animH = m_spriteEngine->spriteHeight() / m_sheetSize.height();
int vCount = 4;
int iCount = 6;
@@ -517,7 +512,7 @@ QSGGeometryNode* QQuickAnimatedSprite::buildNode()
AnimatedSpriteVertices *p = (AnimatedSpriteVertices *) g->vertexData();
- QRectF texRect = m_material->texture->normalizedTextureSubRect();
+ QRectF texRect = material->texture->normalizedTextureSubRect();
p->v1.tx = texRect.topLeft().x();
p->v1.ty = texRect.topLeft().y();
@@ -540,51 +535,51 @@ QSGGeometryNode* QQuickAnimatedSprite::buildNode()
indices[5] = 2;
- m_node = new QSGGeometryNode();
- m_node->setGeometry(g);
- m_node->setMaterial(m_material);
- m_node->setFlag(QSGGeometryNode::OwnsMaterial);
- m_node->setFlag(QSGGeometryNode::OwnsGeometry);
- sizeVertices();
- return m_node;
+ QSGGeometryNode *node = new QSGGeometryNode();
+ node->setGeometry(g);
+ node->setMaterial(material);
+ node->setFlag(QSGGeometryNode::OwnsMaterial);
+ node->setFlag(QSGGeometryNode::OwnsGeometry);
+ sizeVertices(node);
+ return node;
}
void QQuickAnimatedSprite::reset()
{
m_pleaseReset = true;
+ update();
}
-QSGNode *QQuickAnimatedSprite::updatePaintNode(QSGNode *, UpdatePaintNodeData *)
+QSGNode *QQuickAnimatedSprite::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *)
{
if (m_pleaseReset) {
- delete m_node;
+ delete oldNode;
- m_node = 0;
- m_material = 0;
+ oldNode = 0;
m_pleaseReset = false;
}
- prepareNextFrame();
+ QSGGeometryNode *node = static_cast<QSGGeometryNode *>(oldNode);
+ if (!node)
+ node = buildNode();
+
+ if (node)
+ prepareNextFrame(node);
if (m_running) {
if (!m_paused)
update();
- if (m_node) {
- m_node->markDirty(QSGNode::DirtyMaterial);
+ if (node) {
+ node->markDirty(QSGNode::DirtyMaterial);
}
}
- return m_node;
+ return node;
}
-void QQuickAnimatedSprite::prepareNextFrame()
+void QQuickAnimatedSprite::prepareNextFrame(QSGGeometryNode *node)
{
- if (m_node == 0)
- m_node = buildNode();
- if (m_node == 0) //error creating node
- return;
-
int timeInt = m_timestamp.elapsed() + m_pauseOffset;
qreal time = timeInt / 1000.;
@@ -700,14 +695,15 @@ void QQuickAnimatedSprite::prepareNextFrame()
}
}
- m_material->animX1 = x1;
- m_material->animY1 = y1;
- m_material->animX2 = x2;
- m_material->animY2 = y2;
- m_material->animW = w;
- m_material->animH = h;
- m_material->animT = m_interpolate ? progress : 0.0;
- m_material->texture->setFiltering(smooth() ? QSGTexture::Linear : QSGTexture::Nearest);
+ QQuickAnimatedSpriteMaterial *material = static_cast<QQuickAnimatedSpriteMaterial *>(node->material());
+ material->animX1 = x1;
+ material->animY1 = y1;
+ material->animX2 = x2;
+ material->animY2 = y2;
+ material->animW = w;
+ material->animH = h;
+ material->animT = m_interpolate ? progress : 0.0;
+ material->texture->setFiltering(smooth() ? QSGTexture::Linear : QSGTexture::Nearest);
}
QT_END_NAMESPACE
diff --git a/src/quick/items/qquickanimatedsprite_p.h b/src/quick/items/qquickanimatedsprite_p.h
index 6b49d903df..1e5981c1a4 100644
--- a/src/quick/items/qquickanimatedsprite_p.h
+++ b/src/quick/items/qquickanimatedsprite_p.h
@@ -357,19 +357,19 @@ public Q_SLOTS:
private Q_SLOTS:
void createEngine();
- void sizeVertices();
+ void sizeVertices(QSGGeometryNode *node);
-protected:
+protected Q_SLOTS:
void reset();
+
+protected:
void componentComplete() Q_DECL_OVERRIDE;
QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) Q_DECL_OVERRIDE;
private:
bool isCurrentFrameChangedConnected();
- void prepareNextFrame();
+ void prepareNextFrame(QSGGeometryNode *node);
void reloadImage();
QSGGeometryNode* buildNode();
- QSGGeometryNode *m_node;
- QQuickAnimatedSpriteMaterial *m_material;
QQuickSprite* m_sprite;
QQuickSpriteEngine* m_spriteEngine;
QElapsedTimer m_timestamp;
diff --git a/src/quick/items/qquickdrag.cpp b/src/quick/items/qquickdrag.cpp
index 5bfbaf74b2..4aa54b71df 100644
--- a/src/quick/items/qquickdrag.cpp
+++ b/src/quick/items/qquickdrag.cpp
@@ -46,6 +46,7 @@
#include <QtQuick/private/qquickevents_p_p.h>
#include <private/qquickitemchangelistener_p.h>
#include <private/qv8engine_p.h>
+#include <private/qv4scopedvalue_p.h>
#include <QtCore/qmimedata.h>
#include <QtQml/qqmlinfo.h>
#include <QtGui/qdrag.h>
diff --git a/src/quick/items/qquickevents.cpp b/src/quick/items/qquickevents.cpp
index 7706412a5f..5061c19f1e 100644
--- a/src/quick/items/qquickevents.cpp
+++ b/src/quick/items/qquickevents.cpp
@@ -263,6 +263,56 @@ Item {
\endqml
*/
+/*!
+ \qmlproperty int QtQuick::MouseEvent::source
+ \since 5.7
+
+ This property holds the source of the mouse event.
+
+ The mouse event source can be used to distinguish between genuine and
+ artificial mouse events. When using other pointing devices such as
+ touchscreens and graphics tablets, if the application does not make use of
+ the actual touch or tablet events, mouse events may be synthesized by the
+ operating system or by Qt itself.
+
+ The value can be one of:
+
+ \value Qt.MouseEventNotSynthesized The most common value. On platforms where
+ such information is available, this value indicates that the event
+ represents a genuine mouse event from the system.
+
+ \value Qt.MouseEventSynthesizedBySystem Indicates that the mouse event was
+ synthesized from a touch or tablet event by the platform.
+
+ \value Qt.MouseEventSynthesizedByQt Indicates that the mouse event was
+ synthesized from an unhandled touch or tablet event by Qt.
+
+ \value Qt.MouseEventSynthesizedByApplication Indicates that the mouse event
+ was synthesized by the application. This allows distinguishing
+ application-generated mouse events from the ones that are coming from the
+ system or are synthesized by Qt.
+
+ For example, to react only to events which come from an actual mouse:
+ \qml
+ MouseArea {
+ onPressed: if (mouse.source !== Qt.MouseEventNotSynthesized) {
+ mouse.accepted = false
+ }
+
+ onClicked: doSomething()
+ }
+ \endqml
+
+ If the handler for the press event rejects the event, it will be propagated
+ further, and then another Item underneath can handle synthesized events
+ from touchscreens. For example, if a Flickable is used underneath (and the
+ MouseArea is not a child of the Flickable), it can be useful for the
+ MouseArea to handle genuine mouse events in one way, while allowing touch
+ events to fall through to the Flickable underneath, so that the ability to
+ flick on a touchscreen is retained. In that case the ability to drag the
+ Flickable via mouse would be lost, but it does not prevent Flickable from
+ receiving mouse wheel events.
+*/
/*!
\qmltype WheelEvent
diff --git a/src/quick/items/qquickevents_p_p.h b/src/quick/items/qquickevents_p_p.h
index f0d7769705..b28ab555b0 100644
--- a/src/quick/items/qquickevents_p_p.h
+++ b/src/quick/items/qquickevents_p_p.h
@@ -103,6 +103,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickMouseEvent : public QObject
Q_PROPERTY(int button READ button)
Q_PROPERTY(int buttons READ buttons)
Q_PROPERTY(int modifiers READ modifiers)
+ Q_PROPERTY(int source READ source REVISION 7)
Q_PROPERTY(bool wasHeld READ wasHeld)
Q_PROPERTY(bool isClick READ isClick)
Q_PROPERTY(bool accepted READ isAccepted WRITE setAccepted)
@@ -111,13 +112,14 @@ public:
QQuickMouseEvent(qreal x, qreal y, Qt::MouseButton button, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers
, bool isClick=false, bool wasHeld=false)
: _x(x), _y(y), _button(button), _buttons(buttons), _modifiers(modifiers)
- , _wasHeld(wasHeld), _isClick(isClick), _accepted(true) {}
+ , _source(Qt::MouseEventNotSynthesized), _wasHeld(wasHeld), _isClick(isClick), _accepted(true) {}
qreal x() const { return _x; }
qreal y() const { return _y; }
int button() const { return _button; }
int buttons() const { return _buttons; }
int modifiers() const { return _modifiers; }
+ int source() const { return _source; }
bool wasHeld() const { return _wasHeld; }
bool isClick() const { return _isClick; }
@@ -125,6 +127,7 @@ public:
void setX(qreal x) { _x = x; }
void setY(qreal y) { _y = y; }
void setPosition(const QPointF &point) { _x = point.x(); _y = point.y(); }
+ void setSource(Qt::MouseEventSource s) { _source = s; }
bool isAccepted() { return _accepted; }
void setAccepted(bool accepted) { _accepted = accepted; }
@@ -135,6 +138,7 @@ private:
Qt::MouseButton _button;
Qt::MouseButtons _buttons;
Qt::KeyboardModifiers _modifiers;
+ Qt::MouseEventSource _source;
bool _wasHeld;
bool _isClick;
bool _accepted;
diff --git a/src/quick/items/qquickframebufferobject.h b/src/quick/items/qquickframebufferobject.h
index 446cfed22b..13eeb931ad 100644
--- a/src/quick/items/qquickframebufferobject.h
+++ b/src/quick/items/qquickframebufferobject.h
@@ -75,7 +75,7 @@ public:
void *data;
};
- QQuickFramebufferObject(QQuickItem *parent = 0);
+ QQuickFramebufferObject(QQuickItem *parent = Q_NULLPTR);
bool textureFollowsItemSize() const;
void setTextureFollowsItemSize(bool follows);
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp
index ca7c5b224c..da89a51f24 100644
--- a/src/quick/items/qquickitem.cpp
+++ b/src/quick/items/qquickitem.cpp
@@ -109,7 +109,7 @@ void debugFocusTree(QQuickItem *item, QQuickItem *scope = 0, int depth = 1)
}
}
-static void QQuickItem_parentNotifier(QObject *o, qintptr, QQmlNotifier **n)
+static void QQuickItem_parentNotifier(QObject *o, QQmlNotifier **n)
{
QQuickItemPrivate *d = QQuickItemPrivate::get(static_cast<QQuickItem *>(o));
*n = &d->parentNotifier;
diff --git a/src/quick/items/qquickitem.h b/src/quick/items/qquickitem.h
index b33f3d8b6a..c5c17615ee 100644
--- a/src/quick/items/qquickitem.h
+++ b/src/quick/items/qquickitem.h
@@ -59,7 +59,7 @@ class Q_QUICK_EXPORT QQuickTransform : public QObject
{
Q_OBJECT
public:
- QQuickTransform(QObject *parent = 0);
+ explicit QQuickTransform(QObject *parent = Q_NULLPTR);
~QQuickTransform();
void appendToItem(QQuickItem *);
@@ -195,7 +195,7 @@ public:
};
Q_ENUM(TransformOrigin)
- QQuickItem(QQuickItem *parent = 0);
+ explicit QQuickItem(QQuickItem *parent = Q_NULLPTR);
virtual ~QQuickItem();
QQuickWindow *window() const;
@@ -440,7 +440,7 @@ protected:
virtual void updatePolish();
protected:
- QQuickItem(QQuickItemPrivate &dd, QQuickItem *parent = 0);
+ QQuickItem(QQuickItemPrivate &dd, QQuickItem *parent = Q_NULLPTR);
private:
Q_PRIVATE_SLOT(d_func(), void _q_resourceObjectDeleted(QObject *))
diff --git a/src/quick/items/qquickitemgrabresult.h b/src/quick/items/qquickitemgrabresult.h
index 15399010dd..42d71862de 100644
--- a/src/quick/items/qquickitemgrabresult.h
+++ b/src/quick/items/qquickitemgrabresult.h
@@ -79,7 +79,7 @@ private Q_SLOTS:
private:
friend class QQuickItem;
- QQuickItemGrabResult(QObject *parent = 0);
+ QQuickItemGrabResult(QObject *parent = Q_NULLPTR);
};
QT_END_NAMESPACE
diff --git a/src/quick/items/qquickitemsmodule.cpp b/src/quick/items/qquickitemsmodule.cpp
index ce4f81e1dd..23245e4a7b 100644
--- a/src/quick/items/qquickitemsmodule.cpp
+++ b/src/quick/items/qquickitemsmodule.cpp
@@ -285,6 +285,8 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor)
qmlRegisterType<QQuickGridView, 7>(uri, 2, 7, "GridView");
qmlRegisterType<QQuickTextInput, 7>(uri, 2, 7, "TextInput");
qmlRegisterType<QQuickTextEdit, 7>(uri, 2, 7, "TextEdit");
+
+ qmlRegisterUncreatableType<QQuickMouseEvent, 7>(uri, 2, 7, nullptr, QQuickMouseEvent::tr("MouseEvent is only available within handlers in MouseArea"));
}
static void initResources()
diff --git a/src/quick/items/qquickitemview.cpp b/src/quick/items/qquickitemview.cpp
index 188b347a20..aff03b7539 100644
--- a/src/quick/items/qquickitemview.cpp
+++ b/src/quick/items/qquickitemview.cpp
@@ -1052,7 +1052,8 @@ QQuickItem *QQuickItemView::itemAt(qreal x, qreal y) const
void QQuickItemView::forceLayout()
{
Q_D(QQuickItemView);
- d->applyPendingChanges();
+ if (isComponentComplete() && (d->currentChanges.hasPendingChanges() || d->forceLayout))
+ d->layout();
}
void QQuickItemViewPrivate::applyPendingChanges()
diff --git a/src/quick/items/qquickmousearea.cpp b/src/quick/items/qquickmousearea.cpp
index 42de98eff7..920a86881b 100644
--- a/src/quick/items/qquickmousearea.cpp
+++ b/src/quick/items/qquickmousearea.cpp
@@ -685,7 +685,7 @@ void QQuickMouseArea::mousePressEvent(QMouseEvent *event)
d->startScene = event->windowPos();
d->pressAndHoldTimer.start(QGuiApplication::styleHints()->mousePressAndHoldInterval(), this);
setKeepMouseGrab(d->stealMouse);
- event->setAccepted(setPressed(event->button(), true));
+ event->setAccepted(setPressed(event->button(), true, event->source()));
}
}
@@ -762,6 +762,7 @@ void QQuickMouseArea::mouseMoveEvent(QMouseEvent *event)
#endif
QQuickMouseEvent me(d->lastPos.x(), d->lastPos.y(), d->lastButton, d->lastButtons, d->lastModifiers, false, d->longPress);
+ me.setSource(event->source());
emit mouseXChanged(&me);
me.setPosition(d->lastPos);
emit mouseYChanged(&me);
@@ -777,7 +778,7 @@ void QQuickMouseArea::mouseReleaseEvent(QMouseEvent *event)
QQuickItem::mouseReleaseEvent(event);
} else {
d->saveEvent(event);
- setPressed(event->button(), false);
+ setPressed(event->button(), false, event->source());
if (!d->pressed) {
// no other buttons are pressed
#ifndef QT_NO_DRAGANDDROP
@@ -802,6 +803,7 @@ void QQuickMouseArea::mouseDoubleClickEvent(QMouseEvent *event)
if (d->enabled) {
d->saveEvent(event);
QQuickMouseEvent me(d->lastPos.x(), d->lastPos.y(), d->lastButton, d->lastButtons, d->lastModifiers, true, false);
+ me.setSource(event->source());
me.setAccepted(d->isDoubleClickConnected());
emit this->doubleClicked(&me);
if (!me.isAccepted())
@@ -996,6 +998,7 @@ void QQuickMouseArea::timerEvent(QTimerEvent *event)
if (d->pressed && dragged == false && d->hovered == true) {
d->longPress = true;
QQuickMouseEvent me(d->lastPos.x(), d->lastPos.y(), d->lastButton, d->lastButtons, d->lastModifiers, false, d->longPress);
+ me.setSource(Qt::MouseEventSynthesizedByQt);
me.setAccepted(d->isPressAndHoldConnected());
emit pressAndHold(&me);
if (!me.isAccepted())
@@ -1158,7 +1161,7 @@ void QQuickMouseArea::setAcceptedButtons(Qt::MouseButtons buttons)
}
}
-bool QQuickMouseArea::setPressed(Qt::MouseButton button, bool p)
+bool QQuickMouseArea::setPressed(Qt::MouseButton button, bool p, Qt::MouseEventSource source)
{
Q_D(QQuickMouseArea);
@@ -1173,6 +1176,7 @@ bool QQuickMouseArea::setPressed(Qt::MouseButton button, bool p)
if (wasPressed != p) {
QQuickMouseEvent me(d->lastPos.x(), d->lastPos.y(), d->lastButton, d->lastButtons, d->lastModifiers, isclick, d->longPress);
+ me.setSource(source);
if (p) {
d->pressed |= button;
if (!d->doubleClick)
diff --git a/src/quick/items/qquickmousearea_p.h b/src/quick/items/qquickmousearea_p.h
index ae3e3b1e5a..5cd86541d4 100644
--- a/src/quick/items/qquickmousearea_p.h
+++ b/src/quick/items/qquickmousearea_p.h
@@ -155,7 +155,7 @@ Q_SIGNALS:
protected:
void setHovered(bool);
- bool setPressed(Qt::MouseButton button, bool);
+ bool setPressed(Qt::MouseButton button, bool p, Qt::MouseEventSource source);
bool sendMouseEvent(QMouseEvent *event);
void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
diff --git a/src/quick/items/qquickpainteditem.h b/src/quick/items/qquickpainteditem.h
index 1e384a45e3..f9e3c91a42 100644
--- a/src/quick/items/qquickpainteditem.h
+++ b/src/quick/items/qquickpainteditem.h
@@ -57,7 +57,7 @@ class Q_QUICK_EXPORT QQuickPaintedItem : public QQuickItem
Q_PROPERTY(QSize textureSize READ textureSize WRITE setTextureSize NOTIFY textureSizeChanged)
public:
- QQuickPaintedItem(QQuickItem *parent = 0);
+ explicit QQuickPaintedItem(QQuickItem *parent = Q_NULLPTR);
virtual ~QQuickPaintedItem();
enum RenderTarget {
@@ -118,7 +118,7 @@ Q_SIGNALS:
void textureSizeChanged();
protected:
- QQuickPaintedItem(QQuickPaintedItemPrivate &dd, QQuickItem *parent = 0);
+ QQuickPaintedItem(QQuickPaintedItemPrivate &dd, QQuickItem *parent = Q_NULLPTR);
QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) Q_DECL_OVERRIDE;
void releaseResources() Q_DECL_OVERRIDE;
diff --git a/src/quick/items/qquickrendercontrol.cpp b/src/quick/items/qquickrendercontrol.cpp
index 285a394cee..e36df53d38 100644
--- a/src/quick/items/qquickrendercontrol.cpp
+++ b/src/quick/items/qquickrendercontrol.cpp
@@ -54,6 +54,8 @@
#include <QtQuick/private/qquickwindow_p.h>
#include <QtCore/private/qobject_p.h>
+#include <private/qquickshadereffectnode_p.h>
+
QT_BEGIN_NAMESPACE
extern Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, bool include_alpha);
@@ -181,6 +183,8 @@ void QQuickRenderControlPrivate::windowDestroyed()
delete QQuickWindowPrivate::get(window)->animationController;
QQuickWindowPrivate::get(window)->animationController = 0;
+ QQuickShaderEffectMaterial::cleanupMaterialCache();
+
window = 0;
}
}
diff --git a/src/quick/items/qquickrendercontrol.h b/src/quick/items/qquickrendercontrol.h
index c5691b1329..31ea176cc1 100644
--- a/src/quick/items/qquickrendercontrol.h
+++ b/src/quick/items/qquickrendercontrol.h
@@ -55,7 +55,7 @@ class Q_QUICK_EXPORT QQuickRenderControl : public QObject
Q_OBJECT
public:
- QQuickRenderControl(QObject *parent = 0);
+ explicit QQuickRenderControl(QObject *parent = Q_NULLPTR);
~QQuickRenderControl();
void prepareThread(QThread *targetThread);
@@ -68,8 +68,8 @@ public:
QImage grab();
- static QWindow *renderWindowFor(QQuickWindow *win, QPoint *offset = 0);
- virtual QWindow *renderWindow(QPoint *offset) { Q_UNUSED(offset); return 0; }
+ static QWindow *renderWindowFor(QQuickWindow *win, QPoint *offset = Q_NULLPTR);
+ virtual QWindow *renderWindow(QPoint *offset) { Q_UNUSED(offset); return Q_NULLPTR; }
Q_SIGNALS:
void renderRequested();
diff --git a/src/quick/items/qquickscalegrid_p_p.h b/src/quick/items/qquickscalegrid_p_p.h
index 8064a31377..a424002dfb 100644
--- a/src/quick/items/qquickscalegrid_p_p.h
+++ b/src/quick/items/qquickscalegrid_p_p.h
@@ -61,7 +61,7 @@
QT_BEGIN_NAMESPACE
-class QQuickScaleGrid : public QObject
+class Q_AUTOTEST_EXPORT QQuickScaleGrid : public QObject
{
Q_OBJECT
diff --git a/src/quick/items/qquickshadereffect.cpp b/src/quick/items/qquickshadereffect.cpp
index 05900bc12b..0cfb85db97 100644
--- a/src/quick/items/qquickshadereffect.cpp
+++ b/src/quick/items/qquickshadereffect.cpp
@@ -958,6 +958,12 @@ void QQuickShaderEffect::updateGeometry()
update();
}
+void QQuickShaderEffect::updateGeometryIfAtlased()
+{
+ if (m_supportsAtlasTextures)
+ updateGeometry();
+}
+
void QQuickShaderEffect::updateLogAndStatus(const QString &log, int status)
{
m_log = parseLog() + log;
@@ -1006,6 +1012,8 @@ QSGNode *QQuickShaderEffect::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeDa
m_dirtyUniforms = true;
m_dirtyGeometry = true;
connect(node, SIGNAL(logAndStatusChanged(QString,int)), this, SLOT(updateLogAndStatus(QString,int)));
+ connect(node, &QQuickShaderEffectNode::dirtyTexture,
+ this, &QQuickShaderEffect::updateGeometryIfAtlased);
}
QQuickShaderEffectMaterial *material = static_cast<QQuickShaderEffectMaterial *>(node->material());
diff --git a/src/quick/items/qquickshadereffect_p.h b/src/quick/items/qquickshadereffect_p.h
index 23557e52fa..fb266d4c44 100644
--- a/src/quick/items/qquickshadereffect_p.h
+++ b/src/quick/items/qquickshadereffect_p.h
@@ -173,6 +173,7 @@ protected:
private Q_SLOTS:
void updateGeometry();
+ void updateGeometryIfAtlased();
void updateLogAndStatus(const QString &log, int status);
void sourceDestroyed(QObject *object);
void propertyChanged(int mappedId);
diff --git a/src/quick/items/qquickshadereffectnode.cpp b/src/quick/items/qquickshadereffectnode.cpp
index 8040bbe754..66154fac6d 100644
--- a/src/quick/items/qquickshadereffectnode.cpp
+++ b/src/quick/items/qquickshadereffectnode.cpp
@@ -497,6 +497,7 @@ QQuickShaderEffectNode::~QQuickShaderEffectNode()
void QQuickShaderEffectNode::markDirtyTexture()
{
markDirty(DirtyMaterial);
+ Q_EMIT dirtyTexture();
}
void QQuickShaderEffectNode::textureProviderDestroyed(QObject *object)
diff --git a/src/quick/items/qquickshadereffectnode_p.h b/src/quick/items/qquickshadereffectnode_p.h
index 570a0c3213..cc016d13a7 100644
--- a/src/quick/items/qquickshadereffectnode_p.h
+++ b/src/quick/items/qquickshadereffectnode_p.h
@@ -148,6 +148,7 @@ public:
Q_SIGNALS:
void logAndStatusChanged(const QString &, int status);
+ void dirtyTexture();
private Q_SLOTS:
void markDirtyTexture();
diff --git a/src/quick/items/qquickshadereffectsource.cpp b/src/quick/items/qquickshadereffectsource.cpp
index cd2e2c1cb6..a8cf6155a0 100644
--- a/src/quick/items/qquickshadereffectsource.cpp
+++ b/src/quick/items/qquickshadereffectsource.cpp
@@ -269,6 +269,8 @@ QSGTextureProvider *QQuickShaderEffectSource::textureProvider() const
Modifying this property makes most sense when the item is used as a
source texture of a \l ShaderEffect.
+ The default value is \c{ShaderEffectSource.ClampToEdge}.
+
\list
\li ShaderEffectSource.ClampToEdge - GL_CLAMP_TO_EDGE both horizontally and vertically
\li ShaderEffectSource.RepeatHorizontally - GL_REPEAT horizontally, GL_CLAMP_TO_EDGE vertically
diff --git a/src/quick/items/qquicksprite.cpp b/src/quick/items/qquicksprite.cpp
index 6429c0d668..63d3180842 100644
--- a/src/quick/items/qquicksprite.cpp
+++ b/src/quick/items/qquicksprite.cpp
@@ -224,6 +224,11 @@ QQuickSprite::QQuickSprite(QObject *parent)
{
}
+/*! \internal */
+QQuickSprite::~QQuickSprite()
+{
+}
+
int QQuickSprite::variedDuration() const //Deals with precedence when multiple durations are set
{
if (m_frameSync)
diff --git a/src/quick/items/qquicksprite_p.h b/src/quick/items/qquicksprite_p.h
index 3a91b3374a..1b8c8cee84 100644
--- a/src/quick/items/qquicksprite_p.h
+++ b/src/quick/items/qquicksprite_p.h
@@ -61,7 +61,8 @@
QT_BEGIN_NAMESPACE
-class QQuickSprite : public QQuickStochasticState
+// exported, since it's used in QtQuickParticles
+class Q_QUICK_EXPORT QQuickSprite : public QQuickStochasticState
{
Q_OBJECT
Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged)
@@ -84,6 +85,7 @@ class QQuickSprite : public QQuickStochasticState
public:
explicit QQuickSprite(QObject *parent = 0);
+ ~QQuickSprite();
QUrl source() const
{
diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp
index d2b719e8ef..a44f549b37 100644
--- a/src/quick/items/qquicktextedit.cpp
+++ b/src/quick/items/qquicktextedit.cpp
@@ -1567,8 +1567,7 @@ void QQuickTextEdit::setReadOnly(bool r)
if (!r)
flags = flags | Qt::TextEditable;
d->control->setTextInteractionFlags(flags);
- if (!r)
- d->control->moveCursor(QTextCursor::End);
+ d->control->moveCursor(QTextCursor::End);
#ifndef QT_NO_IM
updateInputMethod(Qt::ImEnabled);
diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp
index 3b1901e075..fec9beedf6 100644
--- a/src/quick/items/qquicktextinput.cpp
+++ b/src/quick/items/qquicktextinput.cpp
@@ -43,7 +43,7 @@
#include "qquicktextutil_p.h"
#include <private/qqmlglobal_p.h>
-
+#include <private/qv4scopedvalue_p.h>
#include <QtCore/qcoreapplication.h>
#include <QtCore/qmimedata.h>
@@ -711,8 +711,7 @@ void QQuickTextInput::setReadOnly(bool ro)
setFlag(QQuickItem::ItemAcceptsInputMethod, !ro);
#endif
d->m_readOnly = ro;
- if (!ro)
- d->setCursorPosition(d->end());
+ d->setCursorPosition(d->end());
#ifndef QT_NO_IM
updateInputMethod(Qt::ImEnabled);
#endif
@@ -1970,11 +1969,15 @@ bool QQuickTextInput::isRightToLeft(int start, int end)
\qmlmethod QtQuick::TextInput::cut()
Moves the currently selected text to the system clipboard.
+
+ \note If the echo mode is set to a mode other than Normal then cut
+ will not work. This is to prevent using cut as a method of bypassing
+ password features of the line control.
*/
void QQuickTextInput::cut()
{
Q_D(QQuickTextInput);
- if (!d->m_readOnly) {
+ if (!d->m_readOnly && d->m_echoMode == QQuickTextInput::Normal) {
d->copy();
d->del();
}
@@ -1984,6 +1987,10 @@ void QQuickTextInput::cut()
\qmlmethod QtQuick::TextInput::copy()
Copies the currently selected text to the system clipboard.
+
+ \note If the echo mode is set to a mode other than Normal then copy
+ will not work. This is to prevent using copy as a method of bypassing
+ password features of the line control.
*/
void QQuickTextInput::copy()
{
@@ -4363,10 +4370,7 @@ void QQuickTextInputPrivate::processKeyEvent(QKeyEvent* event)
}
}
else if (event == QKeySequence::Cut) {
- if (!m_readOnly) {
- copy();
- del();
- }
+ q->cut();
}
else if (event == QKeySequence::DeleteEndOfLine) {
if (!m_readOnly)
diff --git a/src/quick/items/qquickview.h b/src/quick/items/qquickview.h
index 29ce5b4935..1fcc34e3a1 100644
--- a/src/quick/items/qquickview.h
+++ b/src/quick/items/qquickview.h
@@ -60,9 +60,9 @@ class Q_QUICK_EXPORT QQuickView : public QQuickWindow
Q_PROPERTY(Status status READ status NOTIFY statusChanged)
Q_PROPERTY(QUrl source READ source WRITE setSource DESIGNABLE true)
public:
- explicit QQuickView(QWindow *parent = 0);
+ explicit QQuickView(QWindow *parent = Q_NULLPTR);
QQuickView(QQmlEngine* engine, QWindow *parent);
- QQuickView(const QUrl &source, QWindow *parent = 0);
+ explicit QQuickView(const QUrl &source, QWindow *parent = Q_NULLPTR);
virtual ~QQuickView();
QUrl source() const;
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index 70f60b9ae3..cae32dfa49 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -1820,7 +1820,7 @@ bool QQuickWindowPrivate::deliverWheelEvent(QQuickItem *item, QWheelEvent *event
if (item->contains(p)) {
QWheelEvent wheel(p, p, event->pixelDelta(), event->angleDelta(), event->delta(),
- event->orientation(), event->buttons(), event->modifiers(), event->phase(), event->source());
+ event->orientation(), event->buttons(), event->modifiers(), event->phase(), event->source(), event->inverted());
wheel.accept();
q->sendEvent(item, &wheel);
if (wheel.isAccepted()) {
diff --git a/src/quick/items/qquickwindow.h b/src/quick/items/qquickwindow.h
index e04a4a1ce2..1024147bb4 100644
--- a/src/quick/items/qquickwindow.h
+++ b/src/quick/items/qquickwindow.h
@@ -95,7 +95,7 @@ public:
};
Q_ENUM(SceneGraphError)
- QQuickWindow(QWindow *parent = 0);
+ explicit QQuickWindow(QWindow *parent = Q_NULLPTR);
explicit QQuickWindow(QQuickRenderControl *renderControl);
virtual ~QQuickWindow();
@@ -129,7 +129,7 @@ public:
// Scene graph specific functions
QSGTexture *createTextureFromImage(const QImage &image) const;
QSGTexture *createTextureFromImage(const QImage &image, CreateTextureOptions options) const;
- QSGTexture *createTextureFromId(uint id, const QSize &size, CreateTextureOptions options = CreateTextureOption(0)) const;
+ QSGTexture *createTextureFromId(uint id, const QSize &size, CreateTextureOptions options = CreateTextureOption()) const;
void setClearBeforeRendering(bool enabled);
bool clearBeforeRendering() const;
@@ -176,7 +176,7 @@ public Q_SLOTS:
void releaseResources();
protected:
- QQuickWindow(QQuickWindowPrivate &dd, QWindow *parent = 0);
+ QQuickWindow(QQuickWindowPrivate &dd, QWindow *parent = Q_NULLPTR);
void exposeEvent(QExposeEvent *) Q_DECL_OVERRIDE;
void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE;