uic: Delay the setting of QPushButton::default.
For the property to take effect, the button must have its parent set. This might not be the case when a container like for example QTabWidget is involved. Move the setting of the property to the bottom of setupUi. Task-number: QTBUG-44406 Change-Id: Ic2013865a020986475fa28f2e3805c63d4de8ed0 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
parent
6545404afa
commit
c3737573ce
@ -1176,6 +1176,7 @@ void WriteInitialization::writeProperties(const QString &varName,
|
|||||||
continue;
|
continue;
|
||||||
QString propertyName = p->attributeName();
|
QString propertyName = p->attributeName();
|
||||||
QString propertyValue;
|
QString propertyValue;
|
||||||
|
bool delayProperty = false;
|
||||||
|
|
||||||
// special case for the property `geometry': Do not use position
|
// special case for the property `geometry': Do not use position
|
||||||
if (isTopLevel && propertyName == QLatin1String("geometry") && p->elementRect()) {
|
if (isTopLevel && propertyName == QLatin1String("geometry") && p->elementRect()) {
|
||||||
@ -1204,6 +1205,10 @@ void WriteInitialization::writeProperties(const QString &varName,
|
|||||||
&& m_uic->customWidgetsInfo()->extends(className, QLatin1String("QAxWidget"))) {
|
&& m_uic->customWidgetsInfo()->extends(className, QLatin1String("QAxWidget"))) {
|
||||||
// already done ;)
|
// already done ;)
|
||||||
continue;
|
continue;
|
||||||
|
} else if (propertyName == QLatin1String("default")
|
||||||
|
&& m_uic->customWidgetsInfo()->extends(className, QLatin1String("QPushButton"))) {
|
||||||
|
// QTBUG-44406: Setting of QPushButton::default needs to be delayed until the parent is set
|
||||||
|
delayProperty = true;
|
||||||
} else if (propertyName == QLatin1String("database")
|
} else if (propertyName == QLatin1String("database")
|
||||||
&& p->elementStringList()) {
|
&& p->elementStringList()) {
|
||||||
// Sql support
|
// Sql support
|
||||||
@ -1479,7 +1484,7 @@ void WriteInitialization::writeProperties(const QString &varName,
|
|||||||
else if (propertyName == QLatin1String("accessibleName") || propertyName == QLatin1String("accessibleDescription"))
|
else if (propertyName == QLatin1String("accessibleName") || propertyName == QLatin1String("accessibleDescription"))
|
||||||
defineC = accessibilityDefineC;
|
defineC = accessibilityDefineC;
|
||||||
|
|
||||||
QTextStream &o = autoTrOutput(p);
|
QTextStream &o = delayProperty ? m_delayedOut : autoTrOutput(p);
|
||||||
|
|
||||||
if (defineC)
|
if (defineC)
|
||||||
openIfndef(o, QLatin1String(defineC));
|
openIfndef(o, QLatin1String(defineC));
|
||||||
|
@ -97,7 +97,6 @@ public:
|
|||||||
|
|
||||||
browseTorrents = new QPushButton(groupBox);
|
browseTorrents = new QPushButton(groupBox);
|
||||||
browseTorrents->setObjectName(QStringLiteral("browseTorrents"));
|
browseTorrents->setObjectName(QStringLiteral("browseTorrents"));
|
||||||
browseTorrents->setDefault(true);
|
|
||||||
|
|
||||||
gridLayout->addWidget(browseTorrents, 0, 3, 1, 1);
|
gridLayout->addWidget(browseTorrents, 0, 3, 1, 1);
|
||||||
|
|
||||||
@ -205,6 +204,9 @@ public:
|
|||||||
QObject::connect(okButton, SIGNAL(clicked()), AddTorrentFile, SLOT(accept()));
|
QObject::connect(okButton, SIGNAL(clicked()), AddTorrentFile, SLOT(accept()));
|
||||||
QObject::connect(cancelButton, SIGNAL(clicked()), AddTorrentFile, SLOT(reject()));
|
QObject::connect(cancelButton, SIGNAL(clicked()), AddTorrentFile, SLOT(reject()));
|
||||||
|
|
||||||
|
browseTorrents->setDefault(true);
|
||||||
|
|
||||||
|
|
||||||
QMetaObject::connectSlotsByName(AddTorrentFile);
|
QMetaObject::connectSlotsByName(AddTorrentFile);
|
||||||
} // setupUi
|
} // setupUi
|
||||||
|
|
||||||
|
@ -688,7 +688,6 @@ public:
|
|||||||
buttonOk = new QPushButton(Config);
|
buttonOk = new QPushButton(Config);
|
||||||
buttonOk->setObjectName(QStringLiteral("buttonOk"));
|
buttonOk->setObjectName(QStringLiteral("buttonOk"));
|
||||||
buttonOk->setAutoDefault(true);
|
buttonOk->setAutoDefault(true);
|
||||||
buttonOk->setDefault(true);
|
|
||||||
|
|
||||||
hboxLayout3->addWidget(buttonOk);
|
hboxLayout3->addWidget(buttonOk);
|
||||||
|
|
||||||
@ -706,6 +705,9 @@ public:
|
|||||||
QObject::connect(size_width, SIGNAL(valueChanged(int)), size_custom, SLOT(click()));
|
QObject::connect(size_width, SIGNAL(valueChanged(int)), size_custom, SLOT(click()));
|
||||||
QObject::connect(size_height, SIGNAL(valueChanged(int)), size_custom, SLOT(click()));
|
QObject::connect(size_height, SIGNAL(valueChanged(int)), size_custom, SLOT(click()));
|
||||||
|
|
||||||
|
buttonOk->setDefault(true);
|
||||||
|
|
||||||
|
|
||||||
QMetaObject::connectSlotsByName(Config);
|
QMetaObject::connectSlotsByName(Config);
|
||||||
} // setupUi
|
} // setupUi
|
||||||
|
|
||||||
|
@ -164,7 +164,6 @@ public:
|
|||||||
vboxLayout1->setObjectName(QStringLiteral("vboxLayout1"));
|
vboxLayout1->setObjectName(QStringLiteral("vboxLayout1"));
|
||||||
findNxt = new QPushButton(FindDialog);
|
findNxt = new QPushButton(FindDialog);
|
||||||
findNxt->setObjectName(QStringLiteral("findNxt"));
|
findNxt->setObjectName(QStringLiteral("findNxt"));
|
||||||
findNxt->setDefault(true);
|
|
||||||
findNxt->setFlat(false);
|
findNxt->setFlat(false);
|
||||||
|
|
||||||
vboxLayout1->addWidget(findNxt);
|
vboxLayout1->addWidget(findNxt);
|
||||||
@ -194,6 +193,9 @@ public:
|
|||||||
retranslateUi(FindDialog);
|
retranslateUi(FindDialog);
|
||||||
QObject::connect(cancel, SIGNAL(clicked()), FindDialog, SLOT(reject()));
|
QObject::connect(cancel, SIGNAL(clicked()), FindDialog, SLOT(reject()));
|
||||||
|
|
||||||
|
findNxt->setDefault(true);
|
||||||
|
|
||||||
|
|
||||||
QMetaObject::connectSlotsByName(FindDialog);
|
QMetaObject::connectSlotsByName(FindDialog);
|
||||||
} // setupUi
|
} // setupUi
|
||||||
|
|
||||||
|
@ -171,7 +171,6 @@ public:
|
|||||||
|
|
||||||
okButton = new QPushButton(QSqlConnectionDialogUi);
|
okButton = new QPushButton(QSqlConnectionDialogUi);
|
||||||
okButton->setObjectName(QStringLiteral("okButton"));
|
okButton->setObjectName(QStringLiteral("okButton"));
|
||||||
okButton->setDefault(true);
|
|
||||||
|
|
||||||
hboxLayout1->addWidget(okButton);
|
hboxLayout1->addWidget(okButton);
|
||||||
|
|
||||||
@ -202,6 +201,9 @@ public:
|
|||||||
|
|
||||||
retranslateUi(QSqlConnectionDialogUi);
|
retranslateUi(QSqlConnectionDialogUi);
|
||||||
|
|
||||||
|
okButton->setDefault(true);
|
||||||
|
|
||||||
|
|
||||||
QMetaObject::connectSlotsByName(QSqlConnectionDialogUi);
|
QMetaObject::connectSlotsByName(QSqlConnectionDialogUi);
|
||||||
} // setupUi
|
} // setupUi
|
||||||
|
|
||||||
|
@ -86,7 +86,6 @@ public:
|
|||||||
connectButton = new QPushButton(Form);
|
connectButton = new QPushButton(Form);
|
||||||
connectButton->setObjectName(QStringLiteral("connectButton"));
|
connectButton->setObjectName(QStringLiteral("connectButton"));
|
||||||
connectButton->setEnabled(true);
|
connectButton->setEnabled(true);
|
||||||
connectButton->setDefault(true);
|
|
||||||
|
|
||||||
vboxLayout->addWidget(connectButton);
|
vboxLayout->addWidget(connectButton);
|
||||||
|
|
||||||
@ -136,7 +135,6 @@ public:
|
|||||||
sendButton->setObjectName(QStringLiteral("sendButton"));
|
sendButton->setObjectName(QStringLiteral("sendButton"));
|
||||||
sendButton->setEnabled(false);
|
sendButton->setEnabled(false);
|
||||||
sendButton->setFocusPolicy(Qt::TabFocus);
|
sendButton->setFocusPolicy(Qt::TabFocus);
|
||||||
sendButton->setDefault(true);
|
|
||||||
|
|
||||||
hboxLayout1->addWidget(sendButton);
|
hboxLayout1->addWidget(sendButton);
|
||||||
|
|
||||||
@ -151,6 +149,10 @@ public:
|
|||||||
QObject::connect(hostNameEdit, SIGNAL(returnPressed()), connectButton, SLOT(animateClick()));
|
QObject::connect(hostNameEdit, SIGNAL(returnPressed()), connectButton, SLOT(animateClick()));
|
||||||
QObject::connect(sessionInput, SIGNAL(returnPressed()), sendButton, SLOT(animateClick()));
|
QObject::connect(sessionInput, SIGNAL(returnPressed()), sendButton, SLOT(animateClick()));
|
||||||
|
|
||||||
|
connectButton->setDefault(true);
|
||||||
|
sendButton->setDefault(true);
|
||||||
|
|
||||||
|
|
||||||
QMetaObject::connectSlotsByName(Form);
|
QMetaObject::connectSlotsByName(Form);
|
||||||
} // setupUi
|
} // setupUi
|
||||||
|
|
||||||
|
@ -77,7 +77,6 @@ public:
|
|||||||
buttonDisplay = new QPushButton(Layout16);
|
buttonDisplay = new QPushButton(Layout16);
|
||||||
buttonDisplay->setObjectName(QStringLiteral("buttonDisplay"));
|
buttonDisplay->setObjectName(QStringLiteral("buttonDisplay"));
|
||||||
buttonDisplay->setAutoDefault(true);
|
buttonDisplay->setAutoDefault(true);
|
||||||
buttonDisplay->setDefault(true);
|
|
||||||
|
|
||||||
hboxLayout->addWidget(buttonDisplay);
|
hboxLayout->addWidget(buttonDisplay);
|
||||||
|
|
||||||
@ -96,6 +95,9 @@ public:
|
|||||||
|
|
||||||
retranslateUi(TopicChooser);
|
retranslateUi(TopicChooser);
|
||||||
|
|
||||||
|
buttonDisplay->setDefault(true);
|
||||||
|
|
||||||
|
|
||||||
QMetaObject::connectSlotsByName(TopicChooser);
|
QMetaObject::connectSlotsByName(TopicChooser);
|
||||||
} // setupUi
|
} // setupUi
|
||||||
|
|
||||||
|
@ -164,7 +164,6 @@ public:
|
|||||||
vboxLayout2->setContentsMargins(0, 0, 0, 0);
|
vboxLayout2->setContentsMargins(0, 0, 0, 0);
|
||||||
findNxt = new QPushButton(TranslateDialog);
|
findNxt = new QPushButton(TranslateDialog);
|
||||||
findNxt->setObjectName(QStringLiteral("findNxt"));
|
findNxt->setObjectName(QStringLiteral("findNxt"));
|
||||||
findNxt->setDefault(true);
|
|
||||||
findNxt->setFlat(false);
|
findNxt->setFlat(false);
|
||||||
|
|
||||||
vboxLayout2->addWidget(findNxt);
|
vboxLayout2->addWidget(findNxt);
|
||||||
@ -206,6 +205,9 @@ public:
|
|||||||
retranslateUi(TranslateDialog);
|
retranslateUi(TranslateDialog);
|
||||||
QObject::connect(cancel, SIGNAL(clicked()), TranslateDialog, SLOT(reject()));
|
QObject::connect(cancel, SIGNAL(clicked()), TranslateDialog, SLOT(reject()));
|
||||||
|
|
||||||
|
findNxt->setDefault(true);
|
||||||
|
|
||||||
|
|
||||||
QMetaObject::connectSlotsByName(TranslateDialog);
|
QMetaObject::connectSlotsByName(TranslateDialog);
|
||||||
} // setupUi
|
} // setupUi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user