Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Invoke cut/copy/paste manually on QGraphicsTextItem
I'd like to call the same functions that handle the shortcuts Ctrl+X, Ctrl+C, Ctrl+V in QGraphicsTextItem manually. I know that their actual implementations is in the hidden QTextControll. QTextEdit provides slots to access them, but the interface of QGraphicsTextItem seems to be rather limited in comparison. I did not find a way to call these functions in QTextDocument or QTextCursor either. Is there a way to use them, or do I have to craft an artificial QKeyPressEvent and send it to the QGraphicsTextItem if I do not want to reimplement these functions?
I can't solve your problem, sorry about that, but I have the same problem :/
Unfortunately I did not find any proper solution. Currently I use the custom QKeyPressEvent workaround; something like
QKeyEvent event(QEvent::KeyPress, Qt::Key_C, Qt::ControlModifier);
This works, but it can hardly be considered an elegant solution.
You also might not want to have the shortcuts hard coded, but I am not sure how to ask Qt for the shortcut of a standard action. My code uses KDE, and I use some (pretty ugly) code to get the shortcut from an action created with KStandardAction.
We could request this feature to Qt?
andre last edited by
I'd say: please open a bugreport for it. You can do that in the "Jira bugtracker":http://bugreports.qt-project.org/ though you might have to create an account if you didn't do that already.
Asperamanca last edited by
If you make a bug report, please post the link here. I'd vote for it.
Thanks for the link :)
[quote author="Andre" date="1341392084"]I'd say: please open a bugreport for it. You can do that in the "Jira bugtracker":http://bugreports.qt-project.org/ though you might have to create an account if you didn't do that already.[/quote]
Here is the "suggestion":https://bugreports.qt-project.org/browse/QTBUG-26429 (a.k.a: Feature Request). Vote, and comment your use cases.
Thanks for creating the feature request. I've voted for it.