[Kde-bindings] KDE/kdebindings/php/phpqt/tools/uic/php
Katrina J. Niolet
katrina at niolet.name
Mon Dec 15 20:38:39 UTC 2008
SVN commit 897344 by kniolet:
* Fixed scoping of layouts in phpuic
CCMAIL: kde-bindings at kde.org
M +14 -11 phpwriteinitialization.cpp
--- trunk/KDE/kdebindings/php/phpqt/tools/uic/php/phpwriteinitialization.cpp #897343:897344
@@ -301,7 +301,7 @@
// the default value, layout properties were always written
const bool useLayoutFunctionPre43 = !suppressDefault && (m_state[p] == (HasDefaultFunction|HasDefaultValue)) && value == m_defaultValues[p];
if (!useLayoutFunctionPre43) {
- bool ifndefMac = (!(m_state[p] & (HasDefaultFunction|HasDefaultValue))
+ bool ifndefMac = (!(m_state[p] & (HasDefaultFunction|HasDefaultValue))
&& value == defaultStyleValue);
if (ifndefMac)
str << "#ifndef Q_OS_MAC\n";
@@ -463,7 +463,7 @@
}
const QString savedParentWidget = parentWidget;
-
+
if (m_uic->isContainer(parentClass) || m_uic->customWidgetsInfo()->extends(parentClass, QLatin1String("Q3ToolBar")))
parentWidget.clear();
@@ -473,8 +473,8 @@
m_output << m_option.indent << varName << " = $this->" << m_driver->findOrInsertWidget(node) << "; // scope\n";
m_refreshOut << m_option.indent << varName << " = $this->" << m_driver->findOrInsertWidget(node) << "; // scope\n";
}
-
+
parentWidget = "$" + savedParentWidget;
if (m_uic->customWidgetsInfo()->extends(className, QLatin1String("QComboBox"))) {
@@ -646,7 +646,7 @@
void WriteInitialization::acceptLayout(DomLayout *node)
{
const QString className = node->attributeClass();
- const QString varName = "$" + m_driver->findOrInsertLayout(node);
+ const QString varName = m_driver->findOrInsertLayout(node);
const DomPropertyMap properties = propertyMap(node->elementProperty());
const bool oldLayoutProperties = properties.constFind(QLatin1String("margin")) != properties.constEnd();
@@ -670,35 +670,38 @@
if (oldLayoutProperties)
marginType = m_layoutMarginType;
- m_LayoutDefaultHandler.writeProperties(m_option.indent,
+ m_LayoutDefaultHandler.writeProperties(m_option.indent,
objectName, properties, marginType, false, m_output);
}
}
- m_output << m_option.indent << varName << " = new " << className << '(';
+ m_output << m_option.indent << "$this->" << varName << " = new " << className << '(';
if (!m_layoutChain.top() && !isGroupBox)
m_output << "$" + m_driver->findOrInsertWidget(m_widgetChain.top());
m_output << ");\n";
+ m_output << m_option.indent << "$" << varName << " = $this->" << varName << "; //scope\n";
+
+
if (isGroupBox) {
const QString tempName = m_driver->unique(QLatin1String("boxlayout"));
m_output << m_option.indent << "QBoxLayout *" << tempName << " = qobject_cast<QBoxLayout *>(" <<
m_driver->findOrInsertWidget(m_widgetChain.top()) << "->layout());\n";
m_output << m_option.indent << "if (" << tempName << ")\n";
- m_output << m_option.indent << " " << tempName << "->addLayout(" << varName << ");\n";
+ m_output << m_option.indent << " " << tempName << "->addLayout(" << "$" << varName << ");\n";
}
if (isGroupBox) {
- m_output << m_option.indent << varName << "->setAlignment(Qt::AlignTop);\n";
+ m_output << m_option.indent << "$" << varName << "->setAlignment(Qt::AlignTop);\n";
} else {
// Suppress margin on a read child layout
const bool suppressMarginDefault = m_layoutChain.top();
int marginType = Use43UiFile;
if (oldLayoutProperties)
marginType = m_layoutMarginType;
- m_LayoutDefaultHandler.writeProperties(m_option.indent, varName, properties, marginType, suppressMarginDefault, m_output);
+ m_LayoutDefaultHandler.writeProperties(m_option.indent, QString("$%1").arg(varName), properties, marginType, suppressMarginDefault, m_output);
}
m_layoutMarginType = SubLayoutMargin;
@@ -746,7 +749,7 @@
m_layoutWidget = false;
}
- writeProperties(varName, className, propList, WritePropertyIgnoreMargin|WritePropertyIgnoreSpacing);
+ writeProperties(QString("$%1").arg(varName), className, propList, WritePropertyIgnoreMargin|WritePropertyIgnoreSpacing);
m_layoutChain.push(node);
TreeWalker::acceptLayout(node);
@@ -879,7 +882,7 @@
const QString &className,
const DomPropertyList &lst,
unsigned flags)
-{
+{
const bool isTopLevel = m_widgetChain.count() == 1;
if (m_uic->customWidgetsInfo()->extends(className, QLatin1String("QAxWidget"))) {
More information about the Kde-bindings
mailing list