Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QML var (array type) property initialization with QML objects
Qt 6.12 LTS is out! See what's new in the release blog

QML var (array type) property initialization with QML objects

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
arrayqmljavascriptinitialization
1 Posts 1 Posters 2.9k 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    I'm using Qt 5.5.1
    I can't seem to initialize a property with an array type with QML objects.

    Here are some statements:

    //your code here
    
    property MyQML myQML: MyQML {} // works
    property var myint: [3, 5] // works
    property var myQMLArray: [MyQML {}, MyQML {}] // doesn't work
    

    This behavior seems weird to me. Is this how it is supposed to be? Or am I missing something?

    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
    • Unsolved