QFileDialog: Fix single-click activation

In QFileDialogPrivate::_q_enterDirectory() the QStyle::styleHint() for
QStyle::SH_ItemView_ActivateItemOnSingleClick was called w/o the
widget. By such usage the possible StyleSheet setting was ignored, e.g.
"QAbstractItemView { activate-on-singleclick: 1; }".

Task-number: QTBUG-50871
Change-Id: I7a32c4841db7113f32c3823581c2becc1677e3cc
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
Palo Kisa 2016-04-26 08:55:56 +02:00
parent 6844f60dae
commit 5795c86e8b

View File

@ -3594,7 +3594,7 @@ void QFileDialogPrivate::_q_enterDirectory(const QModelIndex &index)
}
} else {
// 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)
if (!q->style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, Q_NULLPTR, qFileDialogUi->treeView)
|| q->fileMode() != QFileDialog::ExistingFiles || !(QGuiApplication::keyboardModifiers() & Qt::CTRL)) {
q->accept();
}