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. How does the UI have different user display modes
Qt 6.11 is out! See what's new in the release blog

How does the UI have different user display modes

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 2 Posters 894 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.
  • tovaxT Offline
    tovaxT Offline
    tovax
    wrote on last edited by
    #1

    Hi, all
    I want to design some UIs for different users. Here is a simple example that can be switched by hiding some widgets. But there are also some relatively more complex UIs, which must be re-layout to achieve good results. I read some docs of qstackedwidget/qstacklayout, they are suitable for multiple pages, my UI is actually just one page.
    My idea is to create 2 layouts: normalLayout and superLayout, when the toggle button is clicked:
    for super mode:
    (1) clear normalLayout
    (2) re-layout superLayout
    (3) this->setLayout(superLayout)
    for normal mode:
    (1) clear superLayout
    (2) re-layout normalLayout
    (3) this->setLayout(normalLayout)
    I don’t know if this is too complicated. Could you give me some suggestions please?
    Best regards!

    Normal mode:
    alt text
    Super mode:
    alt text

    J.HilkJ 1 Reply Last reply
    0
    • tovaxT tovax

      Hi, all
      I want to design some UIs for different users. Here is a simple example that can be switched by hiding some widgets. But there are also some relatively more complex UIs, which must be re-layout to achieve good results. I read some docs of qstackedwidget/qstacklayout, they are suitable for multiple pages, my UI is actually just one page.
      My idea is to create 2 layouts: normalLayout and superLayout, when the toggle button is clicked:
      for super mode:
      (1) clear normalLayout
      (2) re-layout superLayout
      (3) this->setLayout(superLayout)
      for normal mode:
      (1) clear superLayout
      (2) re-layout normalLayout
      (3) this->setLayout(normalLayout)
      I don’t know if this is too complicated. Could you give me some suggestions please?
      Best regards!

      Normal mode:
      alt text
      Super mode:
      alt text

      J.HilkJ Online
      J.HilkJ Online
      J.Hilk
      Moderators
      wrote on last edited by
      #2

      @tovax this sounds like a case for object inheritance

      make a base class with the normal mode,

      make a supermode class, that has the normal mode as base, and extend that.

      You won't be able to use the ygwys Designer effectively(at all) for the super class, so keep that in mind


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      tovaxT 2 Replies Last reply
      3
      • J.HilkJ J.Hilk

        @tovax this sounds like a case for object inheritance

        make a base class with the normal mode,

        make a supermode class, that has the normal mode as base, and extend that.

        You won't be able to use the ygwys Designer effectively(at all) for the super class, so keep that in mind

        tovaxT Offline
        tovaxT Offline
        tovax
        wrote on last edited by
        #3

        @J-Hilk Hi, thank you very much for your answer! According to your advice on inheritance, I wrote NormalModeClass, which is inherited by SuperModeClass.
        You won't be able to use the ygwys Designer effectively(at all) for the super class, so keep that in mind. This sentence is very useful to me, thanks again.

        1 Reply Last reply
        0
        • J.HilkJ J.Hilk

          @tovax this sounds like a case for object inheritance

          make a base class with the normal mode,

          make a supermode class, that has the normal mode as base, and extend that.

          You won't be able to use the ygwys Designer effectively(at all) for the super class, so keep that in mind

          tovaxT Offline
          tovaxT Offline
          tovax
          wrote on last edited by
          #4

          @J-Hilk
          Excuse me, the parent class already has a layout, how to re-layout the child class?

          J.HilkJ 1 Reply Last reply
          0
          • tovaxT tovax

            @J-Hilk
            Excuse me, the parent class already has a layout, how to re-layout the child class?

            J.HilkJ Online
            J.HilkJ Online
            J.Hilk
            Moderators
            wrote on last edited by
            #5

            @tovax you fetch the layout from the base class, you may want to add a function for that, and add your child layout to the original one, as additional components,

            would my idea be


            Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


            Q: What's that?
            A: It's blue light.
            Q: What does it do?
            A: It turns blue.

            tovaxT 1 Reply Last reply
            1
            • J.HilkJ J.Hilk

              @tovax you fetch the layout from the base class, you may want to add a function for that, and add your child layout to the original one, as additional components,

              would my idea be

              tovaxT Offline
              tovaxT Offline
              tovax
              wrote on last edited by
              #6

              @J-Hilk Thank you for your patience , your idea solved my question.

              1 Reply Last reply
              1

              • Login

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