QmlRegisterType to associate with other types?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
32 views
create
qmlRegisterType("myprog",1,0,"MyClass"); and it's all clear, but go ahead

1. It can be linked to other types in C++ code(signals, slots)?
2. Or how to create multiple classes in one type and refer to variables in the add?
by | 32 views

3 Answers

0 like 0 dislike
>It is possible to associate

"Him" who? The class object? doc.qt.io/qt-5/qtqml-syntax-signals.html

>Or how can I create multiple classes in one type

Talking about class fields? Take and create.

>to refer to variables in the add

Q_PROPERTY
by
0 like 0 dislike
Perhaps you no longer fit it: qmlRegisterSingletonType
by
0 like 0 dislike
1. C++ was written well :)
example with errors(and not at all XD) but about the result desired
spoiler
oneclass.cpp
----------------
OneClass : QObject {
...
signals: void mySignal();
}
twoclass.cpp
----------------
TwoClass : QObject {
...
public slots: void mySlot(){};
}

main.cpp
----------------
#include oneclass.cpp
#include twoclass.cpp
...
qmlRegisterType("myprog.one",1,0,"MyClass");
qmlRegisterType("myprog.two",1,0,"MyClass");
QObject::connect(OneClass, SIGNAL(mySignal), TwoClass, SLOT(mySLOT));
by

Related questions

0 like 0 dislike
2 answers
asked Apr 26, 2019 by Benstein
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
asked Jun 14, 2019 by Kalombyr
0 like 0 dislike
2 answers
asked May 22, 2019 by hakain
0 like 0 dislike
2 answers
110,608 questions
257,186 answers
0 comments
35,647 users