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. Rescale the mainwindow and its contents to fit in different screens

Rescale the mainwindow and its contents to fit in different screens

Scheduled Pinned Locked Moved Mobile and Embedded
8 Posts 2 Posters 2.5k 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.
  • A Offline
    A Offline
    AmirKh
    wrote on last edited by
    #1

    Hi guys,

    I am new to Qt. I have developed an application using Qt widget Application. In Mainwindow class I have several tablewdigets and textEdit and etc. In my computer it looks good (since I have used the designer to create the GUI). However, I want to port my application to Android. Since the screen size is different, I just want to know, how I should scale the whole mainwindow and its contents to occupy X% and Y% of any screen? I know I can use QWdiget::resize() function to resize my mainwindow but as expected the contents of my mainwindow remain fixed after scaling, how can I change their sizes as well?

    Thanks a bunch.

    1 Reply Last reply
    0
    • A Offline
      A Offline
      AmirKh
      wrote on last edited by
      #2

      No reply for this? :( . I have been searching for the answer. It seems that its recommended to use Qt Quick Application or QML instead of Qt c++ codes. I am new to Qt and have created my projects using Qt Widget Application. Isn't that possible to somehow manage the issue without having to transfer all the codes to a new format?

      Thanks,

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        How are you setting up your widgets ? Through QVBoxLayout & QHBoxLayout ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • A Offline
          A Offline
          AmirKh
          wrote on last edited by
          #4

          Hi SGaist,

          Yes. I actually put lots of Vertical & Horizontal Spacer as well. But the whole windows are screwed! Any help is much appreciated!

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Lots of spacers ? What for ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • A Offline
              A Offline
              AmirKh
              wrote on last edited by
              #6

              OK, I have attached a snapshot of my project ui here. Maybe this can help more. Its a very simple design. Just couple of QTablewidgets and a Qlabel to show an Image...
              In my desktop computer I can see all the windows just fine. I would like to have the same abilities in android mobiles and tablets with different screen resolutions.

              Thanks SGaist,
              Amir

              "Your text to link here...":https://www.dropbox.com/s/1fkhv3ztvtjekjb/project_snapshot.png?dl=0

              1 Reply Last reply
              0
              • A Offline
                A Offline
                AmirKh
                wrote on last edited by
                #7

                I have removed all the layouts and spacers here.

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  Looks like a work for QGridLayout

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  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