Important: Please read the Qt Code of Conduct -

How to use an object created in the UI Designer

  • This could be a stupid question to ask...

    I have an application that mounts onto a QFrame to be displayed on screen, I want to add a Frame onto a Form and display my application on it.

    // QFrame* MainFrame = new QFrame;
    // MainFrame->setWindowTitle("Sugarscape");
    // MainFrame->resize(400, 400);
    // MainFrame->show();

    // Create a SFML view inside the main frame
    // Sugarscape* SFMLView = new Sugarscape(MainFrame, QPoint(20, 20), QSize(360, 360));
    // SFMLView->show();

    The above code I'm creating explicitly in my main, but I want to create one using the form, but don't know how to access the objects reference. (can only access the slots for resize, setWindowTitle, destroyed etc)

    e.g... but for the actual frame in ClassName class

    ClassName::On_MainFrame_setWindowTitle(QString &title)


  • usually UI objects created in designer are accessible using ui variable. for example ui->form. Not sure if thats what you want.

  • Thank you.

Log in to reply