Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Texteditor widget for resizing an Image with the mouse
Forum Updated to NodeBB v4.3 + New Features

Texteditor widget for resizing an Image with the mouse

Scheduled Pinned Locked Moved General and Desktop
11 Posts 5 Posters 3.5k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Bareos
    wrote on 3 Nov 2011, 12:19 last edited by
    #1

    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

    1 Reply Last reply
    0
    • B Offline
      B Offline
      BilbonSacquet
      wrote on 18 Nov 2011, 15:49 last edited by
      #2

      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! :)

      1 Reply Last reply
      0
      • B Offline
        B Offline
        Bareos
        wrote on 18 Nov 2011, 16:00 last edited by
        #3

        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/

        1 Reply Last reply
        0
        • S Offline
          S Offline
          salwa
          wrote on 31 Jan 2019, 10:16 last edited by
          #4

          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?

          M 1 Reply Last reply 31 Jan 2019, 14:49
          0
          • S salwa
            31 Jan 2019, 10:16

            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?

            M Offline
            M Offline
            mrjj
            Lifetime Qt Champion
            wrote on 31 Jan 2019, 14:49 last edited by
            #5

            @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

            1 Reply Last reply
            0
            • S Offline
              S Offline
              salwa
              wrote on 31 Jan 2019, 14:57 last edited by
              #6

              @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 :(

              M 1 Reply Last reply 31 Jan 2019, 15:02
              0
              • S salwa
                31 Jan 2019, 14:57

                @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 :(

                M Offline
                M Offline
                mrjj
                Lifetime Qt Champion
                wrote on 31 Jan 2019, 15:02 last edited by mrjj
                #7

                @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.

                1 Reply Last reply
                1
                • S Offline
                  S Offline
                  salwa
                  wrote on 31 Jan 2019, 15:11 last edited by
                  #8

                  @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?

                  M 1 Reply Last reply 31 Jan 2019, 15:27
                  0
                  • S salwa
                    31 Jan 2019, 15:11

                    @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?

                    M Offline
                    M Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on 31 Jan 2019, 15:27 last edited by mrjj
                    #9

                    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)

                    1 Reply Last reply
                    0
                    • Y Offline
                      Y Offline
                      Yunus
                      wrote on 1 Feb 2019, 05:21 last edited by Yunus 2 Jan 2019, 05:22
                      #10

                      @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

                      1 Reply Last reply
                      0
                      • S Offline
                        S Offline
                        salwa
                        wrote on 4 Feb 2019, 11:34 last edited by salwa 2 Apr 2019, 11:35
                        #11

                        @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..

                        1 Reply Last reply
                        0

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved