Highlight the area
-
Providing more information might increase your chance to get answers... Which OS are you targeting? What exactly are you trying to do? What have you tried so far and how did the results fall short of your expectations?
-
I am using UBUNTU 12.04 and my Qt version is 5.0.
I have taken the scribble example. In scribble area, after writing the text or drawing something, i want to highlight some area i.e., i will move the mouse on the text which i want to highlight.
I am trying to read the point and setPen over that point..but its not working properly.
-
DO you mean "this one":http://harmattan-dev.nokia.com/docs/library/html/qt4/widgets-scribble.html?
Nevertheless i don't believe that there is any simple solution to what you want to do. There are too much open question how the solution should behave in various cases to find the best solution in first place. -
-
[quote author="mythili" date="1366717290"]Please find the attached link.
and whats your underlying "base" widget now?
-
I never tried to get into the Scribble's source code but I tried to implement this problem months ago.
Get the initial point via mousePressEvent and the other point via mouseReleaseEvent. Take note that there might be an offset in the resulting points since point(0,0) is on the top-left of the widget/window, so subtract if needed (e.g. margin is present). Get a QRect using the 2 points you obtained and implement your goal (e.g. cropping, drawing a rectangle on that region, etc.)
-
[quote author="mythili" date="1366776687"]
Code_ReaQtor : Robot Herder1) How to draw a dotted line rectangle. 2) How to highlight the area under the text.
[/quote]
- If you are going to use QPainter, just specify the PenStyle using QPainter::setPen()
- Sorry, I can't help you with that. :( I never tried to implement that.
-
[quote author="mythili" date="1366776687"]
My underlying base widget is QScrollArea.
[/quote]whats inside your scrollarea...or to make it clear: what widget holds your text?
-
so you have a basic QWidget (inside the scroll area) and do the painting of the text yourself?