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. Loading different classes in same window
QtWS25 Last Chance

Loading different classes in same window

Scheduled Pinned Locked Moved Unsolved General and Desktop
c++qmainwindowqtdesignermainwindow
7 Posts 2 Posters 2.7k Views
  • 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.
  • ronyNSR Offline
    ronyNSR Offline
    ronyNS
    wrote on last edited by
    #1

    Hello ,
    I was wondering if there is a way to load different ui in the same MainWindow.
    Take for eg . chrome browser . The MainWindow i.e the toolbar , menubar ,etc does not change. Only the data inside the mainwindow changes.
    Is there a way to include all classes in one mainwindow and then show different classes on different events in the mainwindow.
    The way i know is to add another window and then show that window from the mainwindow.
    I hope you got what i'm trying to say.
    Thanks.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Do you mean something like the QStackedLayout or its friend the QStackedWidget?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      ronyNSR 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        Do you mean something like the QStackedLayout or its friend the QStackedWidget?

        ronyNSR Offline
        ronyNSR Offline
        ronyNS
        wrote on last edited by
        #3

        @SGaist

        I don't think stack widgets will help.
        I need an entire ui . Not just a widget.
        eg .
        When i click login button in a login form.
        The form should load into another form.
        The only thing is it should not open a new window.
        It should load in the same mainwindow.
        Thank you.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          So basically you have LoginWidget -> successful login -> PresentationWidget and all in a QMainWindow, right ?

          If so you can put both LoginWidget and PresentationWidget in a QStackedWidget and use that QStackedWidget as central widget of your QMainWindow.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          ronyNSR 1 Reply Last reply
          0
          • SGaistS SGaist

            So basically you have LoginWidget -> successful login -> PresentationWidget and all in a QMainWindow, right ?

            If so you can put both LoginWidget and PresentationWidget in a QStackedWidget and use that QStackedWidget as central widget of your QMainWindow.

            ronyNSR Offline
            ronyNSR Offline
            ronyNS
            wrote on last edited by
            #5

            @SGaist
            Yes exactly ,
            The question is how do i put the login widget and presentation widget in QStackedwidget
            Where do i declare QStackedwidget and how to include the 2 mainwindows.
            Sorry for this but i searched and i'm only getting answers for a single stacked widget.
            Thank you.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Because there's no need for two QStackedwidget. Use one in which you put both your other widgets. Also it looks like you are trying to base all your widgets on QMainWindow. Although possible, that usually doesn't make sense.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              ronyNSR 1 Reply Last reply
              1
              • SGaistS SGaist

                Because there's no need for two QStackedwidget. Use one in which you put both your other widgets. Also it looks like you are trying to base all your widgets on QMainWindow. Although possible, that usually doesn't make sense.

                ronyNSR Offline
                ronyNSR Offline
                ronyNS
                wrote on last edited by
                #7

                @SGaist
                I just want 1 window with the forms changing for the login and presentation windows.
                And then ill use dialog windows after the presentation window.
                Anyways thank you. Ill try QStackedWidget.

                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