Details
-
Bug
-
Resolution: Invalid
-
P3: Somewhat important
-
None
-
5.15.0 RC2
-
None
Description
The documentation for LayoutDirection says this:
https://doc.qt.io/qt-5/qwidget.html#layoutDirection-prop
says this:
By default, this property is set to Qt::LeftToRight.
As such, in the following program:
#include <QApplication> #include <QHBoxLayout> #include <QPushButton> #include <QMainWindow> int main(int argc, char *argv[]) { QApplication a(argc, argv); QMainWindow *window = new QMainWindow; window->setLayoutDirection( Qt::LeftToRight ); // This line shouldn't make a difference QWidget *widget = new QWidget; QPushButton *button1 = new QPushButton("One"); QPushButton *button2 = new QPushButton("Two"); QPushButton *button3 = new QPushButton("Three"); QPushButton *button4 = new QPushButton("Four"); QPushButton *button5 = new QPushButton("Five"); QHBoxLayout *layout = new QHBoxLayout; layout->addWidget(button1); layout->addWidget(button2); layout->addWidget(button3); layout->addWidget(button4); layout->addWidget(button5); widget->setLayout(layout); window->setCentralWidget(widget); window->show(); return a.exec(); }
The setLayoutDirection line should not make any difference. The truth is, however, that it does. If I call it, the program does not automatically mirror.
I'm not sure what the correct fix is, but the documentation as it currently stands does not reflect what's actually going on.