[Qt-interest] a clickable bitmap question

Bo Thorsen bo at fioniasoftware.dk
Sat Oct 29 13:03:50 CEST 2011


Den 28-10-2011 19:30, Marek Bronowicki skrev:
> Hello
>
> I received a question about a feature in software.. i'll try to explain
> what I need to create.
>
> The goal is to create some class that will show bitmap with some area of
> building, and after clicking in area of rectangle that I will prepare
> (for example 100,100 to 200,200) it will show some information about the
> area... something like electronic museum guide... it's still a simple
> thing, because when I get the position of cursor, and get the click I
> just check with defined rectangles. The problem for me is when I need to
> zoom the bitmap, because it's too big to show on one screen, and if I
> will show all, the room rectangles will  have about a square of four
> pixels (try to touch it with finger on touch screen :-) )
>
> Second thing is to change color of area which is just clicked, but I
> think it's a simple thing to create QPixmap and just show it in the area.
>
> Could someone give me some hint what to use? I used the QPixmap and
> QLabel just for showing simple bitmaps, so I just don't know what to
> use... QGraphicsView maybe?

I would probably do this with QGraphicsView. You can do it yourself with 
a QWidget subclass, but QGV gives you the zooming and handles the 
clicking for you. Each of those two are easy to implement by themselves, 
but when you need both clicking and zooming, I always recommend QGV.

Bo Thorsen,
Fionia Software.

-- 

Expert Qt and C++ developer for hire
Contact me if you need expert Qt help
http://www.fioniasoftware.dk



More information about the Qt-interest-old mailing list