uic: Implement form window setting to disable QObject::connectSlotsByName()
Task-number: QTBUG-76375 Change-Id: I16ad147366aa7d52b7a0e17ae240127d8ac34b3c Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>bb10
parent
377ffbd21d
commit
fdef9c8039
|
|
@ -467,6 +467,9 @@ void WriteInitialization::acceptUI(DomUI *node)
|
|||
m_widgetChain.push(nullptr);
|
||||
m_layoutChain.push(nullptr);
|
||||
|
||||
if (node->hasAttributeConnectslotsbyname())
|
||||
m_connectSlotsByName = node->attributeConnectslotsbyname();
|
||||
|
||||
acceptLayoutDefault(node->elementLayoutDefault());
|
||||
acceptLayoutFunction(node->elementLayoutFunction());
|
||||
|
||||
|
|
@ -536,7 +539,7 @@ void WriteInitialization::acceptUI(DomUI *node)
|
|||
if (!m_delayedInitialization.isEmpty())
|
||||
m_output << "\n" << m_delayedInitialization << "\n";
|
||||
|
||||
if (m_option.autoConnection) {
|
||||
if (m_option.autoConnection && m_connectSlotsByName) {
|
||||
m_output << "\n" << m_indent << "QMetaObject" << language::qualifier
|
||||
<< "connectSlotsByName(" << varName << ')' << language::eol;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -311,6 +311,7 @@ private:
|
|||
|
||||
bool m_layoutWidget = false;
|
||||
bool m_firstThemeIcon = true;
|
||||
bool m_connectSlotsByName = true;
|
||||
};
|
||||
|
||||
} // namespace CPP
|
||||
|
|
|
|||
|
|
@ -76,6 +76,10 @@ void DomUI::read(QXmlStreamReader &reader)
|
|||
setAttributeIdbasedtr(attribute.value() == QLatin1String("true"));
|
||||
continue;
|
||||
}
|
||||
if (name == QLatin1String("connectslotsbyname")) {
|
||||
setAttributeConnectslotsbyname(attribute.value() == QLatin1String("true"));
|
||||
continue;
|
||||
}
|
||||
if (name == QLatin1String("stdsetdef")) {
|
||||
setAttributeStdsetdef(attribute.value().toInt());
|
||||
continue;
|
||||
|
|
@ -209,6 +213,9 @@ void DomUI::write(QXmlStreamWriter &writer, const QString &tagName) const
|
|||
if (hasAttributeIdbasedtr())
|
||||
writer.writeAttribute(QStringLiteral("idbasedtr"), (attributeIdbasedtr() ? QLatin1String("true") : QLatin1String("false")));
|
||||
|
||||
if (hasAttributeConnectslotsbyname())
|
||||
writer.writeAttribute(QStringLiteral("connectslotsbyname"), (attributeConnectslotsbyname() ? QLatin1String("true") : QLatin1String("false")));
|
||||
|
||||
if (hasAttributeStdsetdef())
|
||||
writer.writeAttribute(QStringLiteral("stdsetdef"), QString::number(attributeStdsetdef()));
|
||||
|
||||
|
|
|
|||
|
|
@ -169,6 +169,11 @@ public:
|
|||
inline void setAttributeIdbasedtr(bool a) { m_attr_idbasedtr = a; m_has_attr_idbasedtr = true; }
|
||||
inline void clearAttributeIdbasedtr() { m_has_attr_idbasedtr = false; }
|
||||
|
||||
inline bool hasAttributeConnectslotsbyname() const { return m_has_attr_connectslotsbyname; }
|
||||
inline bool attributeConnectslotsbyname() const { return m_attr_connectslotsbyname; }
|
||||
inline void setAttributeConnectslotsbyname(bool a) { m_attr_connectslotsbyname = a; m_has_attr_connectslotsbyname = true; }
|
||||
inline void clearAttributeConnectslotsbyname() { m_has_attr_connectslotsbyname = false; }
|
||||
|
||||
inline bool hasAttributeStdsetdef() const { return m_has_attr_stdsetdef; }
|
||||
inline int attributeStdsetdef() const { return m_attr_stdsetdef; }
|
||||
inline void setAttributeStdsetdef(int a) { m_attr_stdsetdef = a; m_has_attr_stdsetdef = true; }
|
||||
|
|
@ -285,6 +290,9 @@ private:
|
|||
bool m_attr_idbasedtr = false;
|
||||
bool m_has_attr_idbasedtr = false;
|
||||
|
||||
bool m_attr_connectslotsbyname = false;
|
||||
bool m_has_attr_connectslotsbyname = false;
|
||||
|
||||
int m_attr_stdsetdef = 0;
|
||||
bool m_has_attr_stdsetdef = false;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<ui version="4.0" >
|
||||
<ui version="4.0" connectslotsbyname="false">
|
||||
<class>Dialog</class>
|
||||
<widget class="QDialog" name="Dialog" >
|
||||
<property name="geometry" >
|
||||
|
|
|
|||
|
|
@ -52,8 +52,6 @@ public:
|
|||
|
||||
|
||||
retranslateUi(Dialog);
|
||||
|
||||
QMetaObject::connectSlotsByName(Dialog);
|
||||
} // setupUi
|
||||
|
||||
void retranslateUi(QDialog *Dialog)
|
||||
|
|
|
|||
Loading…
Reference in New Issue