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

Quadratic QFrame becomes rectangular on iPhones with a home button

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.14.0
    • Widgets: Layout
    • None
    • iOS/tvOS/watchOS

    Description

      **Hi, I use some QFrames in my iPhone widgets app, and I notice that sometimes the geometry for them is distorted.

      Steps to reproduce: make a new, empty vanilla Widget app. Then change your mainwindow.cpp to look like this:

      #include "mainwindow.h"
      #include "ui_mainwindow.h"
      #include "qtimer.h"
      #include "qframe.h"
      
      MainWindow::MainWindow(QWidget *parent)
          : QMainWindow(parent)
          , ui(new Ui::MainWindow)
      {
          ui->setupUi(this);
      
          QTimer::singleShot(0,[this]
          {
              auto f1 = new QFrame(this);
              f1->setGeometry(100,100,100,100);
              f1->setFrameShape(QFrame::Box);
              f1->show();
      
              auto f2 = new QFrame(this);
              f2->setFrameShape(QFrame::Box);
              f2->setGeometry(110,110,100,100);
              f2->show();
          });
      }
      
      MainWindow::~MainWindow()
      {
          delete ui;
      }
      

      Then run the app on an iPhone. See the screenshot: if you run it on an iPhone without a home button, you'll get the result on the left. But if you run it on an iPhone with a home button, you'll get the result on the right.

      If I change the code so that  f2->setGeometry() occurs before f2->setFrameShape(), i.e. the same order as for the f1 QFrame, then all iPhones, even those with a home button look ok (both QFrames are quadratic).

      If I comment out the QTimer so that the QFrames are constructed directly in MainWindow's ctor (and not in the lambda), then all iPhones, even those with a home button look ok (both QFrames are quadratic).

      If this is a feature: I cannot find any documentation about QFrames having to be initialized in the order: first set the geometry, then the shape. Please fix the documentation.

      Attachments

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

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            hskoglund Henry Skoglund
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes