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. Aggregating other QQuickPaintedItem derived Class.
Forum Updated to NodeBB v4.3 + New Features

Aggregating other QQuickPaintedItem derived Class.

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 458 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.
  • J Offline
    J Offline
    JoeyAndres
    wrote on last edited by
    #1

    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.

    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