Aggregating other QQuickPaintedItem derived Class.
-
Consider the 2 following basic QQuick class.
@class UI01 : public QQuickPaintedItem{
Q_OBJECT
public:
UI01(QQuickItem* parent = 0);
void paint(QPainter *painter);
};class UI02 : public QQuickPaintedItem{
Q_OBJECT
public:
UI01(QQuickItem* parent = 0) : QQuickPaintedItem(parent), ui(parent){
}void paint(QPainter *painter){
ui.paint(painter);
}private:
UI01 ui;
};
@
Assume that UI01 is fully implemented, paint draws a Rectangle. UI02 aggregates UI01 thorugh its member ui. My problem is this compiles well with qmake and make but It only paints a white box, it doesnt paint my expeced UI01 (of different color). Why wont UI02 draw its member UI01 ui? Can someone point me to the right track. Thanks in advance.I have set break point at ui.paint(painter) and even at the constructor. It is initialized nicely. I even pulled all of the paint code from UI01 TO UI02 just to test and it works. Of course that will not suffice since in real life, I'm building an array of UI01 in UI02.
EDIT: I have searched the whole documentation, and all I see about C++ is about bindings with qml files and reusing via import QML files. I get all of that, but I need to aggregate via c++ since I'm creating an application where the number of UI01 (declared above) varies and each of it is linked to some library.