Qt QTextBrowser How to capture text and change its cursor

  • I have QTextBrowser with delegate class , in the QTextBrowser i set html text with links , but in this html i have text that looks like link with css like this:

    @"<span style=" font-size:8pt; text-decoration: underline; color:#ffffff;">dummy_link</span>"@

    i like to change the cursor type to point when the mouse over it . and then trigger Qt function . the problem is that when i try to implement in the QTextBrowser with delegate class the mouseMoveEvent(QMouseEvent *e) like this : all other links ( tags )loss there pointer cursors here is when i do :

    @void TextBrowserDelegate::mouseMoveEvent(QMouseEvent *e)
    QCursor newCursor = cursor();
    Qt::CursorShape CurrCursor = newCursor.shape();

            QTextCursor tc = cursorForPosition( e->pos() );
            tc.select( QTextCursor::WordUnderCursor ); 
            QString sharStr = tc.selectedText();
            if(sharStr == "dummy_link")
                Qt::CursorShape newCursor =   Qt::PointingHandCursor;//Qt::ArrowCursor;



    what im doing wrong here ?

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.