Results 1 to 3 of 3

Thread: How can I paint a line in TextEdit on QT-4.3.2?

  1. #1
    Join Date
    Nov 2007
    Posts
    8
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default How can I paint a line in TextEdit on QT-4.3.2?

    How can I paint a line in TextEdit on QT-4.3.2?

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: How can I paint a line in TextEdit on QT-4.3.2?

    If "<hr/>" is insufficient, you can always reimplement its paintEvent() and open a QPainter on its viewport().
    J-P Nurmi

  3. #3
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How can I paint a line in TextEdit on QT-4.3.2?

    Other variant on svg xml you can create any Form and color image line round rect ecc...
    and insert on document and direct insert... at end only save to png or other...


    a symple line black 900 x 1 sample

    [HTML]
    <?xml version="1.0" standalone="no"?>
    <svg width="900" height="1" version="1.1" xmlns="http://www.w3.org/2000/svg">
    <rect
    x="0"
    y="0"
    width="900"
    height="1"
    style="fill:#000000;fill-opacity:0.87654322" />
    </svg>

    [/HTML]

    Qt Code:
    1. /* remember QT += svg on pro file */
    2.  
    3. static inline QPixmap RenderPixmapFromSvgByte( QByteArray streams ) /* or contenent from a svg file or a qdom stream dinamic created */
    4. {
    5. QSvgRenderer svgRenderer( streams );
    6. QPixmap pix( svgRenderer.defaultSize() );
    7. pix.fill(Qt::transparent);
    8. QPainter paint(&pix);
    9. svgRenderer.render(&paint);
    10. return pix;
    11. }
    12.  
    13. /* and insert image .. */
    14.  
    15. imgresor = QUrl(QString(":/png/external-paste-%1").arg(TimestampsMs));
    16.  
    17. ////// ImageContainer.insert(imgresor.toString(),derangedata); /* save internal stream data */
    18. resultimage = QPixmap( your forms );
    19. document()->addResource(QTextDocument::ImageResource,imgresor,resultimage);
    20. format.setName( imgresor.toString() );
    21. format.setHeight ( scaledsimage.height() );
    22. format.setWidth ( scaledsimage.width() );
    23. format.setToolTip(imgresor.toString());
    24. textCursor().insertImage( format );
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Qwizard crashed when created in a slot
    By joshlareau in forum Qt Programming
    Replies: 9
    Last Post: 15th January 2008, 09:16
  2. Access Violation on Signal Emit
    By khagzan in forum Qt Programming
    Replies: 2
    Last Post: 25th September 2007, 22:51
  3. KDE/QWT doubt on debian sarge
    By hildebrand in forum KDE Forum
    Replies: 13
    Last Post: 25th April 2007, 06:13
  4. QTableView paints too much
    By Jimmy2775 in forum Qt Programming
    Replies: 2
    Last Post: 26th July 2006, 18:42

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.