summaryrefslogtreecommitdiff
path: root/src/tools/uic/cpp/cppwriteinitialization.cpp
diff options
context:
space:
mode:
authorJarek Kobus <jkobus@trolltech.com>2009-09-04 10:49:32 +0200
committerJarek Kobus <jkobus@trolltech.com>2009-09-04 10:53:13 +0200
commit74a88ac9d72ba83965d439eddc99e478762fd524 (patch)
tree69aac02b16979a670d224d89cb847cde823e5d2c /src/tools/uic/cpp/cppwriteinitialization.cpp
parent92a3662564f421a46761989d153f6c8eb990131f (diff)
downloadqt4-tools-74a88ac9d72ba83965d439eddc99e478762fd524.tar.gz
Generate Q_UNUSED(varName) only when varName was not used in retranslateUi(Class varName) method.
Autotests for uic updated accordingly Task: 260784 RevBy: Kai Koehne <kai.koehne@nokia.com>
Diffstat (limited to 'src/tools/uic/cpp/cppwriteinitialization.cpp')
-rw-r--r--src/tools/uic/cpp/cppwriteinitialization.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp
index 8dcc4aae38..197414b31b 100644
--- a/src/tools/uic/cpp/cppwriteinitialization.cpp
+++ b/src/tools/uic/cpp/cppwriteinitialization.cpp
@@ -474,6 +474,7 @@ WriteInitialization::WriteInitialization(Uic *uic, bool activateScripts) :
m_dindent(m_indent + m_option.indent),
m_stdsetdef(true),
m_layoutMarginType(TopLevelMargin),
+ m_mainFormUsedInRetranslateUi(false),
m_delayedOut(&m_delayedInitialization, QIODevice::WriteOnly),
m_refreshOut(&m_refreshInitialization, QIODevice::WriteOnly),
m_actionOut(&m_delayedActionInitialization, QIODevice::WriteOnly),
@@ -569,11 +570,11 @@ void WriteInitialization::acceptUI(DomUI *node)
m_output << m_option.indent << "} // setupUi\n\n";
- if (m_delayedActionInitialization.isEmpty()) {
+ if (!m_mainFormUsedInRetranslateUi) {
m_refreshInitialization += m_indent;
m_refreshInitialization += QLatin1String("Q_UNUSED(");
m_refreshInitialization += varName ;
- m_refreshInitialization +=QLatin1String(");\n");
+ m_refreshInitialization += QLatin1String(");\n");
}
m_output << m_option.indent << "void " << "retranslateUi(" << widgetClassName << " *" << varName << ")\n"
@@ -1531,6 +1532,12 @@ void WriteInitialization::writeProperties(const QString &varName,
o << ");\n";
if (defineC)
closeIfndef(o, QLatin1String(defineC));
+
+ if (varName == m_mainFormVarName && &o == &m_refreshOut) {
+ // this is the only place (currently) where we output mainForm name to the retranslateUi().
+ // Other places output merely instances of a certain class (which cannot be main form, e.g. QListWidget).
+ m_mainFormUsedInRetranslateUi = true;
+ }
}
}
if (leftMargin != -1 || topMargin != -1 || rightMargin != -1 || bottomMargin != -1) {