uic: Fix broken icon code generation
Change b86d0b6215
rearranged the
sequence of function calls when generating code adding QTabWidget
and QToolBox pages, not taking into account that the iconCall()
has a side effect (writing out icon definition) Revert that part
and add a comment.
Fixes: QTBUG-72980
Task-number: PYSIDE-797
Change-Id: Ie8fbaa36f21cd4408fb1f491195da5c260708e6c
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
parent
e649c4143e
commit
07580a8d7b
@ -698,11 +698,12 @@ void WriteInitialization::acceptWidget(DomWidget *node)
|
||||
} else if (m_uic->customWidgetsInfo()->extends(parentClass, QLatin1String("QToolBox"))) {
|
||||
const DomProperty *plabel = attributes.value(QLatin1String("label"));
|
||||
DomString *plabelString = plabel ? plabel->elementString() : 0;
|
||||
|
||||
m_output << m_indent << parentWidget << "->addItem(" << varName;
|
||||
QString icon;
|
||||
if (const DomProperty *picon = attributes.value(QLatin1String("icon")))
|
||||
m_output << ", " << iconCall(picon);
|
||||
m_output << ", " << noTrCall(plabelString, pageDefaultString) << ");\n";
|
||||
icon = QLatin1String(", ") + iconCall(picon); // Side effect: Writes icon definition
|
||||
|
||||
m_output << m_indent << parentWidget << "->addItem(" << varName << icon
|
||||
<< ", " << noTrCall(plabelString, pageDefaultString) << ");\n";
|
||||
|
||||
autoTrOutput(plabelString, pageDefaultString) << m_indent << parentWidget << "->setItemText("
|
||||
<< parentWidget << "->indexOf(" << varName << "), " << autoTrCall(plabelString, pageDefaultString) << ");\n";
|
||||
@ -718,11 +719,11 @@ void WriteInitialization::acceptWidget(DomWidget *node)
|
||||
} else if (m_uic->customWidgetsInfo()->extends(parentClass, QLatin1String("QTabWidget"))) {
|
||||
const DomProperty *ptitle = attributes.value(QLatin1String("title"));
|
||||
DomString *ptitleString = ptitle ? ptitle->elementString() : 0;
|
||||
|
||||
m_output << m_indent << parentWidget << "->addTab(" << varName;
|
||||
QString icon;
|
||||
if (const DomProperty *picon = attributes.value(QLatin1String("icon")))
|
||||
m_output << ", " << iconCall(picon);
|
||||
m_output << ", " << "QString());\n";
|
||||
icon = QLatin1String(", ") + iconCall(picon); // Side effect: Writes icon definition
|
||||
m_output << m_indent << parentWidget << "->addTab(" << varName << icon
|
||||
<< ", " << "QString());\n";
|
||||
|
||||
autoTrOutput(ptitleString, pageDefaultString) << m_indent << parentWidget << "->setTabText("
|
||||
<< parentWidget << "->indexOf(" << varName << "), " << autoTrCall(ptitleString, pageDefaultString) << ");\n";
|
||||
|
@ -57,6 +57,9 @@
|
||||
<string>Displays help topics organized by category, index or bookmarks. Another tab inherits the full text search.</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="contentPage" >
|
||||
<attribute name="icon">
|
||||
<iconset theme="edit-copy"/>
|
||||
</attribute>
|
||||
<attribute name="title" >
|
||||
<string>Con&tents</string>
|
||||
</attribute>
|
||||
|
@ -124,7 +124,8 @@ public:
|
||||
|
||||
vboxLayout1->addWidget(listContents);
|
||||
|
||||
tabWidget->addTab(contentPage, QString());
|
||||
QIcon icon(QIcon::fromTheme(QString::fromUtf8("edit-copy")));
|
||||
tabWidget->addTab(contentPage, icon, QString());
|
||||
indexPage = new QWidget();
|
||||
indexPage->setObjectName(QString::fromUtf8("indexPage"));
|
||||
vboxLayout2 = new QVBoxLayout(indexPage);
|
||||
|
Loading…
Reference in New Issue
Block a user