Qt Forum

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

    Solved Differents screens size.

    QML and Qt Quick
    5
    9
    1548
    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.
    • P
      patcs last edited by

      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 Reply Quote 0
      • P
        patcs last edited by patcs

        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 Reply Quote 0
        • P
          patcs last edited by

          Someone could help me, please?

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

            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 Reply Quote 1
            • Vinod Kuntoji
              Vinod Kuntoji last edited by

              @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 Reply Quote 2
              • Pradeep Kumar
                Pradeep Kumar last edited by

                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 Reply Quote 3
                • P
                  patcs last edited by

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

                  N 1 Reply Last reply Reply Quote 1
                  • N
                    NTMS @Pradeep Kumar last edited by

                    @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 Reply Quote 0
                    • N
                      NTMS @patcs last edited by

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

                      1 Reply Last reply Reply Quote 0
                      • First post
                        Last post