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. Main Window resizing
Qt 6.11 is out! See what's new in the release blog

Main Window resizing

Scheduled Pinned Locked Moved General and Desktop
7 Posts 4 Posters 1.9k Views 1 Watching
  • 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.
  • T Offline
    T Offline
    tesmai4
    wrote on last edited by
    #1

    I developed my application interface using QT. I have different QWidget in my interface.
    How can I set it fit in different screen sizes?

    1 Reply Last reply
    0
    • Q Offline
      Q Offline
      qxoz
      wrote on last edited by
      #2

      With layouts "http://qt-project.org/doc/qt-4.8/qlayout.html":http://qt-project.org/doc/qt-4.8/qlayout.html

      1 Reply Last reply
      0
      • S Offline
        S Offline
        Santosh Reddy
        wrote on last edited by
        #3

        May be just use showMaximized() the main widget (or MainWindow), it will fit to the screen (any screen size)

        SS

        1 Reply Last reply
        0
        • T Offline
          T Offline
          tesmai4
          wrote on last edited by
          #4

          Thanks Santosh for your reply.
          I have two screen one in landscape mode and other in portrait mode.
          showMaximized() works for landscape screen, however, layout is destroyed on the portrait screen.
          How can I tackle these varying size and orientation screen issues?

          1 Reply Last reply
          0
          • S Offline
            S Offline
            Santosh Reddy
            wrote on last edited by
            #5

            It is not possible to have same layout in both, in most cases applications with such requirements end up implementing different layout for landscape, and a different layout for portrait.

            SS

            1 Reply Last reply
            0
            • T Offline
              T Offline
              tesmai4
              wrote on last edited by
              #6

              Thanks for reply. I appreciate it.

              can you elaborate a bit on this point? How will I detect different screen sizes and how will my app switch from one layout to other and vice verse?

              I have already grouped my widgets into different horizontal and vertical layout. How will I add different layout to my main window?

              1 Reply Last reply
              0
              • T Offline
                T Offline
                tzander
                wrote on last edited by
                #7

                For this kind of requirement we have QML, since just repositioning widgets doesn't give you a good result.

                Either way, what you can do to detect orientation is related to which platform we are talking about, but a simple way is to use QDesktopWidget (via the static method QApplication::desktop()).

                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