Anchors.mirrored is returned as invalid property in C++ side!
-
I have tried to find if a Rectangle has LayoutMirroring enabled. As per the "documentation":http://doc.qt.nokia.com/4.7-snapshot/qml-item.html#anchors.mirrored-prop, this value should return mirroring (LayoutMirroring) status. But when I tried to read it from the C++ side, it is always returned as an invalid property type.
I used the following code to test this case.
main.qml
@import QtQuick 1.1Rectangle {
id: parentRect
LayoutMirroring.enabled: true
LayoutMirroring.childrenInherit: true
width: 300; height: 50
color: "yellow"
border.width: 1Row { anchors { left: parent.left; margins: 5 } y: 5; spacing: 5 Repeater { model: 5 Rectangle { color: "red" opacity: (5 - index) / 5 width: 40; height: 40 Text { text: index + 1 anchors.centerIn: parent } } } }
}
@main.cpp
@#include <QtGui/QApplication>
#include <QDeclarativeProperty>
#include <QGraphicsObject>
#include <QDebug>
#include "qmlapplicationviewer.h"Q_DECL_EXPORT int main(int argc, char *argv[])
{
QScopedPointer<QApplication> app(createApplication(argc, argv));
QScopedPointer<QmlApplicationViewer> viewer(QmlApplicationViewer::create());viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto); viewer->setMainQmlFile(QLatin1String("qml/Test/main.qml")); QDeclarativeProperty propLayout(viewer->rootObject(),"anchors.mirrored"); QDeclarativeProperty propLayoutMargin(viewer->rootObject(),"anchors.leftMargin"); qDebug() << "Layout Property :" << propLayout.read().toBool(); qDebug() << "Layout Margin :" << propLayoutMargin.read().toReal(); if(propLayout.type() == QDeclarativeProperty::Invalid) qDebug() << "Invalid property"; viewer->showExpanded(); return app->exec();
}
@I have also tried to access other properties like anchors.leftMargin, but I cannot get anchors.mirrored as a valid property.
-
Hi,
I think this is likely a bug, related to the fact that anchors.mirrored is a revisioned property (was introduced in 1.1) on a group object. I'd suggest adding a bug report via http://bugreports.qt.nokia.com so it can be looked into further.
Regards,
Michael -
I have reported this bug. "Bug Link":https://bugreports.qt.nokia.com/browse/QTBUG-23427.