diff options
Diffstat (limited to 'ui/qt/interface_toolbar.cpp')
-rw-r--r-- | ui/qt/interface_toolbar.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/ui/qt/interface_toolbar.cpp b/ui/qt/interface_toolbar.cpp index 7d651501fb..b28fee9abe 100644 --- a/ui/qt/interface_toolbar.cpp +++ b/ui/qt/interface_toolbar.cpp @@ -255,7 +255,15 @@ QWidget *InterfaceToolbar::createSelector(iface_toolbar_control *control) combobox->addItem(display, value); if (val->is_default) { +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) combobox->setCurrentText(display); +#else + int new_index = combobox->findText(display); + if (new_index >= 0) + { + combobox->setCurrentIndex(new_index); + } +#endif setDefaultValue(control->num, value.toUtf8()); } foreach (QString ifname, interface_.keys()) @@ -760,9 +768,21 @@ void InterfaceToolbar::startCapture(GArray *ifaces) } if (!selected_found && !first_capturing_ifname.isEmpty()) + { +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) ui->interfacesComboBox->setCurrentText(first_capturing_ifname); +#else + int new_index = ui->interfacesComboBox->findText(first_capturing_ifname); + if (new_index >= 0) + { + ui->interfacesComboBox->setCurrentIndex(new_index); + } +#endif + } else + { updateWidgets(); + } #endif // HAVE_EXTCAP } @@ -936,7 +956,15 @@ void InterfaceToolbar::interfaceListChanged() if (selected_ifname.compare(device.name) == 0) { // Keep selected interface +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) ui->interfacesComboBox->setCurrentText(device.name); +#else + int new_index = ui->interfacesComboBox->findText(device.name); + if (new_index >= 0) + { + ui->interfacesComboBox->setCurrentIndex(new_index); + } +#endif keep_selected = true; } } |