Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt QTextBrowser How to capture text and change its cursor
Forum Updated to NodeBB v4.3 + New Features

Qt QTextBrowser How to capture text and change its cursor

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    umen242
    wrote on last edited by
    #1

    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;
                setCursor(newCursor);
            }
    

    e->accept();

    }@

    what im doing wrong here ?

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved