forked from qt-creator/qt-creator
Utils: Check shift pressed for directory chooser
Change-Id: I69e9ff2accf51ad7f6327b6708f114a0f87ada42 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -534,10 +534,17 @@ FilePath FileUtils::getSaveFilePath(QWidget *parent,
|
|||||||
FilePath FileUtils::getExistingDirectory(QWidget *parent,
|
FilePath FileUtils::getExistingDirectory(QWidget *parent,
|
||||||
const QString &caption,
|
const QString &caption,
|
||||||
const FilePath &dir,
|
const FilePath &dir,
|
||||||
QFileDialog::Options options)
|
QFileDialog::Options options,
|
||||||
|
bool fromDeviceIfShiftIsPressed)
|
||||||
{
|
{
|
||||||
bool forceNonNativeDialog = dir.needsDevice();
|
bool forceNonNativeDialog = dir.needsDevice();
|
||||||
|
|
||||||
|
#ifdef QT_GUI_LIB
|
||||||
|
if (fromDeviceIfShiftIsPressed && qApp->queryKeyboardModifiers() & Qt::ShiftModifier) {
|
||||||
|
forceNonNativeDialog = true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
const QStringList schemes = QStringList(QStringLiteral("file"));
|
const QStringList schemes = QStringList(QStringLiteral("file"));
|
||||||
return firstOrEmpty(getFilePaths(dialogParent(parent),
|
return firstOrEmpty(getFilePaths(dialogParent(parent),
|
||||||
caption,
|
caption,
|
||||||
|
@@ -110,7 +110,8 @@ public:
|
|||||||
static FilePath getExistingDirectory(QWidget *parent,
|
static FilePath getExistingDirectory(QWidget *parent,
|
||||||
const QString &caption,
|
const QString &caption,
|
||||||
const FilePath &dir = {},
|
const FilePath &dir = {},
|
||||||
QFileDialog::Options options = QFileDialog::ShowDirsOnly);
|
QFileDialog::Options options = QFileDialog::ShowDirsOnly,
|
||||||
|
bool fromDeviceIfShiftIsPressed = false);
|
||||||
|
|
||||||
static FilePaths getOpenFilePaths(QWidget *parent,
|
static FilePaths getOpenFilePaths(QWidget *parent,
|
||||||
const QString &caption,
|
const QString &caption,
|
||||||
|
Reference in New Issue
Block a user