[Qt-interest] How can I draw lines on QLabel ?

Ender EREL erelender at yahoo.com
Mon Aug 31 16:06:16 CEST 2009


st_322 wrote:
> Hi,all
>      I am a fresh of Qt,I use QLabel displayed a image file(bmp 
> format),but don't know how to draw lines over it.Dose someone know the 
> question and resolving method? Thanks a lot.
> 
> 
> ------------------------------------------------------------------------
> ûÓÐ¹ã¸æµÄÖÕÉíÃâ·ÑÓÊÏä,www.yeah.net <http://www.yeah.net/?from=footer>

Subclass QLabel & override the paintEvent. In the paintEvent, You can 
use QPainter for all your drawing needs. If you want the user to 
interact with the painting using mouse, you need to override the mouse 
events, i.e. mouseMoveEvent, mousePressEvent, mouseReleaseEvent.

-- 
Ender EREL



More information about the Qt-interest-old mailing list