aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2016-01-29 13:01:21 +0100
committerLiang Qi <liang.qi@theqtcompany.com>2016-01-29 13:01:22 +0100
commit1e421097f08876f5e2242be6f7a20db2aeb51692 (patch)
treec45b9323368cfdede67facd43c076a85322f12f6 /src/quick/items
parentf4788a13e98aa4e5438327094524d7b8239893ec (diff)
parent666bc731a0ba930ca0cfda18daf836913fd91361 (diff)
Merge remote-tracking branch 'origin/5.6' into dev
Diffstat (limited to 'src/quick/items')
-rw-r--r--src/quick/items/qquickanimatedsprite_p.h4
-rw-r--r--src/quick/items/qquickdroparea.cpp2
-rw-r--r--src/quick/items/qquickitem.cpp4
-rw-r--r--src/quick/items/qquickpathview.cpp4
-rw-r--r--src/quick/items/qquicktext.cpp4
-rw-r--r--src/quick/items/qquicktext_p.h2
-rw-r--r--src/quick/items/qquicktextnode.cpp118
-rw-r--r--src/quick/items/qquickwindow.cpp19
-rw-r--r--src/quick/items/qquickwindow.h2
-rw-r--r--src/quick/items/qquickwindow_p.h1
10 files changed, 28 insertions, 132 deletions
diff --git a/src/quick/items/qquickanimatedsprite_p.h b/src/quick/items/qquickanimatedsprite_p.h
index b2633619d5..6b49d903df 100644
--- a/src/quick/items/qquickanimatedsprite_p.h
+++ b/src/quick/items/qquickanimatedsprite_p.h
@@ -53,7 +53,7 @@
#include <QtQuick/QQuickItem>
#include <private/qquicksprite_p.h>
-#include <QTime>
+#include <QtCore/qelapsedtimer.h>
QT_BEGIN_NAMESPACE
@@ -372,7 +372,7 @@ private:
QQuickAnimatedSpriteMaterial *m_material;
QQuickSprite* m_sprite;
QQuickSpriteEngine* m_spriteEngine;
- QTime m_timestamp;
+ QElapsedTimer m_timestamp;
int m_curFrame;
bool m_pleaseReset;
bool m_running;
diff --git a/src/quick/items/qquickdroparea.cpp b/src/quick/items/qquickdroparea.cpp
index aecdcdbc28..1701441240 100644
--- a/src/quick/items/qquickdroparea.cpp
+++ b/src/quick/items/qquickdroparea.cpp
@@ -270,6 +270,8 @@ void QQuickDropArea::dragEnterEvent(QDragEnterEvent *event)
QQuickDropEvent dragTargetEvent(d, event);
emit entered(&dragTargetEvent);
+ if (!event->isAccepted())
+ return;
d->containsDrag = true;
if (QQuickDragMimeData *dragMime = qobject_cast<QQuickDragMimeData *>(const_cast<QMimeData *>(mimeData)))
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp
index dec2351de8..5be1c86fb4 100644
--- a/src/quick/items/qquickitem.cpp
+++ b/src/quick/items/qquickitem.cpp
@@ -4257,7 +4257,7 @@ void QQuickItem::setBaselineOffset(qreal offset)
* The call to QQuickItem::updatePaintNode() will always happen if the
* item is showing in a QQuickWindow.
*
- * Only items which specifies QQuickItem::ItemHasContents are allowed
+ * Only items which specify QQuickItem::ItemHasContents are allowed
* to call QQuickItem::update().
*/
void QQuickItem::update()
@@ -4297,7 +4297,7 @@ void QQuickItem::polish()
\qmlmethod object QtQuick::Item::mapFromItem(Item item, real x, real y, real width, real height)
Maps the point (\a x, \a y) or rect (\a x, \a y, \a width, \a height), which is in \a
- item's coordinate system, to this item's coordinate system, and returns a \l point or \rect
+ item's coordinate system, to this item's coordinate system, and returns a \l point or \l rect
matching the mapped coordinate.
If \a item is a \c null value, this maps the point or rect from the coordinate system of
diff --git a/src/quick/items/qquickpathview.cpp b/src/quick/items/qquickpathview.cpp
index e140d61dee..f0bbb1e732 100644
--- a/src/quick/items/qquickpathview.cpp
+++ b/src/quick/items/qquickpathview.cpp
@@ -1984,6 +1984,7 @@ void QQuickPathView::refill()
break;
}
if (d->items.contains(item)) {
+ d->releaseItem(item);
break; //Otherwise we'd "re-add" it, and get confused
}
if (d->currentIndex == idx) {
@@ -2014,6 +2015,7 @@ void QQuickPathView::refill()
break;
}
if (d->items.contains(item)) {
+ d->releaseItem(item);
break; //Otherwise we'd "re-add" it, and get confused
}
if (d->currentIndex == idx) {
@@ -2055,6 +2057,8 @@ void QQuickPathView::refill()
int lastListIdx = d->items.indexOf(lastItem);
d->items.insert(lastListIdx + 1, item);
d->updateItem(item, nextPos);
+ } else {
+ d->releaseItem(item);
}
lastItem = item;
diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp
index 97e00362be..0f7f1961a1 100644
--- a/src/quick/items/qquicktext.cpp
+++ b/src/quick/items/qquicktext.cpp
@@ -234,7 +234,7 @@ void QQuickTextPrivate::setBottomPadding(qreal value, bool reset)
The default is true.
*/
-void QQuickText::q_imagesLoaded()
+void QQuickText::q_updateLayout()
{
Q_D(QQuickText);
d->updateLayout();
@@ -1180,7 +1180,7 @@ void QQuickTextPrivate::ensureDoc()
extra->doc->setDocumentMargin(0);
extra->doc->setBaseUrl(q->baseUrl());
qmlobject_connect(extra->doc, QQuickTextDocumentWithImageResources, SIGNAL(imagesLoaded()),
- q, QQuickText, SLOT(q_imagesLoaded()));
+ q, QQuickText, SLOT(q_updateLayout()));
}
}
diff --git a/src/quick/items/qquicktext_p.h b/src/quick/items/qquicktext_p.h
index 87cde29199..0b35ad5f91 100644
--- a/src/quick/items/qquicktext_p.h
+++ b/src/quick/items/qquicktext_p.h
@@ -298,7 +298,7 @@ protected:
void invalidateFontCaches();
private Q_SLOTS:
- void q_imagesLoaded();
+ void q_updateLayout();
void triggerPreprocess();
void imageDownloadFinished();
diff --git a/src/quick/items/qquicktextnode.cpp b/src/quick/items/qquicktextnode.cpp
index d05f51d1ac..7ee01b5398 100644
--- a/src/quick/items/qquicktextnode.cpp
+++ b/src/quick/items/qquicktextnode.cpp
@@ -90,50 +90,6 @@ QQuickTextNode::~QQuickTextNode()
qDeleteAll(m_textures);
}
-#if 0
-void QQuickTextNode::setColor(const QColor &color)
-{
- if (m_usePixmapCache) {
- setUpdateFlag(UpdateNodes);
- } else {
- for (QSGNode *childNode = firstChild(); childNode; childNode = childNode->nextSibling()) {
- if (childNode->subType() == GlyphNodeSubType) {
- QSGGlyphNode *glyphNode = static_cast<QSGGlyphNode *>(childNode);
- if (glyphNode->color() == m_color)
- glyphNode->setColor(color);
- } else if (childNode->subType() == SolidRectNodeSubType) {
- QSGSimpleRectNode *solidRectNode = static_cast<QSGSimpleRectNode *>(childNode);
- if (solidRectNode->color() == m_color)
- solidRectNode->setColor(color);
- }
- }
- }
- m_color = color;
-}
-
-void QQuickTextNode::setStyleColor(const QColor &styleColor)
-{
- if (m_textStyle != QQuickTextNode::NormalTextStyle) {
- if (m_usePixmapCache) {
- setUpdateFlag(UpdateNodes);
- } else {
- for (QSGNode *childNode = firstChild(); childNode; childNode = childNode->nextSibling()) {
- if (childNode->subType() == GlyphNodeSubType) {
- QSGGlyphNode *glyphNode = static_cast<QSGGlyphNode *>(childNode);
- if (glyphNode->color() == m_styleColor)
- glyphNode->setColor(styleColor);
- } else if (childNode->subType() == SolidRectNodeSubType) {
- QSGSimpleRectNode *solidRectNode = static_cast<QSGSimpleRectNode *>(childNode);
- if (solidRectNode->color() == m_styleColor)
- solidRectNode->setColor(styleColor);
- }
- }
- }
- }
- m_styleColor = styleColor;
-}
-#endif
-
QSGGlyphNode *QQuickTextNode::addGlyphs(const QPointF &position, const QGlyphRun &glyphs, const QColor &color,
QQuickText::TextStyle style, const QColor &styleColor,
QSGNode *parentNode)
@@ -318,78 +274,4 @@ void QQuickTextNode::deleteContent()
m_textures.clear();
}
-#if 0
-void QQuickTextNode::updateNodes()
-{
- return;
- deleteContent();
- if (m_text.isEmpty())
- return;
-
- if (m_usePixmapCache) {
- // ### gunnar: port properly
-// QPixmap pixmap = generatedPixmap();
-// if (pixmap.isNull())
-// return;
-
-// QSGImageNode *pixmapNode = m_context->createImageNode();
-// pixmapNode->setRect(pixmap.rect());
-// pixmapNode->setSourceRect(pixmap.rect());
-// pixmapNode->setOpacity(m_opacity);
-// pixmapNode->setClampToEdge(true);
-// pixmapNode->setLinearFiltering(m_linearFiltering);
-
-// appendChildNode(pixmapNode);
- } else {
- if (m_text.isEmpty())
- return;
-
- // Implement styling by drawing text several times at slight shifts. shiftForStyle
- // contains the sequence of shifted positions at which to draw the text. All except
- // the last will be drawn with styleColor.
- QList<QPointF> shiftForStyle;
- switch (m_textStyle) {
- case OutlineTextStyle:
- // ### Should be made faster by implementing outline material
- shiftForStyle << QPointF(-1, 0);
- shiftForStyle << QPointF(0, -1);
- shiftForStyle << QPointF(1, 0);
- shiftForStyle << QPointF(0, 1);
- break;
- case SunkenTextStyle:
- shiftForStyle << QPointF(0, -1);
- break;
- case RaisedTextStyle:
- shiftForStyle << QPointF(0, 1);
- break;
- default:
- break;
- }
-
- shiftForStyle << QPointF(0, 0); // Regular position
- while (!shiftForStyle.isEmpty()) {
- QPointF shift = shiftForStyle.takeFirst();
-
- // Use styleColor for all but last shift
- if (m_richText) {
- QColor overrideColor = shiftForStyle.isEmpty() ? QColor() : m_styleColor;
-
- QTextFrame *textFrame = m_textDocument->rootFrame();
- QPointF p = m_textDocument->documentLayout()->frameBoundingRect(textFrame).topLeft();
-
- QTextFrame::iterator it = textFrame->begin();
- while (!it.atEnd()) {
- addTextBlock(shift + p, it.currentBlock(), overrideColor);
- ++it;
- }
- } else {
- addTextLayout(shift, m_textLayout, shiftForStyle.isEmpty()
- ? m_color
- : m_styleColor);
- }
- }
- }
-}
-#endif
-
QT_END_NAMESPACE
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index f2cfeb56aa..635f1da77e 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -294,6 +294,13 @@ void QQuickWindow::update()
QQuickRenderControlPrivate::get(d->renderControl)->update();
}
+void QQuickWindow::handleScreenChanged(QScreen *screen)
+{
+ Q_D(QQuickWindow);
+ Q_UNUSED(screen)
+ d->forcePolish();
+}
+
void forcePolishHelper(QQuickItem *item)
{
if (item->flags() & QQuickItem::ItemHasContents) {
@@ -308,12 +315,12 @@ void forcePolishHelper(QQuickItem *item)
/*!
Schedules polish events on all items in the scene.
*/
-void QQuickWindow::forcePolish()
+void QQuickWindowPrivate::forcePolish()
{
- Q_D(QQuickWindow);
- if (!screen())
+ Q_Q(QQuickWindow);
+ if (!q->screen())
return;
- forcePolishHelper(d->contentItem);
+ forcePolishHelper(contentItem);
}
void forceUpdate(QQuickItem *item)
@@ -484,7 +491,7 @@ void QQuickWindowPrivate::init(QQuickWindow *c, QQuickRenderControl *control)
QObject::connect(context, SIGNAL(invalidated()), q, SLOT(cleanupSceneGraph()), Qt::DirectConnection);
QObject::connect(q, SIGNAL(focusObjectChanged(QObject*)), q, SIGNAL(activeFocusItemChanged()));
- QObject::connect(q, SIGNAL(screenChanged(QScreen*)), q, SLOT(forcePolish()));
+ QObject::connect(q, SIGNAL(screenChanged(QScreen*)), q, SLOT(handleScreenChanged(QScreen*)));
QObject::connect(q, SIGNAL(frameSwapped()), q, SLOT(runJobsAfterSwap()), Qt::DirectConnection);
@@ -4012,7 +4019,7 @@ void QQuickWindow::resetOpenGLState()
*/
/*!
- \qmlproperty Window::active
+ \qmlproperty bool Window::active
\since 5.1
The active status of the window.
diff --git a/src/quick/items/qquickwindow.h b/src/quick/items/qquickwindow.h
index c101ac5239..262828ad1d 100644
--- a/src/quick/items/qquickwindow.h
+++ b/src/quick/items/qquickwindow.h
@@ -202,7 +202,7 @@ protected:
private Q_SLOTS:
void maybeUpdate();
void cleanupSceneGraph();
- void forcePolish();
+ void handleScreenChanged(QScreen *screen);
void setTransientParent_helper(QQuickWindow *window);
void runJobsAfterSwap();
diff --git a/src/quick/items/qquickwindow_p.h b/src/quick/items/qquickwindow_p.h
index 54cdcf8da1..652320c1c9 100644
--- a/src/quick/items/qquickwindow_p.h
+++ b/src/quick/items/qquickwindow_p.h
@@ -196,6 +196,7 @@ public:
void cleanup(QSGNode *);
void polishItems();
+ void forcePolish();
void syncSceneGraph();
void renderSceneGraph(const QSize &size);