Results 1 to 4 of 4

Thread: To add hypertext to QTextEdit

  1. #1
    Join Date
    Jul 2007
    Posts
    11
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default To add hypertext to QTextEdit

    Hi,

    I am using Qt4.2.2.

    I am trying to add some text to QTextEdit as an hypertext.

    I could add it by adding as "html".

    The feature I want to add is... whenever user moves
    his/her mouse on "html" formatted text... the cursor should change
    to "hand cursor" like we see the feature in QAssistant or any webpage.

    Where user can click on hypertext and can select it.

    I tried with many options... like adding as QTextBlock,
    QTextDocumentFragment, by use of QTextCharFormat
    and reimplementaion of QMouseMoveEvent but couldn't succed.

    Thanks,

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: To add hypertext to QTextEdit

    Try this,,,
    QTextEdit::setTextInteractionFlags(Qt::LinksAccess ibleByMouse)
    Try setting the content as html first
    Hope it helps.

  3. The following user says thank you to aamer4yu for this useful post:

    a_m_mukul (9th April 2008)

  4. #3
    Join Date
    Jul 2007
    Posts
    11
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: To add hypertext to QTextEdit

    That already I have done and things didn't work.

  5. #4
    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: To add hypertext to QTextEdit

    Quote Originally Posted by a_m_mukul View Post
    That already I have done and things didn't work.
    Exactly what "doesn't work"? Cursor doesn't change, link is not opened or what?
    J-P Nurmi

Similar Threads

  1. QTextEdit slow to insert text
    By thomaspu in forum Qt Programming
    Replies: 4
    Last Post: 10th January 2008, 12:05
  2. QTextEdit, sizeHint, QWidget
    By TheKedge in forum Qt Programming
    Replies: 1
    Last Post: 3rd February 2007, 08:25
  3. QTextEdit API questions (plain text)
    By Gaspar in forum Qt Programming
    Replies: 4
    Last Post: 16th May 2006, 06:03
  4. [QT 4] QTextEdit performance
    By fellobo in forum Qt Programming
    Replies: 8
    Last Post: 6th March 2006, 19:27
  5. Painting to QTextEdit
    By gesslar in forum Qt Programming
    Replies: 8
    Last Post: 18th February 2006, 18:40

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.