Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.3.2, 5.6.1
-
None
-
385ab06fb1d99322872dc84f0e077886a917b9a7
Description
To reproduce, in Designer mode of QtCreator:
1. Add Spacer (Vertical or Horizontal) onto some widget with layout.
2. Reset sizeHint to default in properties panel
It will generate code like this:
<item> <spacer name="horizontalSpacer"> <property name="orientation"> <enum>Qt::Horizontal</enum> </property> </spacer> </item>
Compiling this code with uic will generate compilable, but incorrect C++ code, which will lead to incorrect Spacer behavior:
horizontalSpacer = new QSpacerItem(QSizePolicy::Expanding, QSizePolicy::Minimum);
QSpacerItem constructor signature is:
QSpacerItem(int w, int h, QSizePolicy::Policy hData = QSizePolicy::Minimum, QSizePolicy::Policy vData = QSizePolicy::Minimum);
So, in generated C++ code two actual QSizePolicy arguments will be implicitly cast to int, and used as width and height, while formal hData and wData will silently get default values. It's incorrect of course.