mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-19 14:50:53 +01:00
The primitive decorator now handles keyboard-driven movements.
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2028 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -403,7 +403,7 @@ bool PartText::sceneEventFilter(QGraphicsItem *watched, QEvent *event) {
|
||||
else if (event -> type() == QEvent::KeyRelease || event -> type() == QEvent::KeyPress) {
|
||||
// Intercept F2 and escape keystrokes to focus in and out
|
||||
QKeyEvent *key_event = static_cast<QKeyEvent *>(event);
|
||||
if (key_event -> key() == Qt::Key_F2) {
|
||||
if (!hasFocus() && key_event -> key() == Qt::Key_F2) {
|
||||
setEditable(true);
|
||||
QTextCursor qtc = textCursor();
|
||||
qtc.setPosition(qMax(0, document()->characterCount() - 1));
|
||||
@@ -411,8 +411,10 @@ bool PartText::sceneEventFilter(QGraphicsItem *watched, QEvent *event) {
|
||||
} else if (hasFocus() && key_event -> key() == Qt::Key_Escape) {
|
||||
endEdition();
|
||||
}
|
||||
sceneEvent(event); // manually deliver the event to this item
|
||||
return(true); // prevent this event from being delivered to any item
|
||||
if (hasFocus()) {
|
||||
sceneEvent(event); // manually deliver the event to this item
|
||||
return(true); // prevent this event from being delivered to any item
|
||||
}
|
||||
}
|
||||
return(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user