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. Working on multiple screen issue
QtWS25 Last Chance

Working on multiple screen issue

Scheduled Pinned Locked Moved Solved General and Desktop
12 Posts 3 Posters 731 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.
  • KiraK Offline
    KiraK Offline
    Kira
    wrote on last edited by
    #1

    Hello All,
    My problem is similar to the given issue.
    https://forum.qt.io/topic/56168/how-to-handle-multiple-screens-on-the-gui/4
    Currently, I am using stacked widgets, but I need to switch within the screen.
    There is a solution mentioned in the forum, is there an example referring the same
    or is there any other alternative solution since it was discussed long back.

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

      Hi
      The stacked widget approach is still the one to use for any design using a concept of "pages"

      For wizard like design, there is also
      https://doc.qt.io/qt-5/qwizard.html

      So what is the actual issue you have?

      KiraK 1 Reply Last reply
      2
      • mrjjM mrjj

        Hi
        The stacked widget approach is still the one to use for any design using a concept of "pages"

        For wizard like design, there is also
        https://doc.qt.io/qt-5/qwizard.html

        So what is the actual issue you have?

        KiraK Offline
        KiraK Offline
        Kira
        wrote on last edited by
        #3

        @mrjj: Thanks for the reply.
        Currently, I have a main window with a stack widget.
        I have inserted five widgets, ie. 5 pages of stacked widgets.
        Each widget has its own independent functionality.
        Now suppose there is a push button on page1 using which I have to call page4
        How this is possible?
        For example, the child widget won't have an idea about the parent widget.

        jsulmJ 1 Reply Last reply
        0
        • KiraK Kira

          @mrjj: Thanks for the reply.
          Currently, I have a main window with a stack widget.
          I have inserted five widgets, ie. 5 pages of stacked widgets.
          Each widget has its own independent functionality.
          Now suppose there is a push button on page1 using which I have to call page4
          How this is possible?
          For example, the child widget won't have an idea about the parent widget.

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

          @Kira said in Working on multiple screen issue:

          How this is possible?

          Connect the signal to a slot in the container widget (I guess MainWindow?) where you activate the page 4?

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

          KiraK 1 Reply Last reply
          2
          • jsulmJ jsulm

            @Kira said in Working on multiple screen issue:

            How this is possible?

            Connect the signal to a slot in the container widget (I guess MainWindow?) where you activate the page 4?

            KiraK Offline
            KiraK Offline
            Kira
            wrote on last edited by
            #5

            @jsulm: Ok thanks understood.
            I was referring to one of the comments mentioned by the moderator in the given link:
            https://forum.qt.io/topic/56168/how-to-handle-multiple-screens-on-the-gui/4
            "I would give it a generic addScreen(Screen) function and then load them at runtime. This way you would design main window and each screen separately in the designer keeping them nice and separate*."
            Any comments on that :)

            jsulmJ 1 Reply Last reply
            0
            • KiraK Kira

              @jsulm: Ok thanks understood.
              I was referring to one of the comments mentioned by the moderator in the given link:
              https://forum.qt.io/topic/56168/how-to-handle-multiple-screens-on-the-gui/4
              "I would give it a generic addScreen(Screen) function and then load them at runtime. This way you would design main window and each screen separately in the designer keeping them nice and separate*."
              Any comments on that :)

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

              @Kira That post refers to creating the widgets dynamically if I understand it correctly
              I'm still not sure about your exact use case: do you create the "screen" dynamically?

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

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

                Hi
                I think the other tread just talk about using full UI enabled widgets with .cpp and .h
                Just like MainWindow is. based on QWidget instead. ( as base class)

                That allows you to handle all functionality inside its .cpp file and not stuff all logic from pages into the mainwindow.

                So to allow such self-contained Widgets to change page you need to define some new signals pr page it can emit and then
                mainwin can do the page flipping. Or a small controller object if you wish to keep it really clean.

                KiraK 1 Reply Last reply
                2
                • mrjjM mrjj

                  Hi
                  I think the other tread just talk about using full UI enabled widgets with .cpp and .h
                  Just like MainWindow is. based on QWidget instead. ( as base class)

                  That allows you to handle all functionality inside its .cpp file and not stuff all logic from pages into the mainwindow.

                  So to allow such self-contained Widgets to change page you need to define some new signals pr page it can emit and then
                  mainwin can do the page flipping. Or a small controller object if you wish to keep it really clean.

                  KiraK Offline
                  KiraK Offline
                  Kira
                  wrote on last edited by
                  #8

                  @mrjj : Ok thanks :)

                  mrjjM 1 Reply Last reply
                  0
                  • KiraK Kira

                    @mrjj : Ok thanks :)

                    mrjjM Offline
                    mrjjM Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    @Kira

                    Ok so thats why he talks about addScreen(Screen) as if we use a custom Widget as the page then
                    we need to use promotion or insert via code.

                    If you need to be able to jump to random pages, from a page, i will recommend you use a tag name instead of the raw int index
                    as then inserting or remove pages later will not break the jumping.

                    KiraK 1 Reply Last reply
                    0
                    • mrjjM mrjj

                      @Kira

                      Ok so thats why he talks about addScreen(Screen) as if we use a custom Widget as the page then
                      we need to use promotion or insert via code.

                      If you need to be able to jump to random pages, from a page, i will recommend you use a tag name instead of the raw int index
                      as then inserting or remove pages later will not break the jumping.

                      KiraK Offline
                      KiraK Offline
                      Kira
                      wrote on last edited by
                      #10

                      @mrjj : Tag name?

                      mrjjM 1 Reply Last reply
                      0
                      • KiraK Kira

                        @mrjj : Tag name?

                        mrjjM Offline
                        mrjjM Offline
                        mrjj
                        Lifetime Qt Champion
                        wrote on last edited by mrjj
                        #11

                        @Kira

                        Well i mean - use a name instead of the raw index.

                        like
                        emit GotoPage( "EditPage" )
                        versus
                        emit GotoPage( 6 )

                        if you would ever change the flow or add new pages in the middle its nice
                        not to have to change all the index around the interface.

                        I used a dynamic property for this. you can also use Widget objectname

                        KiraK 1 Reply Last reply
                        0
                        • mrjjM mrjj

                          @Kira

                          Well i mean - use a name instead of the raw index.

                          like
                          emit GotoPage( "EditPage" )
                          versus
                          emit GotoPage( 6 )

                          if you would ever change the flow or add new pages in the middle its nice
                          not to have to change all the index around the interface.

                          I used a dynamic property for this. you can also use Widget objectname

                          KiraK Offline
                          KiraK Offline
                          Kira
                          wrote on last edited by
                          #12

                          @mrjj : Ohh sure thanks :)

                          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