PDA

View Full Version : Create new an event, help me?



dungsivn
4th July 2007, 09:09
Hi everyone, I want to create a new events receive mouse release events on the border of the QMainwindow but I don't know the code so that It( the event) can be called automatically. Untill now, the "mouse release event" can only receive the event inside the widget. After releasing that mouse event, I will repaint 60.000 components inside that window. Could you tell me the way to create or add a new event and It will be called automatically like "resizeEvent(...)" or "mouseReleaseEvent(...)"?
Thanks!

wysota
4th July 2007, 09:12
The "border" of the window is handled by the window manager and not by your application, so there is nothing really you can do here without at least digging into platform dependent API.

dungsivn
4th July 2007, 09:24
So, could you tell me other ways to solve my problem? Thanks!

wysota
4th July 2007, 10:07
But what is the problem?

dungsivn
4th July 2007, 10:13
I want to catch "mouseReleaseEvent" on the border of the main window to redraw the components inside the main window. During resizeEvent, I can't draw the window because it has 60.000 components. I can only draw one time after finishing resizing so that It can be faster. Thanks!

spud
4th July 2007, 11:00
In resizeEvent() check QApplication::mouseButtons() and only do the update if the left mouse isn't pressed.

wysota
4th July 2007, 11:22
I'm afraid resizeEvent will post a paintEvent by itself, so this is not a solution. I suggest optimizing the painting routine and maybe use the Graphics View framework to speed things up.