PDA

View Full Version : problem with mouse release on the border, help me!



dungsivn
25th June 2007, 06:00
Hi everybody, in my project, after resizing a widget, I want to catch "mouseReleaseEvent(...)" to redraw the whole widget but "mouseReleaseEvent(...)" is only caught inside the widget, not on the border of the widget. I don't want redraw the whole widget when resizing the widget because It makes the program so slow. After releasing the left mouse on the widget, I will redraw the whole widget.

So, could you help me? Thanks!

wysota
25th June 2007, 08:16
Override the resizeEvent() if you need that. Although when you resize the widget paintEvent() will be called automatically, so properly reimplementing paintEvent() should be enough. There are ways you can use to optimize the redrawing - for example only repaint the part that really needs repainting - look at QPaintEvent::rect(). You can also use Qt::WA_StaticContents and Qt::WA_OpaquePaintEvent attributes if your widget conforms to their requirements.