uic: Write fully qualified enumerations for cursors/icon pixmaps

Fixes: PYSIDE-2492
Change-Id: Ic2505628b0550654c109cf239b4f2390f03df623
Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
(cherry picked from commit b0325c799287a56837d7dd3b9eb40762107302be)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Friedemann Kleint 2024-04-15 13:27:27 +02:00 committed by Qt Cherry-pick Bot
parent 0aa3b32ad4
commit fe6e1c2191
4 changed files with 18 additions and 16 deletions

View File

@ -1393,8 +1393,8 @@ void WriteInitialization::writeProperties(const QString &varName,
case DomProperty::CursorShape:
if (p->hasAttributeStdset() && !p->attributeStdset())
varNewName += language::derefPointer + "viewport()"_L1;
propertyValue = "QCursor(Qt"_L1 + language::qualifier
+ p->elementCursorShape() + u')';
propertyValue = "QCursor(Qt"_L1 + language::qualifier + "CursorShape"_L1
+ language::qualifier + p->elementCursorShape() + u')';
break;
case DomProperty::Enum:
propertyValue = p->elementEnum();
@ -1708,8 +1708,9 @@ static void writeIconAddFile(QTextStream &output, const QString &indent,
{
output << indent << iconName << ".addFile("
<< language::qstring(fileName, indent) << ", QSize(), QIcon"
<< language::qualifier << mode << ", QIcon" << language::qualifier
<< state << ')' << language::eol;
<< language::qualifier << "Mode" << language::qualifier << mode
<< ", QIcon" << language::qualifier << "State" << language::qualifier << state
<< ')' << language::eol;
}
// Post 4.4 write resource icon
@ -1757,7 +1758,8 @@ static void writeIconAddPixmap(QTextStream &output, const QString &indent,
const char *mode, const char *state)
{
output << indent << iconName << ".addPixmap(" << call << ", QIcon"
<< language::qualifier << mode << ", QIcon" << language::qualifier
<< language::qualifier << "Mode" << language::qualifier << mode
<< ", QIcon" << language::qualifier << "State" << language::qualifier
<< state << ')' << language::eol;
}

View File

@ -38,7 +38,7 @@ public:
fileicon = new QPushButton(Form);
fileicon->setObjectName("fileicon");
QIcon icon;
icon.addFile(QString::fromUtf8("image1.png"), QSize(), QIcon::Normal, QIcon::Off);
icon.addFile(QString::fromUtf8("image1.png"), QSize(), QIcon::Mode::Normal, QIcon::State::Off);
fileicon->setIcon(icon);
verticalLayout->addWidget(fileicon);
@ -50,7 +50,7 @@ public:
if (QIcon::hasThemeIcon(iconThemeName)) {
icon1 = QIcon::fromTheme(iconThemeName);
} else {
icon1.addFile(QString::fromUtf8("image7.png"), QSize(), QIcon::Normal, QIcon::Off);
icon1.addFile(QString::fromUtf8("image7.png"), QSize(), QIcon::Mode::Normal, QIcon::State::Off);
}
fileandthemeicon->setIcon(icon1);
@ -76,7 +76,7 @@ public:
if (QIcon::hasThemeIcon(QIcon::ThemeIcon::EditCopy)) {
icon4 = QIcon::fromTheme(QIcon::ThemeIcon::EditCopy);
} else {
icon4.addFile(QString::fromUtf8("image7.png"), QSize(), QIcon::Normal, QIcon::Off);
icon4.addFile(QString::fromUtf8("image7.png"), QSize(), QIcon::Mode::Normal, QIcon::State::Off);
}
fileandthemeenum->setIcon(icon4);

View File

@ -55,7 +55,7 @@ public:
upButton->setObjectName("upButton");
upButton->setEnabled(false);
QIcon icon;
icon.addFile(QString::fromUtf8(":/images/up.png"), QSize(), QIcon::Normal, QIcon::Off);
icon.addFile(QString::fromUtf8(":/images/up.png"), QSize(), QIcon::Mode::Normal, QIcon::State::Off);
upButton->setIcon(icon);
hboxLayout->addWidget(upButton);
@ -64,7 +64,7 @@ public:
downButton->setObjectName("downButton");
downButton->setEnabled(false);
QIcon icon1;
icon1.addFile(QString::fromUtf8(":/images/down.png"), QSize(), QIcon::Normal, QIcon::Off);
icon1.addFile(QString::fromUtf8(":/images/down.png"), QSize(), QIcon::Mode::Normal, QIcon::State::Off);
downButton->setIcon(icon1);
hboxLayout->addWidget(downButton);
@ -73,7 +73,7 @@ public:
removeButton->setObjectName("removeButton");
removeButton->setEnabled(false);
QIcon icon2;
icon2.addFile(QString::fromUtf8(":/images/editdelete.png"), QSize(), QIcon::Normal, QIcon::Off);
icon2.addFile(QString::fromUtf8(":/images/editdelete.png"), QSize(), QIcon::Mode::Normal, QIcon::State::Off);
removeButton->setIcon(icon2);
hboxLayout->addWidget(removeButton);
@ -82,7 +82,7 @@ public:
openFileButton->setObjectName("openFileButton");
openFileButton->setEnabled(true);
QIcon icon3;
icon3.addFile(QString::fromUtf8(":/images/mac/fileopen.png"), QSize(), QIcon::Normal, QIcon::Off);
icon3.addFile(QString::fromUtf8(":/images/mac/fileopen.png"), QSize(), QIcon::Mode::Normal, QIcon::State::Off);
openFileButton->setIcon(icon3);
hboxLayout->addWidget(openFileButton);

View File

@ -42,10 +42,10 @@ public:
pushButton = new QPushButton(Form);
pushButton->setObjectName("pushButton");
QIcon icon;
icon.addPixmap(QPixmap(pixmapFunction("buttonIconNormalOff")), QIcon::Normal, QIcon::Off);
icon.addPixmap(QPixmap(pixmapFunction("buttonIconNormalOn")), QIcon::Normal, QIcon::On);
icon.addPixmap(QPixmap(pixmapFunction("buttonIconDisabledOff")), QIcon::Disabled, QIcon::Off);
icon.addPixmap(QPixmap(pixmapFunction("buttonIconDisabledOn")), QIcon::Disabled, QIcon::On);
icon.addPixmap(QPixmap(pixmapFunction("buttonIconNormalOff")), QIcon::Mode::Normal, QIcon::State::Off);
icon.addPixmap(QPixmap(pixmapFunction("buttonIconNormalOn")), QIcon::Mode::Normal, QIcon::State::On);
icon.addPixmap(QPixmap(pixmapFunction("buttonIconDisabledOff")), QIcon::Mode::Disabled, QIcon::State::Off);
icon.addPixmap(QPixmap(pixmapFunction("buttonIconDisabledOn")), QIcon::Mode::Disabled, QIcon::State::On);
pushButton->setIcon(icon);
verticalLayout->addWidget(pushButton);