keyPressEvent in QQuickPaintedItem has stopped working after moving file to StackView
-
Hi
I have a problem with class inherited from class QQuickPaintedItem, after moving file to stackview it has stopped working
void CoreNode::keyPressEvent(QKeyEvent* pEvent) { if (mpCurrentNumberBox != nullptr) { mpCurrentNumberBox->keyPress(pEvent); update();but
void CoreNode::mousePressEvent(QMouseEvent* pEvent) { setFocus(true); mLastMousePosition = pEvent->pos(); if (isMouseOnHeader(pEvent->pos())) { mIsMouseClickedOnHeader = true;mousePressEvent still works
main.qml
Window { id: window visible: true width: 1280 height: 720 title: "Block-Based Programming Language" Cursor { id: curs } StackView { id: stackView anchors.fill: parent initialItem: "Tasks.qml" } Component.onCompleted: { JS.dbInit() } -
StackView is a focusc scope. The view must have focus == true for the current item to have active focus.