Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-47581

Screen size returned in not correct

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P4: Low
    • None
    • 5.5.0
    • QPA
    • Android

    Description

      To my surprise, the following program draws a line which starts from top left hand corner of screen but never fully reaches the bottom right hand corner. i am trying this on an Android tablet.

      The reason is that the screen height is not correctly returned from the call "app.primaryScreen()->size();". See code below. This looks like a bug in Qt.

      #include <QApplication>
      #include <QGraphicsScene>
      #include <QGraphicsView>
      #include <QScreen>
      #include <QDesktopWidget>
      
      int main(int argc, char *argv[])
      {   QApplication app(argc, argv);
      
          QSize rec = app.primaryScreen()->size();
          int  height = rec.height();
          int  width = rec.width();
      
          QGraphicsScene scene;
      
          QGraphicsView view(&scene);
          view.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
          view.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
          view.setAlignment(Qt::AlignLeft | Qt::AlignTop);
          view.showFullScreen();
      
          scene.addLine(0, 0, width, height);
      
          return(app.exec());
      }
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            rampe Rami Potinkara
            squader7 Syed Quader
            Veli-Pekka Heinonen Veli-Pekka Heinonen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes