Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Differents screens size.
QtWS25 Last Chance

Differents screens size.

Scheduled Pinned Locked Moved Solved QML and Qt Quick
9 Posts 5 Posters 2.0k 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.
  • P Offline
    P Offline
    patcs
    wrote on last edited by
    #1

    Hi to everyone,
    I'm developing a simple user interface like a form, my problem is like I want to the program fits with the pixels of the screen, I mean, I want to my program have the elements in the same place, and don't desappear any widget depending on the size of the screen.

    someone knows how can I do it?

    Thanksss!!

    1 Reply Last reply
    0
    • P Offline
      P Offline
      patcs
      wrote on last edited by patcs
      #2

      I forgot to say that my program has been developed in QtCreator so I had a lot of widgets and when I change the resolution of the screen like for example Table or Iphone, some widgets were detaching.

      1 Reply Last reply
      0
      • P Offline
        P Offline
        patcs
        wrote on last edited by
        #3

        Someone could help me, please?

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

          Hi,

          Something is not clear, are you using QtQuick for your interface or QWidget ? The content of your original post and the sub-forum you posted in don't match.

          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
          1
          • Vinod KuntojiV Offline
            Vinod KuntojiV Offline
            Vinod Kuntoji
            wrote on last edited by
            #5

            @patcs ,

            Dont give the fixed size to any widgets. Use setMinimumSize for the widgets.
            To get the screen size, You can use the QDesktopWidget,

            QRect rec = QApplication::desktop()->screenGeometry();
            height = rec.height();
            width = rec.width();

            C++, Qt, Qt Quick Developer,
            PthinkS, Bangalore

            1 Reply Last reply
            2
            • Pradeep KumarP Offline
              Pradeep KumarP Offline
              Pradeep Kumar
              wrote on last edited by
              #6

              Hi,

              @patcs

              adding to @Vinod-Kuntoji ,
              u can also use qApp global pointer,

              QRect m_ScreenSize = qApp->primaryScreen()->geometry();
              int width = m_ScreenSize.width();
              int height = m_ScreenSize.height();

              so u can use width and height throughout ur classes .
              And will be fit for all platforms,

              Thanks,

              Pradeep Kumar
              Qt,QML Developer

              N 1 Reply Last reply
              3
              • P Offline
                P Offline
                patcs
                wrote on last edited by
                #7

                I fixed it with layouts! But thank you a lot.

                N 1 Reply Last reply
                1
                • Pradeep KumarP Pradeep Kumar

                  Hi,

                  @patcs

                  adding to @Vinod-Kuntoji ,
                  u can also use qApp global pointer,

                  QRect m_ScreenSize = qApp->primaryScreen()->geometry();
                  int width = m_ScreenSize.width();
                  int height = m_ScreenSize.height();

                  so u can use width and height throughout ur classes .
                  And will be fit for all platforms,

                  Thanks,

                  N Offline
                  N Offline
                  NTMS
                  wrote on last edited by
                  #8

                  @Pradeep-Kumar thanks for info. How to use your code in QML for mobile app development?

                  QRect m_ScreenSize = qApp->primaryScreen()->geometry();
                  int width = m_ScreenSize.width();
                  int height = m_ScreenSize.height();

                  1 Reply Last reply
                  0
                  • P patcs

                    I fixed it with layouts! But thank you a lot.

                    N Offline
                    N Offline
                    NTMS
                    wrote on last edited by
                    #9

                    @patcs Did you use layout for qml? Could it be possible share your code? thanks

                    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