View Full Version : To add hypertext to QTextEdit

7th April 2008, 12:49

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.


7th April 2008, 15:36
Try this,,,

QTextEdit::setTextInteractionFlags(Qt::LinksAccess ibleByMouse)

Try setting the content as html first
Hope it helps.

9th April 2008, 08:00
That already I have done and things didn't work.

9th April 2008, 22:32
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?