Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. A window with quickly changing forms
Qt 6.11 is out! See what's new in the release blog

A window with quickly changing forms

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 3 Posters 900 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mikee
    wrote on last edited by
    #1

    Hi.
    Me need window with quickly changing forms.
    In mainwindow.h :

    private:
        Ui::MainWindow *ui;
        Ui::MainWindow *ui2;
    

    In mainwindow.cpp :

    MainWindow::MainWindow(QWidget *parent) :
        QMainWindow(parent),
        ui(new Ui::MainWindow),
        ui2(new Ui::MainWindow)
    {
        ui->setupUi(this);
        NBar = 0;
        TimeFrame=1;
        ParametrForStrategyCod=10;
        //ui2=new Ui::MainWindow; 
        //ui3=new Ui::MainWindow;
    }
    

    The button is tied to the calling form:

    ui2->setupUi(this);
    

    But after that the buttons don't work.
    How to create and call a new window, or form in this class?

    jsulmJ 1 Reply Last reply
    0
    • M Mikee

      Hi.
      Me need window with quickly changing forms.
      In mainwindow.h :

      private:
          Ui::MainWindow *ui;
          Ui::MainWindow *ui2;
      

      In mainwindow.cpp :

      MainWindow::MainWindow(QWidget *parent) :
          QMainWindow(parent),
          ui(new Ui::MainWindow),
          ui2(new Ui::MainWindow)
      {
          ui->setupUi(this);
          NBar = 0;
          TimeFrame=1;
          ParametrForStrategyCod=10;
          //ui2=new Ui::MainWindow; 
          //ui3=new Ui::MainWindow;
      }
      

      The button is tied to the calling form:

      ui2->setupUi(this);
      

      But after that the buttons don't work.
      How to create and call a new window, or form in this class?

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by jsulm
      #2

      @Mikee Why do you use two MainWindows? Just create two widgets and switch between them. See http://doc.qt.io/qt-5.9/qmainwindow.html#setCentralWidget

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      4
      • mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi
        The http://doc.qt.io/qt-5/qstackedwidget.html
        is also good for such designs as it make it very easy to switch back and forth between
        "pages" containing any number of widgets.

        1 Reply Last reply
        4
        • M Offline
          M Offline
          Mikee
          wrote on last edited by
          #4

          thank you

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved