Results 1 to 2 of 2

Thread: Highlight all text in QTextBrowser when gaining focus

  1. #1
    Join Date
    Mar 2007
    Location
    Germany
    Posts
    229
    Thanks
    2
    Thanked 29 Times in 28 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Highlight all text in QTextBrowser when gaining focus

    Hello,

    I want to highlight all text in QTextBrowser when it gains focus. I couldn't find a suitable signal that tells me that the TextBrowser widget just gained focus.

    So I thought about reimplementing the focusInEvent, which seems to be the correct way. I derived a class MyTextBrowser from QTextBrowser.
    But as I am using the Designer for layouting my windows I don't know how to "replace" the used QTextBrowser object with a MyTextbrowser object.

    Or is there any other way to highlight all text in QTextBrowser when it gains focus?

  2. #2
    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: Highlight all text in QTextBrowser when gaining focus

    Quote Originally Posted by Boron View Post
    I want to highlight all text in QTextBrowser when it gains focus. I couldn't find a suitable signal that tells me that the TextBrowser widget just gained focus.

    So I thought about reimplementing the focusInEvent, which seems to be the correct way. I derived a class MyTextBrowser from QTextBrowser.
    Correct, it's not a signal but an event.

    But as I am using the Designer for layouting my windows I don't know how to "replace" the used QTextBrowser object with a MyTextbrowser object.
    See Promoting Widgets.
    J-P Nurmi

Similar Threads

  1. Unhandled exception in qatomic
    By NewGuy in forum Qt Programming
    Replies: 14
    Last Post: 23rd July 2013, 09:49

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.