Highlighting search



  • Hi all,

    I want to know how can I highlight a text like Qt Creator does when is searching text. When I search text I can see a border arround the text and a yellow background, how can I reproduce it in my app.



  • [quote author="David Villalobos" date="1343065146"]Hi all,

    I want to know how can I highlight a text like Qt Creator does when is searching text. When I search text I can see a border arround the text and a yellow background, how can I reproduce it in my app.
    [/quote]

    What component do you use to store and display the text? If you are using QLabel or another widget the easiest way to change the background is using a "style sheet":http://qt-project.org/doc/qt-4.8/qwidget.html#styleSheet-prop.



  • Hi Leon,

    Thanks for your reply. This is what I need: when you search text in Qt Creator, the found text is sorrunded by a frame and the background color turns to yellow, that is the behavoir I need to implement.

    I use QTextDocument.


Log in to reply
 

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