Embed QWinget into QPlainTextEdit
Xanx last edited by
I am trying to make an app with powerful editor. I want the editor to be interactive, so that the user is able to interact with it not only by typing a text, but also by interaction with controls, embedded into the editor.
On the other words, I want to embed, say, a button into the editor that the user is able to click on. More generally, I want to embed a QWidget that is accessible by the user.
I have found that I possibly can use QAbstractTextDocumentLayout in order to make my own documents layout and show the QWidget (but I’m still not sure I can enable user interaction with the control). I do not like this solution, because I’m afraid it requires too many work to do, to add a simple QWidget.
Another solution is QTextObjectInterface that seem to be intended to embed objects into text. I’ve found a demo here, but it shows hot to embed a picture. And I’m not sure it works with QWidget.
Have anyone tried to do that? Maybe there is a better solution?