0backbone0
27th August 2015, 23:47
The Node Editor I am currently working on is coming along nicely.
11341
However there is a hopefully small issue with the QGraphicsView behaving to Cursor Key Presses.
Right now the Scene is catching the Keyboard Events.
For example the Cursor Keys Move all selected Nodes around.
Scrolling is realised with Scroll Hand Drag. However , by default, the Cursor Keys move the Scroll bars around to.
I tried to shut them out like this:
void nodegraphicsview::keyPressEvent(QKeyEvent *event)
{
if(event->key()==Qt::Key_Up || event->key()==Qt::Key_Down || event->key()==Qt::Key_Left || event->key()==Qt::Key_Right)
{
//do nothing
}
else
{
QGraphicsView::keyPressEvent(event);
}
}
Witch works, but now I also have a QLineEdit Widget in my Scene that shows up on top of a Node after DoubleClicking the Title to Rename it.
The Cursor keys are then Blocked for the Line Edit as well.
Can I forward the events directly to the LineEdit somehow?
Any other Ideas how solve this?
11341
However there is a hopefully small issue with the QGraphicsView behaving to Cursor Key Presses.
Right now the Scene is catching the Keyboard Events.
For example the Cursor Keys Move all selected Nodes around.
Scrolling is realised with Scroll Hand Drag. However , by default, the Cursor Keys move the Scroll bars around to.
I tried to shut them out like this:
void nodegraphicsview::keyPressEvent(QKeyEvent *event)
{
if(event->key()==Qt::Key_Up || event->key()==Qt::Key_Down || event->key()==Qt::Key_Left || event->key()==Qt::Key_Right)
{
//do nothing
}
else
{
QGraphicsView::keyPressEvent(event);
}
}
Witch works, but now I also have a QLineEdit Widget in my Scene that shows up on top of a Node after DoubleClicking the Title to Rename it.
The Cursor keys are then Blocked for the Line Edit as well.
Can I forward the events directly to the LineEdit somehow?
Any other Ideas how solve this?