Only respond to mouseRelease if we have no modifiers - to allow items to be selected!
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
#include <QtCore/QMimeData>
|
||||
#include <QtGui/QDrag>
|
||||
#include <QtGui/QIcon>
|
||||
#include <QtGui/QMouseEvent>
|
||||
|
||||
ListView::ListView(QWidget *parent)
|
||||
: QListView(parent)
|
||||
@@ -82,3 +83,10 @@ void ListView::startDrag(Qt::DropActions supportedActions)
|
||||
drag->start(supportedActions);
|
||||
}
|
||||
}
|
||||
|
||||
void ListView::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
if (Qt::NoModifier==event->modifiers()) {
|
||||
QListView::mouseReleaseEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ public:
|
||||
bool haveSelectedItems() const;
|
||||
bool haveUnSelectedItems() const;
|
||||
void startDrag(Qt::DropActions supportedActions);
|
||||
void mouseReleaseEvent(QMouseEvent *event);
|
||||
|
||||
Q_SIGNALS:
|
||||
bool itemsSelected(bool);
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
*/
|
||||
|
||||
#include "treeview.h"
|
||||
#include <QtGui/QMouseEvent>
|
||||
|
||||
TreeView::TreeView(QWidget *parent)
|
||||
: QTreeView(parent)
|
||||
@@ -64,3 +65,11 @@ bool TreeView::haveUnSelectedItems() const
|
||||
{
|
||||
return selectedIndexes().count()!=model()->rowCount();
|
||||
}
|
||||
|
||||
void TreeView::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
if (Qt::NoModifier==event->modifiers()) {
|
||||
QTreeView::mouseReleaseEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ public:
|
||||
void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
|
||||
bool haveSelectedItems() const;
|
||||
bool haveUnSelectedItems() const;
|
||||
void mouseReleaseEvent(QMouseEvent *event);
|
||||
|
||||
Q_SIGNALS:
|
||||
bool itemsSelected(bool);
|
||||
|
||||
Reference in New Issue
Block a user