forked from osmocom/wireshark
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>
This commit is contained in:
parent
42544c8c44
commit
2ca5a14513
|
@ -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();
|
||||
|
||||
|
|
|
@ -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()];
|
||||
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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()];
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue