diff options
author | Mitch Curtis <mitch.curtis@theqtcompany.com> | 2015-10-14 10:38:49 +0200 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@theqtcompany.com> | 2015-10-20 14:08:28 +0000 |
commit | e7840895aa712e867009d518d7eacc372a92df71 (patch) | |
tree | deb1a950170479ce384220e33ee4af84eaf50363 /src/quick/items/qquickitem_p.h | |
parent | dc5bf4275b6d40aefac038d57b3aea62a8be3d12 (diff) |
QQuickItem: fully document stackBefore() and stackAfter()
Some of the following behavior initially came as a surprise to me:
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
QObject *window = engine.rootObjects().first();
// Assume that a and b are rectangles declared in that order, respectively.
QQuickItem *a = window->property("a").value<QQuickItem*>();
QQuickItem *b = window->property("b").value<QQuickItem*>();
// a is rendered below b (assume that rendering happens here)
qDebug() << "a.z =" << a->z() << "b.z =" << b->z(); // a.z = 0 b.z = 0
a->stackAfter(b);
// a is rendered above b
qDebug() << "a.z =" << a->z() << "b.z =" << b->z(); // a.z = 0 b.z = 0
b->setZ(1);
// a is rendered below b
qDebug() << "a.z =" << a->z() << "b.z =" << b->z(); // a.z = 0 b.z = 1
a->stackAfter(b);
// a is rendered below b
qDebug() << "a.z =" << a->z() << "b.z =" << b->z(); // a.z = 0 b.z = 1
return app.exec();
}
I would have thought that stackBefore()/stackAfter() would also change
the z value, but it makes sense that it doens't, as z is never really
validated, as such.
Still, we should document the exact behavior, including information
about tab focus ordering.
Change-Id: Iafc45aec402d8461e7b53525f81195171f659dff
Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Diffstat (limited to 'src/quick/items/qquickitem_p.h')
0 files changed, 0 insertions, 0 deletions