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.6k 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.
  • BilbonSacquetB Offline
    BilbonSacquetB Offline
    BilbonSacquet
    wrote on 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 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 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?

        mrjjM 1 Reply Last reply
        0
        • S salwa

          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?

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on 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 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 :(

            mrjjM 1 Reply Last reply
            0
            • S salwa

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

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on 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 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?

                mrjjM 1 Reply Last reply
                0
                • S salwa

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

                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on 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
                  • YunusY Offline
                    YunusY Offline
                    Yunus
                    wrote on last edited by Yunus
                    #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 last edited by salwa
                      #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