Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Allowed QML 'types' for property definitions?

Allowed QML 'types' for property definitions?

Scheduled Pinned Locked Moved Mobile and Embedded
2 Posts 2 Posters 4.3k Views
  • 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.
  • S Offline
    S Offline
    spazvt
    wrote on last edited by
    #1

    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"
    }
    

    }@

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      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.

      (Z(:^

      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