mirror of
https://github.com/YACReader/yacreader
synced 2025-06-03 00:58:32 -04:00
added clear selection to YACReaderTreeView if a mouse click is received in a place without a valid model index
This commit is contained in:
parent
fdf0a2d047
commit
e5a48915d5
@ -91,6 +91,18 @@ YACReaderTreeView::YACReaderTreeView(QWidget *parent) :
|
||||
|
||||
}
|
||||
|
||||
void YACReaderTreeView::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
QTreeView::mousePressEvent(event);
|
||||
|
||||
QModelIndex destinationIndex = indexAt(event->pos());
|
||||
|
||||
if(!destinationIndex.isValid() && event->button() == Qt::LeftButton)
|
||||
{
|
||||
clearSelection();
|
||||
}
|
||||
}
|
||||
|
||||
void YACReaderTreeView::expandCurrent()
|
||||
{
|
||||
QModelIndex index = indexAt(expandPos);
|
||||
|
@ -8,7 +8,7 @@ class YACReaderTreeView : public QTreeView
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit YACReaderTreeView(QWidget *parent = 0);
|
||||
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
protected slots:
|
||||
//fix for drop auto expand
|
||||
void expandCurrent();
|
||||
|
Loading…
x
Reference in New Issue
Block a user