Pop-up window with widgets using QT Creator

  • I am trying to create a window. I don't know if it's proper name is a pop-up window or a secondary (not main) window. I want a window to display when the user selects "setup" from the pull-down menu. On this window, I want widgets to set things like the default directory for data, user name, etc. This will require user input.

    The best example I can find to describe it is in Qt Creator (2.6.2) itself. Go to Tools -> Options.

    I have the following, which displays a pop-up window; but I don't know how to add the widgets. All my window/screen development has been through the "Design" function in Creator.

    QWidget *popup = new QWidget();

  • Lifetime Qt Champion


    Replace QWidget with your designer made widget or if you have a more complex setup like Qt Creator's option. Create one custom widget that contains and handle the others.

    Hope it helps

  • Hello there! I know of two ways for this:

    1 Read the Demos' documentation and code in order to figure out how to build windows by coding; you will get familiar with the processes of creating layouts, buttons, labels and more. Though this provides huge liberty to build your interface, you may find that a lot of time will be consumed by using this method.

    2 Add a new class to your project, which inherits from QWidget and includes a ui designer form. Then use the Designer as you are used to, and finally, include your class's header in your main window header, and create a pointer to it like MyPopUpWindow* popUp; Finally, create and instantiate it with

    @MyPopUpWindow* popUp= new MyPopUpWindow();

    And that would be all... By the way, I'm assuming you're using C++.

Log in to reply

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