Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8575079
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:36:57+00:00 2026-06-11T19:36:57+00:00

I want to add properties dynamically to a QML element: Item { id: dynamicProperty;

  • 0

I want to add properties dynamically to a QML element:

Item {
 id: dynamicProperty;
 property int first;


 Component.onCompleted: {
  /* once this block of code is executed, i want to add
     property int second; property bool third; property variant fourth;
  */
 }

}

Is there any way to accomplish the above task.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T19:36:58+00:00Added an answer on June 11, 2026 at 7:36 pm

    I don’t think QML was designed to support dynamic property creation.

    Depending on your use-case this could be worked around with “script instances” (I made up the term). Basically each QML Component instantiation that import script which doesn’t have .pragma library statement will work with its own copy of globals declared in the script.

    For example you can look at PageStack (qt-components) code.

    There is import "PageStack.js" as Engine statement, and it later referred to call functions that uses global variables like if it was instance variables.

    If you looking for a way to add members to your QML Component and don’t need property change notifications, “script instances” would do just fine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want add new Feed item on entity persist and update. I write this
I want to design a table user control and dynamically add the properties of
Is it possible to add properties and special methods to modules? I want to
i want to make an app which can add the file properties of a
I want to be able to add a Binding to some properties of a
I want add my custom sidebar next right column all page. Please check this
I'm working on project and main layout contains ListView. I want to dynamically add
Writing a subclass of dynamicprops allows to me to add properties dynamically to an
I want to add attributes (like Browsable(false)) dynamically while displaying in the grid. Scenario
This is my script I use to dynamically add/remove input text fields. I'm using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.