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. QtQuick define time constant property and inheritance
Forum Updated to NodeBB v4.3 + New Features

QtQuick define time constant property and inheritance

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 486 Views 1 Watching
  • 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.
  • strahlexS Offline
    strahlexS Offline
    strahlex
    wrote on last edited by
    #1

    Hello I have 2 questions probably easy to answer for you:

    • I want to create QML Component which uses in the initialisator something like this:
      @
      MyComponent {
      id: whatever
      name: "myName"
      }
      @
      In the C++ Code:
      @
      MyComponent::MyComponent(QObject *parent)
      {
      this->randomClass = new RandomClass(m_name);
      }
      @

    So the name is only relevant at the startup of the application and should never be changed. How can I do that?

    • How can I use Inheritance in QML. In fact I want to do something like this:
      @
      MyComponent {
      id: myComponent
      name: "test"
      MyPin {
      id: pin1
      name: "out"
      type: Pin_Bool
      }
      MyPin {
      id: pin2
      name: "in"
      type: Pin_Float
      }
      }
      @

    In the C++ code this should happen at startup:
    @
    // In Class MyComponent
    myComponent = new MyComponent(m_name);
    // In Class Pin1
    parent->newPin(m_name);
    // In Class Pin2
    parent->newPin(m_name);
    // In Class MyComponent
    myComponent->ready();
    @
    How can I achieve that?

    Feel free to check out my website machinekoder.com
    and my pet projects Intellicute and QtQuickVcp

    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