summaryrefslogtreecommitdiffstats
path: root/src/tools/uic
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@nokia.com>2009-06-16 15:16:09 (GMT)
committerVolker Hilsheimer <volker.hilsheimer@nokia.com>2009-06-16 15:16:09 (GMT)
commited358d0f8ecaff49e72accc693c3cf8f09900449 (patch)
tree21689389e275df17c79f2adc366a71941e4420ed /src/tools/uic
parente73e36a16bb51fa66bdccc780f177e2c4d5d8092 (diff)
parente2451ba6eaac6c8050fd172405c1bf262d4e34d7 (diff)
downloadQt-ed358d0f8ecaff49e72accc693c3cf8f09900449.zip
Qt-ed358d0f8ecaff49e72accc693c3cf8f09900449.tar.gz
Qt-ed358d0f8ecaff49e72accc693c3cf8f09900449.tar.bz2
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt
Diffstat (limited to 'src/tools/uic')
-rw-r--r--src/tools/uic/cpp/cppwriteinitialization.cpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp
index b6e5ba7..d43f74e 100644
--- a/src/tools/uic/cpp/cppwriteinitialization.cpp
+++ b/src/tools/uic/cpp/cppwriteinitialization.cpp
@@ -391,6 +391,13 @@ void WriteInitialization::LayoutDefaultHandler::acceptLayoutFunction(DomLayoutFu
}
}
+static inline void writeContentsMargins(const QString &indent, const QString &objectName, int value, QTextStream &str)
+{
+ QString contentsMargins;
+ QTextStream(&contentsMargins) << value << ", " << value << ", " << value << ", " << value;
+ writeSetter(indent, objectName, QLatin1String("setContentsMargins"), contentsMargins, str);
+ }
+
void WriteInitialization::LayoutDefaultHandler::writeProperty(int p, const QString &indent, const QString &objectName,
const DomPropertyMap &properties, const QString &propertyName, const QString &setter,
int defaultStyleValue, bool suppressDefault, QTextStream &str) const
@@ -408,7 +415,11 @@ void WriteInitialization::LayoutDefaultHandler::writeProperty(int p, const QStri
&& value == defaultStyleValue);
if (ifndefMac)
str << "#ifndef Q_OS_MAC\n";
- writeSetter(indent, objectName, setter, value, str);
+ if (p == Margin) { // Use setContentsMargins for numeric values
+ writeContentsMargins(indent, objectName, value, str);
+ } else {
+ writeSetter(indent, objectName, setter, value, str);
+ }
if (ifndefMac)
str << "#endif\n";
return;
@@ -416,13 +427,18 @@ void WriteInitialization::LayoutDefaultHandler::writeProperty(int p, const QStri
}
if (suppressDefault)
return;
- // get default
+ // get default.
if (m_state[p] & HasDefaultFunction) {
+ // Do not use setContentsMargins to avoid repetitive evaluations.
writeSetter(indent, objectName, setter, m_functions[p], str);
return;
}
if (m_state[p] & HasDefaultValue) {
- writeSetter(indent, objectName, setter, m_defaultValues[p], str);
+ if (p == Margin) { // Use setContentsMargins for numeric values
+ writeContentsMargins(indent, objectName, m_defaultValues[p], str);
+ } else {
+ writeSetter(indent, objectName, setter, m_defaultValues[p], str);
+ }
}
return;
}