QUiLoader and ignored dynamic properties
- by Googie
I'm loading the .ui file, where one of the widgets (QComboBox) has a dynamic property (http://qt-project.org/doc/qt-5/properties.html#dynamic-properties). The UI file looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PopulateScriptConfig</class>
<widget class="QWidget" name="PopulateScriptConfig">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="langGroup">
<property name="title">
<string>Language</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QComboBox" name="langCombo">
<property name="ScriptingLangCombo" stdset="0">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="codeGroup">
<property name="title">
<string>Implementation</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QPlainTextEdit" name="codeEdit"/>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
The important part is:
<widget class="QComboBox" name="langCombo">
<property name="ScriptingLangCombo" stdset="0">
<bool>true</bool>
</property>
</widget>
I'm loading the file with QUiLoader::load(). Note, that I have extended the QUiLoader class, but only to access createWidget() method, where I can query each widget like this:
QWidget* UiLoader::createWidget(const QString& className, QWidget* parent, const QString& name)
{
QWidget* w = QUiLoader::createWidget(className, parent, name);
qDebug() << w->dynamicPropertyNames();
return w;
}
As a result I see empty list displayed, so it seems like the dynamic property is completly ignored.
Any ideas?
P.S. I've made sure that I load correct file. 3 times.