Texteditor widget for resizing an Image with the mouse
-
wrote on 3 Nov 2011, 12:19 last edited by
Hi all!
I’m working with a QTextEdit which contains several images. Now I’m looking for a way to resize an image with the mouse.
Does anybody know another good Text-editor, which I can include in my programm?
Maybe something like the TinyEditor for Javascript?P.S. Sorry for my bad english
-
wrote on 18 Nov 2011, 15:49 last edited by
I'm too interested ...
I have already think to this problem (or more of miss in flexibility) in QTextEdit, for now the way I'm using is to do a text plugin with the context menu to give the new size! :)
-
wrote on 18 Nov 2011, 16:00 last edited by
In an other Thread somebody posted a nice idea. There are still some problems but maybe it leads in the right dirction.
"http://developer.qt.nokia.com/forums/viewthread/11509/":http://developer.qt.nokia.com/forums/viewthread/11509/ -
wrote on 31 Jan 2019, 10:16 last edited by
Hello,
the link that you posted is no more available. Did you resolved the problem please? Actually, i'm facing the same problem. Could you help me please? -
Hello,
the link that you posted is no more available. Did you resolved the problem please? Actually, i'm facing the same problem. Could you help me please?@salwa
Hi and welcome to the forums
Its not important to do it "inline" then this approach works good.
https://stackoverflow.com/questions/3720502/how-to-resize-an-image-in-a-qtextedit -
@mrjj
thanks for your reply
I checked that solution and it worked fine. But I need to resize the image using the mouse and it is not my choice :(@salwa
Hi
well the second post discuss how one can do it with
QRubberBand and a helper object (MyTextEditDecorator)
that has an event filer to resize the image on the fly.
I have not seen any full implementations of such approach (sadly) and
it seems to be far more involved that using a resize Dialog. -
@mrjj
during my research, i found things but i couldn't adopt it to my project. it seems that can be resolved using mousePressEvent, mouseReleaseEvent and mouseMoveEvent. Any idea about those methodes?Hi
mousePressEvent, mouseReleaseEvent and mouseMoveEvent are virtual methods
for any QWidget class. However, for images QTextDocument::ImageResource is used and
as far as i know its not a QWidget/QObject and hence it has no functions to overwrite.
Hence the link talk about using a helper object to deal with those events.
The QRubberBand has already overwritten those methods to allow mouse resize so thats why the link uses it.Altertively, you can also go down this route
http://doc.qt.io/qt-5/qtsvg-richtext-textobject-example.html
and try to integrate that with a (floating) QRubberBand ( not 100% sure it allows any size though)In any case, there is no easy way to allow inline resizing without fair amount of code. ( as far i have seen)
-
wrote on 1 Feb 2019, 05:21 last edited by Yunus 2 Jan 2019, 05:22
@salwa
Hi
I had also this problem before and I had found this solution and worked for me perfectly. This was in qml, I think you can convert it to your type. But Im not sure what exactly your problem is.https://stackoverflow.com/questions/29087710/how-to-make-a-resizable-rectangle-in-qml/29110791
-
wrote on 4 Feb 2019, 11:34 last edited by salwa 2 Apr 2019, 11:35
@Yunus
Hello Yunus,
thanks for your reply. My project is to implement a text editor like Word.
Every things work fine except resizing an image with the mouse (like Word 2016)
How can i detect the image in a QTextEdit, how to select it and then resize it. that's what i'm looking for..