Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Rescale the mainwindow and its contents to fit in different screens

    Mobile and Embedded
    2
    8
    1632
    Loading More Posts
    • 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
      AmirKh last edited by

      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 Reply Quote 0
      • A
        AmirKh last edited by

        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 Reply Quote 0
        • SGaist
          SGaist Lifetime Qt Champion last edited by

          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 Reply Quote 0
          • A
            AmirKh last edited by

            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 Reply Quote 0
            • SGaist
              SGaist Lifetime Qt Champion last edited by

              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 Reply Quote 0
              • A
                AmirKh last edited by

                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 Reply Quote 0
                • A
                  AmirKh last edited by

                  I have removed all the layouts and spacers here.

                  1 Reply Last reply Reply Quote 0
                  • SGaist
                    SGaist Lifetime Qt Champion last edited by

                    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 Reply Quote 0
                    • First post
                      Last post