PDA

View Full Version : Highlight all text in QTextBrowser when gaining focus



Boron
5th August 2008, 20:29
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?

jpn
5th August 2008, 20:44
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 (http://doc.trolltech.com/4.4/designer-using-custom-widgets.html#promoting-widgets).