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. Create Qt Quick Controls fully programmatically?
Qt 6.11 is out! See what's new in the release blog

Create Qt Quick Controls fully programmatically?

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 1.6k 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
    jpcolcom
    wrote on last edited by
    #1

    Hi guy's

    is it possible to create qt quick controls without using QML files?
    Therefore fully programmatically by Qt C++ Code?

    1 Reply Last reply
    0
    • T Offline
      T Offline
      t3685
      wrote on last edited by
      #2

      Yes:

      http://qt-project.org/doc/qt-5/qquickitem.html#details

      1 Reply Last reply
      0
      • J Offline
        J Offline
        jpcolcom
        wrote on last edited by
        #3

        Great, works. Thanks!

        @TestObject:: TestObject(QQuickItem *parent) : QQuickItem (parent) {
        this->setFlag(ItemHasContents, true);
        }

        QSGNode * TestObject::updatePaintNode(QSGNode *node, UpdatePaintNodeData *) {

        QSGSimpleRectNode *pNode = static_cast<QSGSimpleRectNode *>(node);
        if (! pNode) {
        pNode = new QSGSimpleRectNode();
        pNode->setColor(Qt::red);
        }
        pNode->setRect(boundingRect());
        return pNode;
        }@

        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