Don't automatically expand items in tree views when clicking them if a modifier key is pressed as well.
This commit is contained in:
parent
35242f740e
commit
d08782b720
@ -17,6 +17,7 @@
|
||||
|
||||
#include "autoexpandingtreeview.h"
|
||||
|
||||
#include <QMouseEvent>
|
||||
#include <QtDebug>
|
||||
|
||||
const int AutoExpandingTreeView::kRowsToShow = 50;
|
||||
@ -87,3 +88,11 @@ void AutoExpandingTreeView::ItemClicked(const QModelIndex& index) {
|
||||
void AutoExpandingTreeView::ItemDoubleClicked(const QModelIndex& index) {
|
||||
ignore_next_click_ = true;
|
||||
}
|
||||
|
||||
void AutoExpandingTreeView::mousePressEvent(QMouseEvent* event) {
|
||||
if (event->modifiers() != Qt::NoModifier) {
|
||||
ignore_next_click_ = true;
|
||||
}
|
||||
|
||||
QTreeView::mousePressEvent(event);
|
||||
}
|
||||
|
@ -38,6 +38,9 @@ class AutoExpandingTreeView : public QTreeView {
|
||||
// QAbstractItemView
|
||||
void reset();
|
||||
|
||||
// QWidget
|
||||
void mousePressEvent(QMouseEvent* event);
|
||||
|
||||
virtual bool CanRecursivelyExpand(const QModelIndex& index) const { return true; }
|
||||
|
||||
private slots:
|
||||
|
Loading…
x
Reference in New Issue
Block a user