Results 1 to 13 of 13

Thread: insert image at the bottom of QTextEdit

  1. #1
    Join Date
    Oct 2009
    Posts
    14
    Thanks
    3
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Question insert image at the bottom of QTextEdit

    Hello,

    I need to insert an image as a footer in QTextEdit.

    How can I reach the end of the QTextEdit and put the image.

    How can I stick it in that place.

    Thanks a lot

  2. #2
    Join Date
    Dec 2008
    Location
    TaganrogNativelandChehov,Russia
    Posts
    64
    Thanks
    1
    Thanked 8 Times in 7 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: insert image at the bottom of QTextEdit

    may be
    http://www.wysota.eu.org/wwwidgets/
    helps you.
    see QwwButtonLineEdit
    and
    QwwClearLineEdit
    east or west home is best

  3. #3
    Join Date
    Oct 2009
    Posts
    14
    Thanks
    3
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: insert image at the bottom of QTextEdit

    Thanks Kwisp,
    That seems interesting.
    Unfortunately, the feature am looking for is not likely to be implemented by wwWidgets ..
    Any other suggestions ? ..
    Last edited by Cortex; 22nd October 2009 at 16:16.

  4. #4
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: insert image at the bottom of QTextEdit

    Hi,

    first we - at least I - prefer normal font size. Second I only see a possibility for your footer if you subclass QTextEdit and watch the modification of the QTextDocument. There you must ensure that the footer is the last text. If that isn't the case, change the document.

  5. #5
    Join Date
    Oct 2009
    Posts
    14
    Thanks
    3
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: insert image at the bottom of QTextEdit

    Sorry for the font size.

    Lykurg, I didn't see your point, my footer is not a text it's an image.

    Well, I ended up with:
    - Subclassing textEdit
    - Reimplementing paintEvent()
    - inserting the image as Pixmap using painter.drawPixmap()

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: insert image at the bottom of QTextEdit

    Is the footer part of the document or part of the widget? If the latter, then indeed looking at wwWidgets' source code might be helpful.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    Oct 2009
    Posts
    14
    Thanks
    3
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: insert image at the bottom of QTextEdit

    It's rather the former .. I need to print it with the document later.

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: insert image at the bottom of QTextEdit

    So what is the problem? Just insert the footer into the document and don't allow the user to edit it.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  9. #9
    Join Date
    Oct 2009
    Posts
    14
    Thanks
    3
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: insert image at the bottom of QTextEdit

    How to do that? I mean inserting the footer in the document.

  10. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: insert image at the bottom of QTextEdit

    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  11. #11
    Join Date
    Oct 2009
    Posts
    14
    Thanks
    3
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: insert image at the bottom of QTextEdit

    How to make the cursor go down to the bottom of the document and insert the image, stick it there so it won't move if the user edit the document ?
    That was exactly my question from the beginning.

    As I said earlier, the best solution I found is to draw it with paintEvent().

  12. #12
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: insert image at the bottom of QTextEdit

    Just go through QTextDocument and QTextCursor API. QTextCursor::insertImage is the most likely thing to use to insert an image, don't you think?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  13. #13
    Join Date
    Oct 2009
    Posts
    14
    Thanks
    3
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: insert image at the bottom of QTextEdit

    I've seen all these classes, before I post here.
    It's not about simply insert an image into a QTextDocument.
    Anyway I managed to solve it now.
    I do thank you.

Similar Threads

  1. Insert image in RTL QTextEdit problem!
    By SudaNix in forum Newbie
    Replies: 2
    Last Post: 23rd October 2009, 22:53
  2. [Qt4.1] How to insert an image inside a Form?
    By Gonzalez in forum Qt Tools
    Replies: 5
    Last Post: 23rd September 2008, 11:20
  3. QTextEdit slow to insert text
    By thomaspu in forum Qt Programming
    Replies: 4
    Last Post: 10th January 2008, 12:05
  4. Replies: 1
    Last Post: 3rd October 2007, 07:34
  5. QTextEdit and delayed image loading
    By Vladimir in forum Qt Programming
    Replies: 5
    Last Post: 27th April 2007, 08:13

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.