Accessing objects inside form



  • so im a beginner in qt. my question is let's say i created something in the form of the qt gui application. how can i access that inside the c++ code ?



  • when you create a form using the qtcreator, it creates a matching class
    have a look at the ui pointer in that class

    for example i created a the form called MainWindow, QtCreator made a MainWindow class that contains a

    @Ui::MainWindow *ui;@

    to access a button that i created on MainWindow i can call:

    @ui->pb_myButton.setText("allo allo");@


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.