Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Solved]Get the size of the screen

[Solved]Get the size of the screen

Scheduled Pinned Locked Moved General and Desktop
4 Posts 4 Posters 1.1k 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.
  • I Offline
    I Offline
    isaacEnrique
    wrote on last edited by
    #1

    Greetings.

    I wanted to know as I can, from my program code, get the size or resolution of the screen. I need that information to adapt the size of some widgets based on the size of the screen, so that is always displayed correctly, regardless of the application running on machines with different screen sizes.

    I guess there must be some sort and / or function to obtain this information, but have not given to her.

    Thanks in advance for any help and / or suggestions.

    Isaac Pérez
    Programming is understanding.

    1 Reply Last reply
    0
    • L Offline
      L Offline
      leon.anavi
      wrote on last edited by
      #2

      You can obtain the screen size using "an instance of class QDesktopWidget":http://qt-project.org/doc/qt-5.0/qtwidgets/qdesktopwidget.html obtained through method "desktop of class QApplication":http://qt-project.org/doc/qt-5.0/qtwidgets/qapplication.html#desktop. For example:

      @
      QRect rect = QApplication::desktop()->rect();
      @

      http://anavi.org/

      1 Reply Last reply
      0
      • R Offline
        R Offline
        Rahul Das
        wrote on last edited by
        #3

        QDesktopWidget::screenGeometry


        Declaration of (Platform) independence.

        1 Reply Last reply
        0
        • musimbateM Offline
          musimbateM Offline
          musimbate
          wrote on last edited by
          #4

          Hi,
          Using QLayout makes sure that your widgets are displayed correctly everywhere.

          Why join the navy if you can be a pirate?-Steve Jobs

          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