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. [SOLVED]add child to a QQuickItem
Forum Updated to NodeBB v4.3 + New Features

[SOLVED]add child to a QQuickItem

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 2.7k 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.
  • S Offline
    S Offline
    sheepy
    wrote on last edited by
    #1

    Hello,
    I want to add some child objects to a custom QQuickItem Plugin in c++.

    for this I add the objects in the constructor of the parent QQUickItem:

    @overlay.setParent(this);
    view.setParent(this);
    overlay.setPosition(QPointF(0,0));
    view.setPosition(QPointF(0,0));

    this->overlay.setX(0);
    this->overlay.setY(0);
    this->overlay.setWidth(this->width());
    this->overlay.setHeight(this->height());

    this->view.setX(0);
    this->view.setY(0);
    this->view.setWidth(this->width());
    this->view.setHeight(this->height());
    setFlag(ItemHasContents, true);@

    In QML I only add the parent class with a width and a height.

    Why my child objects are not visible?

    Greetings

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dasRicardo
      wrote on last edited by
      #2

      Hmmm i mean the problem here is width and height is not set in the constructor. You can try to override the onComplete function or set the dimensions of the child element in updatePaintNode. For performance reason maybe store the size in a property and set the new height and width only if it's changed.

      **Sorry for my english :)

      PLEASE ADD [SOLVED] TO YOUR THREAD TITLE IF IT'S SOLVED.**

      1 Reply Last reply
      0
      • S Offline
        S Offline
        sheepy
        wrote on last edited by
        #3

        thank you, override the onComplete method works for me

        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