aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2020-05-31 08:25:36 -0700
committerAnders Broman <a.broman58@gmail.com>2020-06-01 08:20:01 +0000
commit2ca5a145136e21ecef7e432d4bb50cca3476b06f (patch)
tree55517cd7e1bb7172d7f66d49e81c92202c036dd2 /ui
parent42544c8c44c12b45ff6c156cd3e6e8c1b23e150e (diff)
Qt: Fix some Qt 5.15 deprecation warnings.
Use Qt::ItemFlags() instead of 0. Use QFileDialog::Options() instead of 0. Use QComboBox::textActivated instead of QComboBox::activated. Switch to just using Qt::WindowFlags() in GeometryStateDialog. This *should* work for Qt 5.5 and earlier, but if it doesn't we can switch back. Change-Id: Iaf4e7efa1a11fc7f3325b449eef1be308cd21b45 Reviewed-on: https://code.wireshark.org/review/37349 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'ui')
-rw-r--r--ui/qt/geometry_state_dialog.h9
-rw-r--r--ui/qt/models/decode_as_model.cpp2
-rw-r--r--ui/qt/models/enabled_protocols_model.cpp2
-rw-r--r--ui/qt/models/info_proxy_model.cpp2
-rw-r--r--ui/qt/models/interface_tree_cache_model.cpp2
-rw-r--r--ui/qt/models/pref_models.cpp6
-rw-r--r--ui/qt/models/uat_model.cpp2
-rw-r--r--ui/qt/widgets/capture_filter_edit.cpp5
-rw-r--r--ui/qt/widgets/editor_file_dialog.cpp2
9 files changed, 16 insertions, 16 deletions
diff --git a/ui/qt/geometry_state_dialog.h b/ui/qt/geometry_state_dialog.h
index 0d813ce620..0c93cda123 100644
--- a/ui/qt/geometry_state_dialog.h
+++ b/ui/qt/geometry_state_dialog.h
@@ -49,16 +49,11 @@ public:
//
// Pass in the parent on macOS and NULL elsewhere so that we have an
// independent window that un-maximizes correctly.
-#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
-#define DEFAULT_WINDOW_FLAGS Qt::WindowFlags()
-#else
-#define DEFAULT_WINDOW_FLAGS 0
-#endif
#ifdef Q_OS_MAC
- explicit GeometryStateDialog(QWidget *parent, Qt::WindowFlags f = DEFAULT_WINDOW_FLAGS) : QDialog(parent, f) {}
+ explicit GeometryStateDialog(QWidget *parent, Qt::WindowFlags f = Qt::WindowFlags()) : QDialog(parent, f) {}
#else
- explicit GeometryStateDialog(QWidget *, Qt::WindowFlags f = DEFAULT_WINDOW_FLAGS) : QDialog(NULL, f) {}
+ explicit GeometryStateDialog(QWidget *, Qt::WindowFlags f = Qt::WindowFlags()) : QDialog(NULL, f) {}
#endif
~GeometryStateDialog();
diff --git a/ui/qt/models/decode_as_model.cpp b/ui/qt/models/decode_as_model.cpp
index 0fde78eb82..8ffdc42d00 100644
--- a/ui/qt/models/decode_as_model.cpp
+++ b/ui/qt/models/decode_as_model.cpp
@@ -50,7 +50,7 @@ DecodeAsModel::DecodeAsModel(QObject *parent, capture_file *cf) :
Qt::ItemFlags DecodeAsModel::flags(const QModelIndex &index) const
{
if (!index.isValid())
- return 0;
+ return Qt::ItemFlags();
DecodeAsItem* item = decode_as_items_[index.row()];
diff --git a/ui/qt/models/enabled_protocols_model.cpp b/ui/qt/models/enabled_protocols_model.cpp
index 6c0ed9ee36..0fd46b7cd8 100644
--- a/ui/qt/models/enabled_protocols_model.cpp
+++ b/ui/qt/models/enabled_protocols_model.cpp
@@ -189,7 +189,7 @@ QModelIndex EnabledProtocolsModel::index(int row, int column, const QModelIndex&
Qt::ItemFlags EnabledProtocolsModel::flags(const QModelIndex &index) const
{
if (!index.isValid())
- return 0;
+ return Qt::ItemFlags();
Qt::ItemFlags flags = QAbstractItemModel::flags(index);
switch(index.column())
diff --git a/ui/qt/models/info_proxy_model.cpp b/ui/qt/models/info_proxy_model.cpp
index 00724fadfa..8fb2b618f7 100644
--- a/ui/qt/models/info_proxy_model.cpp
+++ b/ui/qt/models/info_proxy_model.cpp
@@ -72,7 +72,7 @@ Qt::ItemFlags InfoProxyModel::flags(const QModelIndex &index) const
if (index.row() < sourceModel()->rowCount())
return sourceModel()->flags(mapToSource(index));
- return 0;
+ return Qt::ItemFlags();
}
QModelIndex InfoProxyModel::index(int row, int column, const QModelIndex &parent) const
diff --git a/ui/qt/models/interface_tree_cache_model.cpp b/ui/qt/models/interface_tree_cache_model.cpp
index ff084a3013..e0cebc9858 100644
--- a/ui/qt/models/interface_tree_cache_model.cpp
+++ b/ui/qt/models/interface_tree_cache_model.cpp
@@ -377,7 +377,7 @@ bool InterfaceTreeCacheModel::isAvailableField(const QModelIndex &index) const
Qt::ItemFlags InterfaceTreeCacheModel::flags(const QModelIndex &index) const
{
if (! index.isValid())
- return 0;
+ return Qt::ItemFlags();
Qt::ItemFlags flags = Qt::ItemIsEnabled | Qt::ItemIsSelectable;
diff --git a/ui/qt/models/pref_models.cpp b/ui/qt/models/pref_models.cpp
index a817c31556..8e8bcb63fa 100644
--- a/ui/qt/models/pref_models.cpp
+++ b/ui/qt/models/pref_models.cpp
@@ -536,13 +536,13 @@ bool AdvancedPrefsModel::setData(const QModelIndex &dataindex, const QVariant &v
Qt::ItemFlags AdvancedPrefsModel::flags(const QModelIndex &index) const
{
if (!index.isValid())
- return 0;
+ return Qt::ItemFlags();
QModelIndex modelIndex = mapToSource(index);
PrefsItem* item = static_cast<PrefsItem*>(modelIndex.internalPointer());
if (item == NULL)
- return 0;
+ return Qt::ItemFlags();
Qt::ItemFlags flags = QAbstractItemModel::flags(index);
if (item->getPref() == NULL) {
@@ -680,7 +680,7 @@ QVariant ModulePrefsModel::data(const QModelIndex &dataindex, int role) const
Qt::ItemFlags ModulePrefsModel::flags(const QModelIndex &index) const
{
if (!index.isValid())
- return 0;
+ return Qt::ItemFlags();
bool disable_capture = true;
#ifdef HAVE_LIBPCAP
diff --git a/ui/qt/models/uat_model.cpp b/ui/qt/models/uat_model.cpp
index 0743a3c3e0..863e2b9c26 100644
--- a/ui/qt/models/uat_model.cpp
+++ b/ui/qt/models/uat_model.cpp
@@ -91,7 +91,7 @@ bool UatModel::revertChanges(QString &error)
Qt::ItemFlags UatModel::flags(const QModelIndex &index) const
{
if (!index.isValid())
- return 0;
+ return Qt::ItemFlags();
uat_field_t *field = &uat_->fields[index.column()];
diff --git a/ui/qt/widgets/capture_filter_edit.cpp b/ui/qt/widgets/capture_filter_edit.cpp
index 6bdf0496f1..bfe886026d 100644
--- a/ui/qt/widgets/capture_filter_edit.cpp
+++ b/ui/qt/widgets/capture_filter_edit.cpp
@@ -209,8 +209,13 @@ CaptureFilterEdit::CaptureFilterEdit(QWidget *parent, bool plain) :
QComboBox *cf_combo = qobject_cast<QComboBox *>(parent);
if (cf_combo) {
+#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
+ connect(cf_combo, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::textActivated),
+ this, &CaptureFilterEdit::textEdited);
+#else
connect(cf_combo, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::activated),
this, &CaptureFilterEdit::textEdited);
+#endif
}
QThread *syntax_thread = new QThread;
diff --git a/ui/qt/widgets/editor_file_dialog.cpp b/ui/qt/widgets/editor_file_dialog.cpp
index 96a6ee2e5d..54017a0fef 100644
--- a/ui/qt/widgets/editor_file_dialog.cpp
+++ b/ui/qt/widgets/editor_file_dialog.cpp
@@ -25,7 +25,7 @@ EditorFileDialog::EditorFileDialog(const QModelIndex& index, enum FileMode mode,
, caption_(caption)
, directory_(directory)
, filter_(filter)
- , options_(0)
+ , options_(QFileDialog::Options())
{
if (mode_ == Directory)
options_ = QFileDialog::ShowDirsOnly;