QtQuick define time constant property and inheritance
-
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? - I want to create QML Component which uses in the initialisator something like this: