Generate QVariant::fromValue(enum_value) for enum values
Instead of just QVariant(enum_value). Task-number: QTBUG-49383 Change-Id: Id57c65b68d4328816046bc35301dc6afba47b727 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
This commit is contained in:
parent
7d374b7ba6
commit
cb24903ef4
@ -1267,7 +1267,10 @@ void WriteInitialization::writeProperties(const QString &varName,
|
|||||||
} else {
|
} else {
|
||||||
setFunction = QLatin1String("->setProperty(\"");
|
setFunction = QLatin1String("->setProperty(\"");
|
||||||
setFunction += propertyName;
|
setFunction += propertyName;
|
||||||
setFunction += QLatin1String("\", QVariant(");
|
setFunction += QLatin1String("\", QVariant");
|
||||||
|
if (p->kind() == DomProperty::Enum)
|
||||||
|
setFunction += QLatin1String("::fromValue");
|
||||||
|
setFunction += QLatin1Char('(');
|
||||||
}
|
}
|
||||||
|
|
||||||
QString varNewName = varName;
|
QString varNewName = varName;
|
||||||
|
39
tests/auto/tools/uic/baseline/enumnostdset.ui
Normal file
39
tests/auto/tools/uic/baseline/enumnostdset.ui
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>Form</class>
|
||||||
|
<widget class="QWidget" name="Form">
|
||||||
|
<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>
|
||||||
|
<widget class="WorldTimeClock" name="worldTimeClock">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>100</x>
|
||||||
|
<y>100</y>
|
||||||
|
<width>100</width>
|
||||||
|
<height>100</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="penStyle" stdset="0">
|
||||||
|
<enum>Qt::DashDotLine</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>WorldTimeClock</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header>worldtimeclock.h</header>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
55
tests/auto/tools/uic/baseline/enumnostdset.ui.h
Normal file
55
tests/auto/tools/uic/baseline/enumnostdset.ui.h
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
/********************************************************************************
|
||||||
|
** Form generated from reading UI file 'enumnostdset.ui'
|
||||||
|
**
|
||||||
|
** Created by: Qt User Interface Compiler version 5.6.1
|
||||||
|
**
|
||||||
|
** WARNING! All changes made in this file will be lost when recompiling UI file!
|
||||||
|
********************************************************************************/
|
||||||
|
|
||||||
|
#ifndef ENUMNOSTDSET_H
|
||||||
|
#define ENUMNOSTDSET_H
|
||||||
|
|
||||||
|
#include <QtCore/QVariant>
|
||||||
|
#include <QtWidgets/QAction>
|
||||||
|
#include <QtWidgets/QApplication>
|
||||||
|
#include <QtWidgets/QButtonGroup>
|
||||||
|
#include <QtWidgets/QHeaderView>
|
||||||
|
#include <QtWidgets/QWidget>
|
||||||
|
#include "worldtimeclock.h"
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
class Ui_Form
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
WorldTimeClock *worldTimeClock;
|
||||||
|
|
||||||
|
void setupUi(QWidget *Form)
|
||||||
|
{
|
||||||
|
if (Form->objectName().isEmpty())
|
||||||
|
Form->setObjectName(QStringLiteral("Form"));
|
||||||
|
Form->resize(400, 300);
|
||||||
|
worldTimeClock = new WorldTimeClock(Form);
|
||||||
|
worldTimeClock->setObjectName(QStringLiteral("worldTimeClock"));
|
||||||
|
worldTimeClock->setGeometry(QRect(100, 100, 100, 100));
|
||||||
|
worldTimeClock->setProperty("penStyle", QVariant::fromValue(Qt::DashDotLine));
|
||||||
|
|
||||||
|
retranslateUi(Form);
|
||||||
|
|
||||||
|
QMetaObject::connectSlotsByName(Form);
|
||||||
|
} // setupUi
|
||||||
|
|
||||||
|
void retranslateUi(QWidget *Form)
|
||||||
|
{
|
||||||
|
Form->setWindowTitle(QApplication::translate("Form", "Form", 0));
|
||||||
|
} // retranslateUi
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class Form: public Ui_Form {};
|
||||||
|
} // namespace Ui
|
||||||
|
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif // ENUMNOSTDSET_H
|
Loading…
x
Reference in New Issue
Block a user