[Qt-interest] Detect clicks over certain areas of a bitmap

Oliver.Knoll at comit.ch Oliver.Knoll at comit.ch
Fri Dec 19 11:24:02 CET 2008


Sergio Salas wrote on Thursday, December 18, 2008 10:33 PM:

> Hello,
> ...
> Is there any way to get a transparent button or define one area of a
> bitmap and detect when the user click on it?

Just a quick thought before lunch: you could implement a custom widget (derived from QWidget), draw your bitmap as background and detect the mouse clicks in the corresponding mouse event handler.

Then have a data structure with the "sensitive" QRects and detect wheter mouse x/y was in any one of those QRects.

I am sure there are more elegant ways, but this one should work...

Cheers, Oliver
--
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22




More information about the Qt-interest-old mailing list