uic: Add pass to empty functions
When there are no translations on the UI file, the function was left empty but without a 'pass' statement, generating a SyntaxError, this change includes it to avoid problems while using the generated Python file. Fixes: PYSIDE-1234 Change-Id: I30482a95c95fb4b4f4456531946a79c960d76318 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
parent
4a1de178c9
commit
3f7d087d33
@ -546,12 +546,19 @@ void WriteInitialization::acceptUI(DomUI *node)
|
||||
|
||||
m_output << m_option.indent << language::endFunctionDefinition("setupUi");
|
||||
|
||||
if (!m_mainFormUsedInRetranslateUi && language::language() == Language::Cpp) {
|
||||
// Mark varName as unused to avoid compiler warnings.
|
||||
m_refreshInitialization += m_indent;
|
||||
m_refreshInitialization += QLatin1String("(void)");
|
||||
m_refreshInitialization += varName ;
|
||||
m_refreshInitialization += language::eol;
|
||||
if (!m_mainFormUsedInRetranslateUi) {
|
||||
if (language::language() == Language::Cpp) {
|
||||
// Mark varName as unused to avoid compiler warnings.
|
||||
m_refreshInitialization += m_indent;
|
||||
m_refreshInitialization += QLatin1String("(void)");
|
||||
m_refreshInitialization += varName ;
|
||||
m_refreshInitialization += language::eol;
|
||||
} else if (language::language() == Language::Python) {
|
||||
// output a 'pass' to have an empty function
|
||||
m_refreshInitialization += m_indent;
|
||||
m_refreshInitialization += QLatin1String("pass");
|
||||
m_refreshInitialization += language::eol;
|
||||
}
|
||||
}
|
||||
|
||||
m_output << m_option.indent
|
||||
|
Loading…
Reference in New Issue
Block a user