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. <Solved> Is there any constructor function for Components ? Or Init ?
Forum Update on Monday, May 27th 2025

<Solved> Is there any constructor function for Components ? Or Init ?

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 3 Posters 1.7k 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.
  • A Offline
    A Offline
    Antares
    wrote on 27 Nov 2013, 15:27 last edited by
    #1

    Hi,

    I would know if there is any constructor or initialisation function in QML ? an entrypoint at application start.

    I can make this by calling it from c++ but I cannot believe its does not exist !

    Is there anybody know ?

    1 Reply Last reply
    0
    • V Offline
      V Offline
      Vincent007
      wrote on 27 Nov 2013, 16:22 last edited by
      #2

      Please read document about "Defining QML Types from C++". "Any QObject-derived C++ class can be registered as the definition of a QML object type. Once a class is registered with the QML type system, the class can be declared and instantiated like any other object type from QML code."

      QML objects are created by QML engine according to QML documents.

      "QML Engine Internals, Part 1: QML File Loading":http://www.kdab.com/qml-engine-internals-part-1-qml-file-loading/

      1 Reply Last reply
      0
      • E Offline
        E Offline
        eliseev
        wrote on 28 Nov 2013, 14:40 last edited by
        #3

        Will this be of any help? It's not clear what you exactly need.

        @Item {
        Component.onCompleted: {
        // extra init here
        }
        }@

        1 Reply Last reply
        0
        • A Offline
          A Offline
          Antares
          wrote on 28 Nov 2013, 15:26 last edited by
          #4

          Thanks for answering, Sergei that was what I've been looking for, but actually I have found a different way to do it.

          1 Reply Last reply
          0

          1/4

          27 Nov 2013, 15:27

          • Login

          • Login or register to search.
          1 out of 4
          • First post
            1/4
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved