aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2017-07-22 20:30:07 +0200
committerMichael Mann <mmann78@netscape.net>2017-07-23 20:33:30 +0000
commitf2ffcdf3aa5cf3b02d674411270df072f3a1eded (patch)
tree2a580b2e2a2c344792f76f7c34e235091aa9a272
parent68f295d6052d49200f9ad3e06909b1157e7a82be (diff)
Qt: Compile InterfaceToolbar with Qt4
The InterfaceToolbar does not currently work with Qt4 because usage of some Qt 5.2 features, but this should at least make it compile. Change-Id: Id610e04d6c266556bfb84da5399e57a6c1fe9938 Ping-Bug: 13909 Reviewed-on: https://code.wireshark.org/review/22761 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Petri-Dish: Michael Mann <mmann78@netscape.net> Reviewed-by: Michael Mann <mmann78@netscape.net>
-rw-r--r--ui/qt/interface_toolbar.cpp28
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;
}
}