Highlight the area
-
wrote on 23 Apr 2013, 06:08 last edited by
Hi, I am using scribble example and i am trying to highlight the area on mouseMoveEvent. Please help me
-
wrote on 23 Apr 2013, 07:16 last edited by
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?
-
wrote on 23 Apr 2013, 07:31 last edited by
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. -
wrote on 23 Apr 2013, 11:41 last edited by
-
[quote author="mythili" date="1366717290"]Please find the attached link.
and whats your underlying "base" widget now?
-
wrote on 23 Apr 2013, 21:59 last edited by
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.)
-
wrote on 24 Apr 2013, 04:11 last edited by
raven-worx
My underlying base widget is QScrollArea.
Code_ReaQtor : Robot Herder
1) How to draw a dotted line rectangle. 2) How to highlight the area under the text.
-
wrote on 24 Apr 2013, 06:20 last edited by
[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?
-
wrote on 24 Apr 2013, 09:05 last edited by
I am having QWidget inside scrollarea.. I am writing in that area. After writing, i want to highlight some area with yellow color.
I am retrieving the start point and end point. Drawing a QRect . How to fill that area under the text.
-
so you have a basic QWidget (inside the scroll area) and do the painting of the text yourself?
-
wrote on 24 Apr 2013, 10:00 last edited by
I am painitng in that area. But i will select an area over the painted area, so that , the region should be highlighted with different color under the painted part.
9/13