Qt Forum

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

    Forum Updated on Feb 6th

    Unsolved Getting the screen size of an android virtual device

    General and Desktop
    1
    1
    260
    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.
    • T
      Treazy last edited by A Former User

      All,

      'am running the following code snippet in Qt to get the screen size of my android virtual device.

      QApplication app(argc, argv);
       
       QDesktopWidget *mydesk = app.desktop();
          // redundant but using both showFullScreen and showMaximized...
          // ...just to play it safe
          mydesk->showMaximized();
          mydesk->showFullScreen(); 
      
        QScreen *screen = app.primaryScreen();
          int width = screen->size().width();
          int height = screen->size().height();
      

      I created a Nexus 5 Android Virtual Device with resolution 1080x1920 to test my code and my width and height values are 1080x1776 instead of the expected 1080x1920. What 'am I doing wrong here? Can someone please help me?

      Thanks

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