marrat
marrat

Reputation: 534

issue focusing QLineEdit rendered to QGraphicsScene

I render Qt gui elements on my own 3d application screen by rendering Qt stuff to QImage and then drawing that on the screen. I redirect input to QGraphicsScene, but not everything works. Clicking buttons works fine while clicking QLineEdit or web page elements in QWebView doesnt. However doubleclick seems to work - doubleclicked QLineEdit would select some text, but still would not gain focus. What could be causing this?

Upvotes: 0

Views: 829

Answers (2)

toomuchcookies
toomuchcookies

Reputation: 11

I had the exact same problem. It seemed i had

QGraphicsView.keyPressEvent(self, keyEvent)

implemented in my graphicsView. Had to resend the event up the chain of inheritance.

Upvotes: 1

marrat
marrat

Reputation: 534

I also implemented keyboard event sending. No matter how i send events (QGraphicsScene::keyPressEvent()/QGraphicsScene::keyReleaseEvent() or QApplication::sendEvent) text is not typed into control, even if some text is selected in QLineEdit (text should be overwritten, shouldnt it?). I suspect this is because of QLineEdit not gaining focus by clicking it, but i cant find out why it is not focused. All events are sent to my subclass of QGraphicsScene.

Upvotes: 0

Related Questions