Important: Please read the Qt Code of Conduct -

QGroupBox derived class does not inherit setParent(QObject* parent);

  • So I have this class:

    class Profile : public QGroupBox

    And I see that QGroupBox inherits from QWidget, which inherits from QObject, which has the method:

    void setParent(QObject* parent);

    But then I try to access this inherited method in another method of my MainWindow class:

    void MainWindow::add_profile(const Profile* profile)
        //          ^^^    error here: no matching member function for call to 'setParent'
        // stuff

    Any suggestions?


  • Lifetime Qt Champion

    setParent() is not a const function so don't pass a const pointer.

Log in to reply