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.
  • R Offline
    R Offline
    ronyNS
    wrote on 23 Aug 2016, 18:01 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
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 23 Aug 2016, 20:54 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

      R 1 Reply Last reply 24 Aug 2016, 06:58
      0
      • S SGaist
        23 Aug 2016, 20:54

        Hi,

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

        R Offline
        R Offline
        ronyNS
        wrote on 24 Aug 2016, 06:58 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
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 24 Aug 2016, 07:01 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

          R 1 Reply Last reply 24 Aug 2016, 07:17
          0
          • S SGaist
            24 Aug 2016, 07:01

            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.

            R Offline
            R Offline
            ronyNS
            wrote on 24 Aug 2016, 07:17 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
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 24 Aug 2016, 07:21 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

              R 1 Reply Last reply 24 Aug 2016, 07:30
              1
              • S SGaist
                24 Aug 2016, 07:21

                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.

                R Offline
                R Offline
                ronyNS
                wrote on 24 Aug 2016, 07:30 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

                7/7

                24 Aug 2016, 07:30

                • Login

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