Hello I have written a program in which I add graphics items in a QGraphicsView. I have a GraphicsScene which is bigger than the view. I'm using QInputDialog's getText function to change the text of the graphics items. If I click the OK button with the mouse everything is fine. But if I press Enter, the dialog closes, the text of the item is changed, but If I click outside the viewport of the GraphicsView an item is added. (Pressing Enter on the input dialog allows me to draw items outside of the viewport of the graphicsview). Any ideas how to fix this? I think it's some kind of focus problem, but I'm not sure.
Asked
Active
Viewed 290 times
0
-
This is strange. Could you please post some relevant code? – Pavel Strakhov Nov 17 '13 at 15:24
-
@PavelStrakhov http://pastebin.com/bCkVBwPr Here's the code for changing the text of the items. With mousePress I add a Node, with doubleClick the QInputDialog shows up. If I "accept" the dialog with enter and then click outside the graphics view, an item is added to the scene position , even though this position is not visible. Strange indeed. – Expr Nov 17 '13 at 15:34
-
I've been trying different approaches, subclassing QDialog and QInputDialog with managing keyPressEvent on my own, but the same result. After I press enter - the buttons on my toolbars don't work on the first click. Can someone tell me how to disable the default key (Enter) for the QInputDialog? – Expr Nov 18 '13 at 19:55