Navigation

    Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Search
    • Unsolved
    1. Home
    2. Tags
    3. findchild
    Log in to post

    • SOLVED Custom Class findChild<QPushButton *>(); Not Finding Child
      General and Desktop • connect problem findchild invalid null parameter • • Burke212  

      13
      0
      Votes
      13
      Posts
      2030
      Views

      @Burke212 One more thing... :) So you create 10 Buttons and connect them somehow to "numPressed", that prints or computes the button-number, if a button is clicked + released, right? The use of a QButtonGroup would make this even easier. https://doc.qt.io/qt-5.6/qbuttongroup.html Add your buttons to your buttonGroup and setID of each button. ButtonGroup also provides signals and functions to work with. Maybe your own connection is not necessary anymore and you dont need to rename every single button, because you can work with the groupID. When adding the buttons to your group, set your own IDs, as the default buttonID in a buttonGroup starts at -2 and decreases with every additional button (this gave me headache in one of my projects some time ago... Of course, I didnt set my own IDs and was expecting the ID to start at 0 increasing. And of course I didnt read the Docs of the addButton-Function back then) :)
    • SOLVED findChild() always returns 0 for QML objects
      QML and Qt Quick • qml properties findchild • • Erlend E. Aasland  

      3
      0
      Votes
      3
      Posts
      4324
      Views

      @sierdzio Thanks for your input! The this-object was the parent widget holding the QQuickView. I solved it by saving the root object of the QQuickView: QObject *obj = quickview->rootObject(); if (obj) obj->setProperty("ticks", tick_count); else qDebug() << "Could not set tick count!"; Anyway, I'll have a look at the different approach you suggest. It sound like a more robust way of interacting with QML. Best regards, E
    • UNSOLVED QFileDialogの自動化について
      Japanese • qfiledialog gui automation qtest findchild selectfile • • Takeshi  

      1
      0
      Votes
      1
      Posts
      1282
      Views

      No one has replied

    • UNSOLVED C++ find child qml item included from other file
      QML and Qt Quick • qml dialog findchild • • PhTe  

      4
      0
      Votes
      4
      Posts
      9715
      Views

      @p3c0 said: Cast to QObject instead of QQuickItem. That works. :) Thanks.