Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.14.0
-
None
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.