aboutsummaryrefslogtreecommitdiffstats
path: root/src/templates
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2016-02-11 17:37:22 +0100
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2016-02-12 13:07:51 +0000
commite19a9044fa3cdfa86a4caa11a3e9b619fb7b3c8e (patch)
tree76b85d1dc6bbdaade33a4e69ac3a0f3e152250b0 /src/templates
parentf503e45ff70c2160352fd2afe89c577a2f63cd4b (diff)
StackView: warn the user for using anchors
Change-Id: I6c977e4bdc62820589a94700291d93b290d796ae Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
Diffstat (limited to 'src/templates')
-rw-r--r--src/templates/qquickstackview.cpp6
-rw-r--r--src/templates/qquickstackview_p.cpp8
2 files changed, 14 insertions, 0 deletions
diff --git a/src/templates/qquickstackview.cpp b/src/templates/qquickstackview.cpp
index 87cbfe31..bfa01e72 100644
--- a/src/templates/qquickstackview.cpp
+++ b/src/templates/qquickstackview.cpp
@@ -257,6 +257,12 @@ QT_BEGIN_NAMESPACE
}
\endqml
+ \note Using anchors on the items added to a StackView is not supported.
+ Typically push, pop, and replace transitions animate the position,
+ which is not possible when anchors are applied. Notice that this
+ only applies to the root of the item. Using anchors for its children
+ works as expected.
+
\labs
\sa {Customizing StackView}, {Navigation Controls}, {Container Controls}
diff --git a/src/templates/qquickstackview_p.cpp b/src/templates/qquickstackview_p.cpp
index 77f1430f..101f1f68 100644
--- a/src/templates/qquickstackview_p.cpp
+++ b/src/templates/qquickstackview_p.cpp
@@ -36,6 +36,7 @@
#include "qquickstackview_p_p.h"
+#include <QtQml/qqmlinfo.h>
#include <QtQml/qqmllist.h>
#include <QtQml/qqmlengine.h>
#include <QtQml/qqmlcomponent.h>
@@ -224,6 +225,13 @@ void QQuickStackElement::transitionNextReposition(QQuickItemViewTransitioner *tr
bool QQuickStackElement::prepareTransition(QQuickItemViewTransitioner *transitioner, const QRectF &viewBounds)
{
if (transitioner) {
+ if (item) {
+ QQuickAnchors *anchors = QQuickItemPrivate::get(item)->_anchors;
+ // TODO: expose QQuickAnchorLine so we can test for other conflicting anchors
+ if (anchors && (anchors->fill() || anchors->centerIn()))
+ qmlInfo(item) << "StackView has detected conflicting anchors. Transitions may not execute properly.";
+ }
+
// TODO: add force argument to QQuickItemViewTransitionableItem::prepareTransition()?
nextTransitionToSet = true;
nextTransitionFromSet = true;