Results 1 to 5 of 5

Thread: Why does the QTextCursor.insertImage exist when it's not possible to get the image

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2010
    Posts
    15
    Qt products
    Qt4
    Platforms
    Windows

    Angry Why does the QTextCursor.insertImage exist when it's not possible to get the image

    Hello forum,
    I spendet a lot of hour just to add images to a QTextDocument (ok that was fast) but I can't get the picture out from this QTextDocument. Why in the hell is there a insertImage if it's not possible to get the picture. I have to save this QTextDocument and maybe edit it. Or is there another possibility for using RichText?

    Greetings and thanks for your answer.
    kea_

  2. #2
    Join Date
    Aug 2007
    Posts
    166
    Thanks
    16
    Thanked 14 Times in 14 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Why does the QTextCursor.insertImage exist when it's not possible to get the imag

    Create a QTextCursor and position it somewhere where the image is(you can iterate over the document until you find an image). In order to know if your cursor is on the image call charFormat(), then on the returned QTextCharFormat call isImageFormat(). If isImageFormat() returns true then cast the QTextCharFormat object to QTextImageFormat, then call the name() method. Using the name you can iterate over some of your created caches for images(maybe QHash<QString, QPixmap>) and get the real image.

  3. #3
    Join Date
    May 2010
    Posts
    15
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Why does the QTextCursor.insertImage exist when it's not possible to get the imag

    Thank you very much for your answer.
    I will check it out the next days.

    Greetings kea_

  4. #4
    Join Date
    May 2010
    Posts
    15
    Qt products
    Qt4
    Platforms
    Windows

  5. #5
    Join Date
    Aug 2007
    Posts
    166
    Thanks
    16
    Thanked 14 Times in 14 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Why does the QTextCursor.insertImage exist when it's not possible to get the imag

    Glad I helped. My hints were not very accurate as I see but I haven't doing this since a long time. Nice that you figured it out.

Similar Threads

  1. How to check Table already exist or not
    By damodharan in forum Qt Programming
    Replies: 3
    Last Post: 27th May 2010, 13:06
  2. QTextEdit and insertImage() Display on the Fly..
    By Undefined in forum Qt Programming
    Replies: 1
    Last Post: 13th July 2008, 19:48
  3. qtdemo doesn't exist...
    By xyzt in forum Newbie
    Replies: 2
    Last Post: 24th March 2008, 05:37
  4. QTextDocument and insertImage
    By bunjee in forum Qt Programming
    Replies: 13
    Last Post: 23rd January 2008, 21:03
  5. XML Database: eXist
    By Lykurg in forum Qt Programming
    Replies: 3
    Last Post: 6th March 2007, 23:22

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.