mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -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()
|
void YACReaderTreeView::expandCurrent()
|
||||||
{
|
{
|
||||||
QModelIndex index = indexAt(expandPos);
|
QModelIndex index = indexAt(expandPos);
|
||||||
|
@ -8,7 +8,7 @@ class YACReaderTreeView : public QTreeView
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit YACReaderTreeView(QWidget *parent = 0);
|
explicit YACReaderTreeView(QWidget *parent = 0);
|
||||||
|
void mousePressEvent(QMouseEvent *event);
|
||||||
protected slots:
|
protected slots:
|
||||||
//fix for drop auto expand
|
//fix for drop auto expand
|
||||||
void expandCurrent();
|
void expandCurrent();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user