mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3751 Fix keyboard selection by overriding keyPressEvent and emitting clicked()
This commit is contained in:
parent
80d48fd669
commit
40f466fb0c
@ -43,6 +43,7 @@
|
|||||||
|
|
||||||
#include <QBoxLayout>
|
#include <QBoxLayout>
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
|
#include <QKeyEvent>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
@ -89,6 +90,21 @@ public:
|
|||||||
m_heightHint = heightHint;
|
m_heightHint = heightHint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void keyPressEvent(QKeyEvent *event)
|
||||||
|
{
|
||||||
|
QTreeView::keyPressEvent(event);
|
||||||
|
|
||||||
|
if (event->key() == Qt::Key_Down || event->key() == Qt::Key_Up ||
|
||||||
|
event->key() == Qt::Key_Home || event->key() == Qt::Key_End ||
|
||||||
|
event->key() == Qt::Key_PageDown || event->key() == Qt::Key_PageUp)
|
||||||
|
{
|
||||||
|
emit clicked(currentIndex());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int m_heightHint;
|
int m_heightHint;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user