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. Set objectName property as "required". How?
Qt 6.11 is out! See what's new in the release blog

Set objectName property as "required". How?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 327 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.
  • B Offline
    B Offline
    bogong
    wrote on last edited by bogong
    #1

    Hello all!

    I am developing kind of library that includes some QML components. In some cases I need "objectName" property as required property. Is there any QML predefined mechanism to check if it not defined by developer and not equal to undefined? I mean not by manual checking by JavaScript function. I mean anything that already inside of QML Component.

    I found only solution for myself like this:

    Item {
    
    	required property string pObjectName;
    	...
    
    	id: oRoot;
    	objectName: oRoot.pObjectName;
    	...
    }
    

    Is there more delicate way to ensure this property defined by developer?

    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