Hide/show advanced configuration properly using `setRowVisible()`
This makes the code simpler and avoids inconsistent spacing. Unfortunately this function has only been introduced in Qt 6.4 so the old code has to stay for older Qt versions.
This commit is contained in:
parent
d1a963013a
commit
b4879bb23e
|
@ -365,12 +365,19 @@ void ConnectionOptionPage::toggleAdvancedSettings(bool show)
|
|||
if (!ui()) {
|
||||
return;
|
||||
}
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
|
||||
for (auto *const widget : std::initializer_list<QWidget *>{
|
||||
ui()->authLabel, ui()->userNameLabel, ui()->passwordLabel, ui()->timeoutLabel, ui()->longPollingLabel, ui()->pollLabel }) {
|
||||
ui()->formLayout->setRowVisible(widget, show);
|
||||
}
|
||||
#else
|
||||
for (auto *const widget : std::initializer_list<QWidget *>{ ui()->authLabel, ui()->authCheckBox, ui()->userNameLabel, ui()->userNameLineEdit,
|
||||
ui()->passwordLabel, ui()->passwordLineEdit, ui()->timeoutLabel, ui()->timeoutSpinBox, ui()->longPollingLabel, ui()->longPollingSpinBox,
|
||||
ui()->pollLabel, ui()->pollDevStatsLabel, ui()->pollDevStatsSpinBox, ui()->pollErrorsLabel, ui()->pollErrorsSpinBox,
|
||||
ui()->pollTrafficLabel, ui()->pollTrafficSpinBox, ui()->reconnectLabel, ui()->reconnectSpinBox }) {
|
||||
widget->setVisible(show);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool ConnectionOptionPage::apply()
|
||||
|
|
Loading…
Reference in New Issue