Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Anchors.mirrored is returned as invalid property in C++ side!

Anchors.mirrored is returned as invalid property in C++ side!

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 2 Posters 2.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    raja26
    wrote on last edited by
    #1

    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.1

    Rectangle {
    id: parentRect
    LayoutMirroring.enabled: true
    LayoutMirroring.childrenInherit: true
    width: 300; height: 50
    color: "yellow"
    border.width: 1

    Row {
        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&#40;QLatin1String("qml/Test/main.qml"&#41;);
    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&#40;&#41;;
    

    }
    @

    I have also tried to access other properties like anchors.leftMargin, but I cannot get anchors.mirrored as a valid property.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mbrasser
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • R Offline
        R Offline
        raja26
        wrote on last edited by
        #3

        @mbrasser Thanks. I'll report it shortly.

        1 Reply Last reply
        0
        • R Offline
          R Offline
          raja26
          wrote on last edited by
          #4

          I have reported this bug. "Bug Link":https://bugreports.qt.nokia.com/browse/QTBUG-23427.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved