Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. My ui is desktop dependent,I want it to be desktop resolution independent.
Forum Updated to NodeBB v4.3 + New Features

My ui is desktop dependent,I want it to be desktop resolution independent.

Scheduled Pinned Locked Moved Solved Mobile and Embedded
11 Posts 2 Posters 1.9k 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.
  • S Offline
    S Offline
    Sherlin N G
    wrote on last edited by
    #1

    I have some group boxes and buttons in the ui.When the window is dragged some part of my ui gets sliced off (i.e screen is not getting compressed ).And when the same project is run on system with smaller resolution some widgets on the edge of the ui dont appear.I want my ui to be desktop resolution independent. I want my ui to compress or extend and "fit to screen" according to the resolution of the pc.Please suggest.

    jsulmJ 1 Reply Last reply
    0
    • S Sherlin N G

      I have some group boxes and buttons in the ui.When the window is dragged some part of my ui gets sliced off (i.e screen is not getting compressed ).And when the same project is run on system with smaller resolution some widgets on the edge of the ui dont appear.I want my ui to be desktop resolution independent. I want my ui to compress or extend and "fit to screen" according to the resolution of the pc.Please suggest.

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

      @Sherlin-N-G Use layouts: http://doc.qt.io/qt-5/layout.html

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

      1 Reply Last reply
      1
      • S Offline
        S Offline
        Sherlin N G
        wrote on last edited by
        #3

        @jsulm
        hi,
        so i have to code from scratch again?Please suggest any alternative if present

        jsulmJ 1 Reply Last reply
        0
        • S Sherlin N G

          @jsulm
          hi,
          so i have to code from scratch again?Please suggest any alternative if present

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

          @Sherlin-N-G You don't have to code from scratch, why do you think so? Just add layouts and put your widgets into these layouts. There is nothing special about layouts. The only alternative would be to arrange your widgets manually when resizing, but this is much more complex than simply using layouts.

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

          1 Reply Last reply
          2
          • S Offline
            S Offline
            Sherlin N G
            wrote on last edited by
            #5

            @jsulm
            Hi,
            I tried using layouts I've shared the screen shot0_1519277382342_layout1.png

            If above is my final form design.Below is my form "sliced-off" when dragged.
            0_1519277451374_layout2.png
            I want it to be compressed when dragged not sliced.Please suggest

            jsulmJ 1 Reply Last reply
            0
            • S Sherlin N G

              @jsulm
              Hi,
              I tried using layouts I've shared the screen shot0_1519277382342_layout1.png

              If above is my final form design.Below is my form "sliced-off" when dragged.
              0_1519277451374_layout2.png
              I want it to be compressed when dragged not sliced.Please suggest

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

              @Sherlin-N-G Well, it looks like you did not do it properly...
              Did you read the link I posted?
              Did you apply a layout to your main window?
              Did you check any layout examples?

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

              1 Reply Last reply
              0
              • S Offline
                S Offline
                Sherlin N G
                wrote on last edited by
                #7

                @jsulm I just dragged a layout and placed widgets on that in my mainwindow.ui form

                jsulmJ 2 Replies Last reply
                0
                • S Sherlin N G

                  @jsulm I just dragged a layout and placed widgets on that in my mainwindow.ui form

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

                  @Sherlin-N-G You really should read documentation/examples.
                  You apparently forgot to apply a layout to your main window.
                  And what layout did you use actually?
                  Can you show the screenshot of your main window in design mode?

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

                  1 Reply Last reply
                  0
                  • S Sherlin N G

                    @jsulm I just dragged a layout and placed widgets on that in my mainwindow.ui form

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

                    @Sherlin-N-G Take a look at this (for Qt 4.8, but it works same way in Qt 5): http://doc.qt.io/archives/qt-4.8/designer-layouts.html

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

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      Sherlin N G
                      wrote on last edited by
                      #10

                      @jsulm Below is the screenshot in design mode.0_1519278393504_designmode.png

                      jsulmJ 1 Reply Last reply
                      0
                      • S Sherlin N G

                        @jsulm Below is the screenshot in design mode.0_1519278393504_designmode.png

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

                        @Sherlin-N-G My assumption was correct: you did not apply a layout to your main window. Think about what you did and why it can't work as expected: you have two layouts containing buttons, line edit and radio button. But these layouts are just laying around on your main window and are not in any layout. So, how would Qt know how you want them to be organized? You need to put them into main window layout. Please read the last link I posted, especially "Setting A Top Level Layout" section.

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

                        1 Reply Last reply
                        3

                        • Login

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