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. Getting the screen size of an android virtual device

Getting the screen size of an android virtual device

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 411 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.
  • T Offline
    T Offline
    Treazy
    wrote on last edited by A Former User
    #1

    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
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved