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. Qt Android Problem with sizes
Forum Updated to NodeBB v4.3 + New Features

Qt Android Problem with sizes

Scheduled Pinned Locked Moved Mobile and Embedded
10 Posts 8 Posters 3.2k 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.
  • M Offline
    M Offline
    Milania
    wrote on last edited by
    #1

    Hello,

    I have a general problem with sizes for my qt application (Qt 5.3, normal Qt Android app, not QtQuick). The main problem is that many widgets are cutted to the right.
    The application has one mainwindow with a stackwidget which holds the several other screens. The size policies are mainly set to Prefered or Expanding.

    I am running out of idea and can't really see a system behind all this so I thought I could ask, maybe there is someone who has a idea what I am doing wrong.

    Here is a picture of how it lookes like at the moment
    !http://files.milania.de/AndroidSizes.jpg!

    And that is the way it looks on the desktop (and the way it should look)
    !http://files.milania.de/AndroidSizesCorrect.jpg!

    So any thoughts on this issue are welcome :-)

    best regards

    Milania

    1 Reply Last reply
    0
    • S Offline
      S Offline
      Sanchir Kartiev
      wrote on last edited by
      #2

      Hello! I think so size must be set by percentage (not a px).

      1 Reply Last reply
      0
      • tomasz3dkT Offline
        tomasz3dkT Offline
        tomasz3dk
        wrote on last edited by
        #3

        Have you used layouts?

        1 Reply Last reply
        0
        • M Offline
          M Offline
          Milania
          wrote on last edited by
          #4

          Hey, thanks for your replies.

          @sanchkart I am not sure what you mean by "so"-size. Where do I have the possibility to set sizes in percentage?

          @diabolic yes, the widgets in the stack are subclasses of QWidget and do have layouts.
          In the main window, where the stack widget is located, are just references to these subclasses and the places in the stack widget are empty and therefore have no layouts (and can't be set). But this shouldn't be a problem, becouse the layout is set to the subclass widget.

          There is also the strange behavior (even on desktop) that the size of the window increases when I switch to the window with the questions (as shown above). This is weird because there is no reason for the window to get bigger. As you can see in the screenshots, there is a lot of space between the "0" and the question and I can't even get this minimalized manually (both labels do have a Preferred size policy).

          1 Reply Last reply
          0
          • Z Offline
            Z Offline
            zhouxiang
            wrote on last edited by
            #5

            use layout,you will no the program,

            1 Reply Last reply
            0
            • M Offline
              M Offline
              Milania
              wrote on last edited by
              #6

              I am not sure how to do that.
              The widget itself already has a layout and the widget ist placed as a user defined subclass in the stack widget.

              If I try to force an additional layout I get something like
              @QLayout: Attempting to add QLayout "" to SpielFenster "spielFenster", which already has a layout@

              I also tried to put an extra widget in the page of the stack widget with layout (with the inner widget as user defined subclass) but it also doesn't helped.

              EDIT
              I think I found the source of the problem: Over the stack widget is another widget (the home button as seen on the desktop screen). It is a horizontal spacer and a QPushButton together in a vertical layout. If I disable that everything fits in the window.

              So the question is, why these widgets causes the window to get so big.

              The homeButton is first shown when the question dialog comes up, so maybe the window needs to be resized again? Is there a way to tell qt to resize and pack the window manually?

              1 Reply Last reply
              0
              • GianlucaG Offline
                GianlucaG Offline
                Gianluca
                wrote on last edited by
                #7

                From what I can guess, you are making some mistakes on using layouts.
                Post some portion of your code to let us view as you are layout the widget, so we can see if there is something wrong.

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  adutzu89
                  wrote on last edited by
                  #8

                  Sorry for my post, it was about something that was already done.

                  1 Reply Last reply
                  0
                  • T Offline
                    T Offline
                    topocc
                    wrote on last edited by
                    #9

                    #if Q_OS_ANDROID
                    w.showMaximized()
                    #ifdef

                    1 Reply Last reply
                    0
                    • T Offline
                      T Offline
                      tanthinh1510
                      wrote on last edited by
                      #10

                      I think you get screen available device. After that, you layout follow scale just get.

                      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