diff options
author | Gerald Combs <gerald@wireshark.org> | 2018-05-15 17:02:26 -0700 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2018-05-16 04:22:20 +0000 |
commit | 62999cc6776e2b94e5a888ce77d6452a1020c660 (patch) | |
tree | 5fb2f0ac932eb72277e45d59bc298f36c01347c1 /ui/qt/manager/wireshark_preference.cpp | |
parent | d3427b8a65d926ae4c85d0ec730eaf1a574041c3 (diff) |
Windows: Make sure more native dialogs handle HiDPI.
Add a WiresharkFileDialog class, which is a thin wrapper around a few
QFileDialog functions that sets per-monitor v2 DPI awareness before
showing native dialogs and resets the awareness context afterward.
Use it where we call QFileDialog::getXXX.
Change-Id: Ib711a70aa94b693a2515804a729f666ea7fbd673
Reviewed-on: https://code.wireshark.org/review/27568
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'ui/qt/manager/wireshark_preference.cpp')
-rw-r--r-- | ui/qt/manager/wireshark_preference.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/ui/qt/manager/wireshark_preference.cpp b/ui/qt/manager/wireshark_preference.cpp index 9774d7d0ed..451c9685ed 100644 --- a/ui/qt/manager/wireshark_preference.cpp +++ b/ui/qt/manager/wireshark_preference.cpp @@ -15,11 +15,11 @@ #include <ui/qt/manager/wireshark_preference.h> #include <ui/qt/manager/preference_manager.h> #include <ui/qt/widgets/range_syntax_lineedit.h> +#include "ui/qt/widgets/wireshark_file_dialog.h" #include <ui/qt/wireshark_application.h> #include <ui/qt/uat_dialog.h> #include <QDir> -#include <QFileDialog> #include <QLineEdit> #include <QComboBox> #include <QColorDialog> @@ -169,7 +169,7 @@ public: SaveFilePreference(QObject * parent = Q_NULLPTR) : WiresharkPreference(parent) {} virtual QWidget * editor(QWidget * parent, const QStyleOptionViewItem &option, const QModelIndex &index) { - QString filename = QFileDialog::getSaveFileName(parent, wsApp->windowTitleString(prefs_get_title(prefsItem()->getPref())), + QString filename = WiresharkFileDialog::getSaveFileName(parent, wsApp->windowTitleString(prefs_get_title(prefsItem()->getPref())), index.model()->data(index, Qt::DisplayRole).toString()); if (!filename.isEmpty()) { ((QAbstractItemModel*)index.model())->setData(index, QDir::toNativeSeparators(filename), Qt::EditRole); @@ -185,7 +185,7 @@ public: OpenFilePreference(QObject * parent = Q_NULLPTR) : WiresharkPreference(parent) {} virtual QWidget * editor(QWidget * parent, const QStyleOptionViewItem &option, const QModelIndex &index) { - QString filename = QFileDialog::getOpenFileName(parent, wsApp->windowTitleString(prefs_get_title(prefsItem()->getPref())), + QString filename = WiresharkFileDialog::getOpenFileName(parent, wsApp->windowTitleString(prefs_get_title(prefsItem()->getPref())), index.model()->data(index, Qt::DisplayRole).toString()); if (!filename.isEmpty()) { ((QAbstractItemModel*)index.model())->setData(index, QDir::toNativeSeparators(filename), Qt::EditRole); @@ -201,7 +201,7 @@ public: DirNamePreference(QObject * parent = Q_NULLPTR) : WiresharkPreference(parent) {} virtual QWidget * editor(QWidget * parent, const QStyleOptionViewItem &option, const QModelIndex &index) { - QString filename = QFileDialog::getExistingDirectory(parent, wsApp->windowTitleString(prefs_get_title(prefsItem()->getPref())), + QString filename = WiresharkFileDialog::getExistingDirectory(parent, wsApp->windowTitleString(prefs_get_title(prefsItem()->getPref())), index.model()->data(index, Qt::DisplayRole).toString()); if (!filename.isEmpty()) { ((QAbstractItemModel*)index.model())->setData(index, QDir::toNativeSeparators(filename), Qt::EditRole); |