Applying New UI Overtop the Existing Main Window



  • This is a bit of a newbe question: How do you apply a new UI overtop the existing mainwindow?

    If I create a new form (newform.ui). Then on a button press, create a new instance
    @NewForm nf = new NewForm();@

    then initiate the new form:
    @nf.show(); @

    The new form opens in a new window and not the overtop the mainwindow. I take it that I have to somehow replace the existing form, but I am not too sure how?

    Thanks for any help,
    Harold Clements


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    What exactly are you trying to achieve with NewForm ?



  • Thank you for your reply,

    At the moment, I am getting a new window with a title bar, that can be moved around the screen, with the parent form being visible under the new. I want to be able to have only one windows who's content changes and no new windows.

    I hope that makes sense!

    I think I need to create a widget rather than a form... but I am not too sure...

    Thanks again,
    Harold Clements



  • OK, found it. I need to setCentralWidget with my new form...

    Thanks again,
    Harold Clements


  • Lifetime Qt Champion

    Depending on what you'll be doing a QStackedWidget as central widget will be more suited


Log in to reply
 

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