Allowed QML 'types' for property definitions?



  • I'm parameterizing some of the object I repeatedly use, and using top-level properties to define how the various instantiations should work. However, there are a few things I haven't been able to pass into the object because I can't figure out what 'type' they are. Is there a list somewhere? (I know, it should be in the Qt documentation, but when I look up, say "QML ListView" and look at the parameters where they state the type, like Component, QtObject, bool, real, string, color, int, Item, enumeration, and then try some of those types, some don't work (like Component, Item, enumeration)). Like what type is the enumeration Text.AlignHCenter? My Qt 4.7.4 recognizes the 'enumeration' keyword, but I still get a command line error "Expected property type".

    @import QtQuick 1.1

    Rectangle {
    width: 100
    height: 62

    property enumeration textHorizontalAlignment: Text.AlignHCenter
    
    Text {
        id: row1TextLabel
        anchors.top: parent.top
        anchors.topMargin: 5
        anchors.left: parent.left
        anchors.right: parent.right
        //horizontalAlignment: Text.AlignHCenter
        horizontalAlignment: parent.textHorizontalAlignment
        text: "row1"
    }
    Text {
        id: row2TextLabel
        anchors.top: row1TextLabel.bottom
        anchors.topMargin: 5
        anchors.left: parent.left
        anchors.right: parent.right
        //horizontalAlignment: Text.AlignHCenter
        horizontalAlignment: parent.textHorizontalAlignment
        text: "row2"
    }
    

    }@


  • Moderators

    There is a list "here":http://qt-project.org/doc/qt-4.8/qdeclarativebasictypes.html. It is a bit longer in Qt5, with introduction of var properties. Enums are int, by the way.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.