From a86c5f7cae7ec9a3398300555a0b644689d946a1 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 19 Sep 2024 06:14:53 +0200 Subject: Merging upstream version 4.4.0. Signed-off-by: Daniel Baumann --- ui/qt/widgets/wireshark_file_dialog.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'ui/qt/widgets/wireshark_file_dialog.h') diff --git a/ui/qt/widgets/wireshark_file_dialog.h b/ui/qt/widgets/wireshark_file_dialog.h index 43ac67a6..7d452b3d 100644 --- a/ui/qt/widgets/wireshark_file_dialog.h +++ b/ui/qt/widgets/wireshark_file_dialog.h @@ -15,6 +15,11 @@ /** * @brief The WiresharkFileDialog class * + * Qt uses '/' as a universal path separator and converts to native path + * separators, i.e., '\' on Windows, only immediately before displaying a + * path to a user. This class can return the path with native path + * separators. + * * Qt <= 5.9 supports setting old (Windows 8.1) per-monitor DPI awareness * via Qt:AA_EnableHighDpiScaling. We do this in main.cpp. In order for * native dialogs to be rendered correctly we need to set per-monitor @@ -23,13 +28,15 @@ * we need to revert our thread context when we're done. * The class functions below are simple wrappers around their QFileDialog * equivalents that set PMv2 awareness before showing native dialogs on - * Windows and resets it afterward. + * Windows and resets it afterward. They also return the result with native + * directory separators on Windows. */ class WiresharkFileDialog : public QFileDialog { public: WiresharkFileDialog(QWidget *parent = nullptr, const QString &caption = QString(), const QString &directory = QString(), const QString &filter = QString()); + QString selectedNativePath() const; static QString getExistingDirectory(QWidget *parent = Q_NULLPTR, const QString &caption = QString(), const QString &dir = QString(), Options options = ShowDirsOnly); static QString getOpenFileName(QWidget *parent = Q_NULLPTR, const QString &caption = QString(), const QString &dir = QString(), const QString &filter = QString(), QString *selectedFilter = Q_NULLPTR, Options options = Options()); static QString getSaveFileName(QWidget *parent = Q_NULLPTR, const QString &caption = QString(), const QString &dir = QString(), const QString &filter = QString(), QString *selectedFilter = Q_NULLPTR, Options options = Options()); -- cgit v1.2.3