sqlbrowser example: use idiomatic Qt [1/3]: disabling group-box
The old code connected to the wrong signal and therefore had to write a custom slot to perform the disabling of the group-box. The new code simply connects the QCheckBox::toggled(bool) signal to the directly-compatible QWidget::setDisabled(bool) slot, removing the need for a custom slot. Also move the connection into the .ui file, so it works already when checking the form in QtDesigner. Amends 2690822428deec4f0c08f4d118d69a7c6036369e, which, however, only inherited the issues from older code. Pick-to: 6.8 Change-Id: Ia834f92de270bb7b18981273188f6e5b6cd457a2 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 53826d1cde26f825d1983476c6697f72130e351f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
381dca29ff
commit
f2b88b3225
@ -26,8 +26,6 @@ QSqlConnectionDialog::QSqlConnectionDialog(QWidget *parent)
|
||||
this, &QSqlConnectionDialog::onOkButton);
|
||||
connect(m_ui->cancelButton, &QPushButton::clicked,
|
||||
this, &QSqlConnectionDialog::reject);
|
||||
connect(m_ui->dbCheckBox, &QCheckBox::stateChanged,
|
||||
this, &QSqlConnectionDialog::onDbCheckBox);
|
||||
}
|
||||
|
||||
QSqlConnectionDialog::~QSqlConnectionDialog()
|
||||
@ -80,8 +78,3 @@ void QSqlConnectionDialog::onOkButton()
|
||||
accept();
|
||||
}
|
||||
}
|
||||
|
||||
void QSqlConnectionDialog::onDbCheckBox()
|
||||
{
|
||||
m_ui->connGroupBox->setEnabled(!m_ui->dbCheckBox->isChecked());
|
||||
}
|
||||
|
@ -30,7 +30,6 @@ public:
|
||||
|
||||
private slots:
|
||||
void onOkButton();
|
||||
void onDbCheckBox();
|
||||
|
||||
private:
|
||||
Ui::QSqlConnectionDialogUi *m_ui;
|
||||
|
@ -220,5 +220,22 @@
|
||||
<tabstop>cancelButton</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>dbCheckBox</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>connGroupBox</receiver>
|
||||
<slot>setDisabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>165</x>
|
||||
<y>248</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>107</x>
|
||||
<y>221</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
|
Loading…
x
Reference in New Issue
Block a user