From e3cc56d532edc97291b4f5a6c95db8b0ed8b3fe8 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 15 Feb 2013 11:28:28 +0100 Subject: Fix multiselection by CTRL-click in QFileDialog/KDE. Task-number: QTBUG-29257 Change-Id: Idfac80e855455a4537dd38a23136762cd9398e15 Reviewed-by: David Faure (KDE) Reviewed-by: Frederik Gladhorn (cherry picked from qtbase/b6ccdfa4823d4608f5cb94797b48fc82b8833581) --- src/gui/dialogs/qfiledialog.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp index aeb84f4..92ffedc 100644 --- a/src/gui/dialogs/qfiledialog.cpp +++ b/src/gui/dialogs/qfiledialog.cpp @@ -3001,7 +3001,11 @@ void QFileDialogPrivate::_q_enterDirectory(const QModelIndex &index) lineEdit()->clear(); } } else { - q->accept(); + // Do not accept when shift-clicking to multi-select a file in environments with single-click-activation (KDE) + if (!q->style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick) + || q->fileMode() != QFileDialog::ExistingFiles || !(QApplication::keyboardModifiers() & Qt::CTRL)) { + q->accept(); + } } } -- cgit v0.12