PDA

View Full Version : To add hypertext to QTextEdit



a_m_mukul
7th April 2008, 11:49
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,

aamer4yu
7th April 2008, 14:36
Try this,,,

QTextEdit::setTextInteractionFlags(Qt::LinksAccess ibleByMouse)

Try setting the content as html first
Hope it helps.

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

jpn
9th April 2008, 21: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?