aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2015-02-24 17:36:04 +0100
committerFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2015-02-24 17:36:04 +0100
commitad67ec26d0cbc98e3440dd38bb20eef4da2ee96d (patch)
tree9f8135751df2f995a4f55837ea065a4687245b71 /src/quick/items
parent83a16630c13969e68cd3a5aaab73335ccb0d4414 (diff)
parent20d160d0513a04be187ed851a25b029f47c27b27 (diff)
Merge remote-tracking branch 'origin/5.4' into 5.5
Conflicts: .qmake.conf LICENSE.GPLv2 examples/qml/networkaccessmanagerfactory/view.qml src/qml/jsruntime/qv4runtime.cpp src/qml/jsruntime/qv4stringobject.cpp Change-Id: I5d12f436d60995e51d5c2f59d364e9cbc24f8e32
Diffstat (limited to 'src/quick/items')
-rw-r--r--src/quick/items/context2d/qquickcanvasitem.cpp7
-rw-r--r--src/quick/items/qquickaccessibleattached.cpp4
-rw-r--r--src/quick/items/qquickdrag.cpp4
-rw-r--r--src/quick/items/qquickimagebase.cpp2
-rw-r--r--src/quick/items/qquickitem.cpp18
-rw-r--r--src/quick/items/qquickmousearea.cpp2
-rw-r--r--src/quick/items/qquickscreen.cpp11
-rw-r--r--src/quick/items/qquickscreen_p.h1
-rw-r--r--src/quick/items/qquicktext.cpp4
-rw-r--r--src/quick/items/qquicktextinput.cpp1
-rw-r--r--src/quick/items/qquicktextnodeengine.cpp2
-rw-r--r--src/quick/items/qquickwindow.cpp44
12 files changed, 58 insertions, 42 deletions
diff --git a/src/quick/items/context2d/qquickcanvasitem.cpp b/src/quick/items/context2d/qquickcanvasitem.cpp
index 4145b2f6ff..11aff9b95d 100644
--- a/src/quick/items/context2d/qquickcanvasitem.cpp
+++ b/src/quick/items/context2d/qquickcanvasitem.cpp
@@ -592,7 +592,9 @@ void QQuickCanvasItem::geometryChanged(const QRectF &newGeometry, const QRectF &
QQuickItem::geometryChanged(newGeometry, oldGeometry);
- QSizeF newSize = newGeometry.size();
+ // Due to indirect recursion, newGeometry may be outdated
+ // after this call, so we use width and height instead.
+ QSizeF newSize = QSizeF(width(), height());
if (!d->hasCanvasSize && d->canvasSize != newSize) {
d->canvasSize = newSize;
emit canvasSizeChanged();
@@ -1124,6 +1126,9 @@ bool QQuickCanvasItem::createContext(const QString &contextType)
{
Q_D(QQuickCanvasItem);
+ if (!window())
+ return false;
+
if (contextType == QLatin1String("2d")) {
if (d->contextType.compare(QLatin1String("2d"), Qt::CaseInsensitive) != 0) {
d->contextType = QLatin1String("2d");
diff --git a/src/quick/items/qquickaccessibleattached.cpp b/src/quick/items/qquickaccessibleattached.cpp
index 7b9cb9e9f1..99b9311ee0 100644
--- a/src/quick/items/qquickaccessibleattached.cpp
+++ b/src/quick/items/qquickaccessibleattached.cpp
@@ -75,7 +75,7 @@ QT_BEGIN_NAMESPACE
}
\endqml
The \l role is set to \c Button to indicate the type of control.
- \l Accessible.name is the most important information and bound to the text on the button.
+ \l {Accessible::}{name} is the most important information and bound to the text on the button.
The name is a short and consise description of the control and should reflect the visual label.
In this case it is not clear what the button does with the name only, so \l description contains
an explanation.
@@ -123,7 +123,7 @@ QT_BEGIN_NAMESPACE
\li All interactive elements
\li \l focusable and \l focused
\li All elements that the user can interact with should have focusable set to \c true and
- set \l focus to \c true when they have the focus. This is important even for applications
+ set \c focus to \c true when they have the focus. This is important even for applications
that run on touch-only devices since screen readers often implement a virtual focus that
can be moved from item to item.
\row
diff --git a/src/quick/items/qquickdrag.cpp b/src/quick/items/qquickdrag.cpp
index c23b8bb8a4..7ce649c7eb 100644
--- a/src/quick/items/qquickdrag.cpp
+++ b/src/quick/items/qquickdrag.cpp
@@ -516,8 +516,8 @@ void QQuickDragAttached::setProposedAction(Qt::DropAction action)
\endlist
When using \c Drag.Automatic you should also define \l mimeData and bind the
- \l active property to the active property of \l MouseArea.drag.
- */
+ \l active property to the active property of MouseArea : \l {MouseArea::drag.active}
+*/
QQuickDrag::DragType QQuickDragAttached::dragType() const
{
diff --git a/src/quick/items/qquickimagebase.cpp b/src/quick/items/qquickimagebase.cpp
index 951532e8b9..b54c34765f 100644
--- a/src/quick/items/qquickimagebase.cpp
+++ b/src/quick/items/qquickimagebase.cpp
@@ -323,7 +323,7 @@ static QString image2xPath(const QString &path)
{
const int dotIndex = path.lastIndexOf(QLatin1Char('.'));
if (dotIndex == -1)
- return path;
+ return path + QLatin1String("@2x");
if (path.contains(QLatin1String("@2x.")))
return path;
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp
index b1aeda4091..4157fc4a66 100644
--- a/src/quick/items/qquickitem.cpp
+++ b/src/quick/items/qquickitem.cpp
@@ -1757,11 +1757,9 @@ void QQuickItemPrivate::updateSubFocusItem(QQuickItem *scope, bool focus)
QQmlProperty(), or QMetaProperty::write() when you need to modify those
properties from C++. This ensures that the QML engine knows about the
property change. Otherwise, the engine won't be able to carry out your
- requested animation. For example, if you call \l setPosition() directly,
- any behavior that reacts to changes in the x or y properties will not take
- effect, as you are bypassing Qt's meta-object system. Note that these
- functions incur a slight performance penalty. For more details, see
- \l {Accessing Members of a QML Object Type from C++}.
+ requested animation.
+ Note that these functions incur a slight performance penalty. For more
+ details, see \l {Accessing Members of a QML Object Type from C++}.
\sa QQuickWindow, QQuickPaintedItem
*/
@@ -5053,7 +5051,7 @@ void QQuickItem::setZ(qreal v)
\endqml
\endtable
- \sa transform, Rotation
+ \sa Transform, Rotation
*/
/*!
\property QQuickItem::rotation
@@ -5079,7 +5077,7 @@ void QQuickItem::setZ(qreal v)
\endqml
\endtable
- \sa transform, Rotation
+ \sa Transform, Rotation
*/
qreal QQuickItem::rotation() const
{
@@ -5139,7 +5137,7 @@ void QQuickItem::setRotation(qreal r)
\endqml
\endtable
- \sa transform, Scale
+ \sa Transform, Scale
*/
/*!
\property QQuickItem::scale
@@ -5178,7 +5176,7 @@ void QQuickItem::setRotation(qreal r)
\endqml
\endtable
- \sa transform, Scale
+ \sa Transform, Scale
*/
qreal QQuickItem::scale() const
{
@@ -6368,7 +6366,7 @@ void QQuickItem::setSize(const QSizeF &size)
d->heightValid = true;
d->widthValid = true;
- if (QSizeF(d->width, d->height) == size)
+ if (d->width == size.width() && d->height == size.height())
return;
qreal oldHeight = d->height;
diff --git a/src/quick/items/qquickmousearea.cpp b/src/quick/items/qquickmousearea.cpp
index b78c58854e..6227329fbc 100644
--- a/src/quick/items/qquickmousearea.cpp
+++ b/src/quick/items/qquickmousearea.cpp
@@ -1305,6 +1305,8 @@ void QQuickMouseArea::setCursorShape(Qt::CursorShape shape)
started. If set to \c false, the target will be moved straight to the current mouse position.
By default, this property is \c true. This property was added in Qt Quick 2.4
+ See the \l Drag attached property and \l DropArea if you want to make a drop.
+
\snippet qml/mousearea/mouseareadragfilter.qml dragfilter
*/
diff --git a/src/quick/items/qquickscreen.cpp b/src/quick/items/qquickscreen.cpp
index 24fc4b6af8..5bd6430f2d 100644
--- a/src/quick/items/qquickscreen.cpp
+++ b/src/quick/items/qquickscreen.cpp
@@ -198,7 +198,7 @@ QT_BEGIN_NAMESPACE
This contains the update mask for the orientation. Screen::orientation
only emits changes for the screen orientations matching this mask.
- The default, \c 0, means Screen::orientation never updates.
+ By default it is set to the value of the QScreen that the window uses.
*/
QQuickScreenAttached::QQuickScreenAttached(QObject* attachee)
@@ -206,6 +206,7 @@ QQuickScreenAttached::QQuickScreenAttached(QObject* attachee)
, m_screen(NULL)
, m_window(NULL)
, m_updateMask(0)
+ , m_updateMaskSet(false)
{
m_attachee = qobject_cast<QQuickItem*>(attachee);
@@ -301,6 +302,7 @@ Qt::ScreenOrientations QQuickScreenAttached::orientationUpdateMask() const
void QQuickScreenAttached::setOrientationUpdateMask(Qt::ScreenOrientations mask)
{
+ m_updateMaskSet = true;
if (m_updateMask == mask)
return;
@@ -342,7 +344,12 @@ void QQuickScreenAttached::screenChanged(QScreen *screen)
if (!screen)
return; //Don't bother emitting signals, because the new values are garbage anyways
- screen->setOrientationUpdateMask(m_updateMask);
+ if (m_updateMaskSet) {
+ screen->setOrientationUpdateMask(m_updateMask);
+ } else if (m_updateMask != screen->orientationUpdateMask()) {
+ m_updateMask = screen->orientationUpdateMask();
+ emit orientationUpdateMaskChanged();
+ }
if (!oldScreen || screen->size() != oldScreen->size()) {
emit widthChanged();
diff --git a/src/quick/items/qquickscreen_p.h b/src/quick/items/qquickscreen_p.h
index 68dbff7138..3d0f00b22c 100644
--- a/src/quick/items/qquickscreen_p.h
+++ b/src/quick/items/qquickscreen_p.h
@@ -106,6 +106,7 @@ private:
QQuickWindow* m_window;
QQuickItem* m_attachee;
Qt::ScreenOrientations m_updateMask;
+ bool m_updateMaskSet;
};
class Q_AUTOTEST_EXPORT QQuickScreen : public QObject
diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp
index 4cd055594c..9311b9d9c9 100644
--- a/src/quick/items/qquicktext.cpp
+++ b/src/quick/items/qquicktext.cpp
@@ -961,7 +961,7 @@ QRectF QQuickTextPrivate::setupTextLayout(qreal *const baseline)
// If the horizontal alignment is not left and the width was not valid we need to relayout
// now that we know the maximum line width.
- if (!implicitWidthValid && unwrappedLineCount > 1 && q->effectiveHAlign() != QQuickText::AlignLeft) {
+ if (!q->widthValid() && !implicitWidthValid && unwrappedLineCount > 1 && q->effectiveHAlign() != QQuickText::AlignLeft) {
widthExceeded = false;
heightExceeded = false;
continue;
@@ -2755,7 +2755,7 @@ void QQuickText::invalidateFontCaches()
{
Q_D(QQuickText);
- if (d->richText && d->extra->doc != 0) {
+ if (d->richText && d->extra.isAllocated() && d->extra->doc != 0) {
QTextBlock block;
for (block = d->extra->doc->firstBlock(); block.isValid(); block = block.next()) {
if (block.layout() != 0 && block.layout()->engine() != 0)
diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp
index 85ff6735bb..1d86b4b000 100644
--- a/src/quick/items/qquicktextinput.cpp
+++ b/src/quick/items/qquicktextinput.cpp
@@ -578,6 +578,7 @@ void QQuickTextInput::setVAlign(QQuickTextInput::VAlignment alignment)
emit verticalAlignmentChanged(d->vAlign);
if (isComponentComplete()) {
updateCursorRectangle();
+ d->updateBaselineOffset();
}
}
diff --git a/src/quick/items/qquicktextnodeengine.cpp b/src/quick/items/qquicktextnodeengine.cpp
index 2db04ab378..369570f657 100644
--- a/src/quick/items/qquicktextnodeengine.cpp
+++ b/src/quick/items/qquicktextnodeengine.cpp
@@ -408,7 +408,7 @@ void QQuickTextNodeEngine::addImage(const QRectF &rect, const QImage &image, qre
QRectF searchRect = rect;
if (layoutPosition == QTextFrameFormat::InFlow) {
if (m_currentLineTree.isEmpty()) {
- searchRect.moveTopLeft(m_position + m_currentLine.position());
+ searchRect.moveTopLeft(m_position + m_currentLine.position() + QPointF(0,1));
} else {
const BinaryTreeNode *lastNode = m_currentLineTree.data() + m_currentLineTree.size() - 1;
if (lastNode->glyphRun.isRightToLeft()) {
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index 12be50ba6d..b88a3aecbc 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -249,20 +249,22 @@ void QQuickWindow::focusInEvent(QFocusEvent *ev)
void QQuickWindowPrivate::polishItems()
{
- int maxPolishCycles = 100000;
-
- while (!itemsToPolish.isEmpty() && --maxPolishCycles > 0) {
- QSet<QQuickItem *> itms = itemsToPolish;
- itemsToPolish.clear();
-
- for (QSet<QQuickItem *>::iterator it = itms.begin(); it != itms.end(); ++it) {
- QQuickItem *item = *it;
- QQuickItemPrivate::get(item)->polishScheduled = false;
- item->updatePolish();
- }
+ // An item can trigger polish on another item, or itself for that matter,
+ // during its updatePolish() call. Because of this, we cannot simply
+ // iterate through the set, we must continue pulling items out until it
+ // is empty.
+ // In the case where polish is called from updatePolish() either directly
+ // or indirectly, we use a recursionSafeguard to print a warning to
+ // the user.
+ int recursionSafeguard = INT_MAX;
+ while (!itemsToPolish.isEmpty() && --recursionSafeguard > 0) {
+ QQuickItem *item = *itemsToPolish.begin();
+ itemsToPolish.remove(item);
+ QQuickItemPrivate::get(item)->polishScheduled = false;
+ item->updatePolish();
}
- if (maxPolishCycles == 0)
+ if (recursionSafeguard == 0)
qWarning("QQuickWindow: possible QQuickItem::polish() loop");
updateFocusItemTransform();
@@ -3143,7 +3145,7 @@ bool QQuickWindow::isSceneGraphInitialized() const
(e.g. the user clicked the title bar close button). The CloseEvent contains
an accepted property which can be set to false to abort closing the window.
- \sa Window.closing()
+ \sa QQuickWindow::closing()
*/
/*!
@@ -3167,7 +3169,7 @@ bool QQuickWindow::isSceneGraphInitialized() const
This signal is emitted when the user tries to close the window.
- This signal includes a \a close parameter. The \a close \l accepted
+ This signal includes a \a close parameter. The \c {close.accepted}
property is true by default so that the window is allowed to close; but you
can implement an \c onClosing handler and set \c {close.accepted = false} if
you need to do something else before the window can be closed.
@@ -4038,7 +4040,7 @@ void QQuickWindow::resetOpenGLState()
This is equivalent to calling showFullScreen(), showMaximized(), or showNormal(),
depending on the platform's default behavior for the window type and flags.
- \sa showFullScreen(), showMaximized(), showNormal(), hide(), flags()
+ \sa showFullScreen(), showMaximized(), showNormal(), hide(), QQuickItem::flags()
*/
/*!
@@ -4084,14 +4086,14 @@ void QQuickWindow::resetOpenGLState()
*/
/*!
- \enum QQuickWindow::RenderJobSchedule
+ \enum QQuickWindow::RenderStage
\since 5.4
- \value ScheduleBeforeSynchronizing Before synchronization.
- \value ScheduleAfterSynchronizing After synchronization.
- \value ScheduleBeforeRendering Before rendering.
- \value ScheduleAfterRendering After rendering.
- \value ScheduleAfterSwap After the frame is swapped.
+ \value BeforeSynchronizingStage Before synchronization.
+ \value AfterSynchronizingStage After synchronization.
+ \value BeforeRenderingStage Before rendering.
+ \value AfterRenderingStage After rendering.
+ \value AfterSwapStage After the frame is swapped.
\sa {Scene Graph and Rendering}
*/