Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.15.2, 6.3.1
-
None
Description
When putting a QWidget with a QHBoxLayout and subwidgets into a QHBoxLayout, the baseline for the subwidgets is messed up (macOS).
E.g.
#include <QApplication> #include <QComboBox> #include <QHBoxLayout> #include <QLineEdit> #include <QPushButton> #include <QVBoxLayout> template<typename T> QHBoxLayout *addRow() { auto widget = new QWidget; auto layout = new QHBoxLayout; auto control = new T; layout->setContentsMargins(0, 0, 0, 0); layout->addWidget(control); layout->addWidget(new QPushButton("Push")); widget->setLayout(layout); auto row = new QHBoxLayout; row->setContentsMargins(0, 0, 0, 0); row->addWidget(new QPushButton("Push")); row->addWidget(widget); row->addWidget(new QPushButton("Push")); return row; } int main(int argc, char *argv[]) { QApplication a(argc, argv); QWidget mainWidget; auto vlayout = new QVBoxLayout; mainWidget.setLayout(vlayout); vlayout->addLayout(addRow<QLineEdit>()); vlayout->addLayout(addRow<QComboBox>()); mainWidget.show(); return a.exec(); }
see screenshot