I want to hightlight the text in QWidget i..e, text in the scribble area on mouseMoveEvent which is same as highlight done in word document. Color should be brushed under the word.
I want to hightlight the text in QWidget i..e, text in the scribble area on mouseMoveEvent which is same as highlight done in word document. Color should be brushed under the word.
Are you trying to use QLabel or any text display widget ? Or Painter ?
I am using the scribble example. I want to highlight the text in the scribble area
There is no "text" in the "scribble area", it's just a bunch of pixels. If you want to draw a line under something that's already been drawn in the widget's client area then you want QPainter::drawLine(). If you want to draw underlined text in the widget's client area then you use QPainter::drawText() with a QFont that has underlining turned on.
Thank u. I have drawn something in the scribble area. I want to highlight the selected area on mouseMoveEvent. Can u help me some lines of code.
If you want selection (and other graphical interactions) you better should look at Diagram Scene Example. Scribble example will not help you.
Bottom line is that you need to use QGraphicsScene and QGraphicsView.
When you know how to do it then you may do it wrong.
When you don't know how to do it then it is not that you may do it wrong but you may not do it right.
If you just want to highlight the entire image, try QImage::invertPixels()
But if you want to work gui interactions (try QGraphicsScene as Santhosh told)
If you are developing text editor, Then you check QTextEdit. This will take care of highlighting the word selection.Color should be brushed under the word
Bala
Last edited by BalaQT; 24th April 2013 at 08:43.
Bookmarks