[Interest] Finished resizing a window?

John Weeks john at wavemetrics.com
Tue Feb 25 18:29:51 CET 2014


Right- this is what Thiago meant in his reply to my original posting.

And verified on Mac OS X: before posting, I tried QApplication::mouseButtons() to detect the mouse state, and got false information. The mouse events that drive the resizing aren't getting to Qt at all.

Well, then again, putting a breakpoint in my resize handler, I see this:

0	grafRec::doResizeEvent	GrafRecImplementation.cpp	966	0x1011b0247	
1	wDataClass::baseDoResizeEvent	WM_WinClasses.cpp	1803	0x1010b5f40	
2	IgorWindowWdPContentArea::resizeEvent	IgorWindowContentArea.cpp	205	0x100a724a6	
3	QWidget::event	qwidget.cpp	8541	0x108547e4f	
4	IgorWindowWdPContentArea::event	IgorWindowContentArea.cpp	181	0x100a73225	
5	QApplicationPrivate::notify_helper	qapplication.cpp	4562	0x1084d520f	
6	QApplication::notify	qapplication.cpp	4527	0x1084d85f5	
7	IgorAppObject::notify	IgorAppObject.cpp	537	0x100a48d4d	
8	QCoreApplication::notifyInternal	qcoreapplication.cpp	949	0x109aefa2a	
9	QCoreApplication::sendEvent	qcoreapplication.h	231	0x10003be39	
10	QWidgetPrivate::setGeometry_sys_helper	qwidget_mac.mm	4624	0x10844af89	
11	QWidgetPrivate::setGeometry_sys	qwidget_mac.mm	4556	0x10844b7c8	
12	QWidget::setGeometry	qwidget.cpp	6974	0x108543a71	
13	QWidget::setGeometry	qwidget.h	1018	0x1085141ba	
14	QWidgetItem::setGeometry	qlayoutitem.cpp	490	0x108517855	
15	QGridBox::setGeometry	qgridlayout.cpp	85	0x1085093ae	
16	QGridLayoutPrivate::distribute	qgridlayout.cpp	964	0x108507411	
17	QGridLayout::setGeometry	qgridlayout.cpp	1460	0x108507534	
18	QLayoutPrivate::doResize	qlayout.cpp	679	0x108513721	
19	QLayout::widgetEvent	qlayout.cpp	703	0x108513dc9	
20	QApplicationPrivate::notify_helper	qapplication.cpp	4553	0x1084d51d9	
21	QApplication::notify	qapplication.cpp	4527	0x1084d85f5	
22	IgorAppObject::notify	IgorAppObject.cpp	537	0x100a48d4d	
23	QCoreApplication::notifyInternal	qcoreapplication.cpp	949	0x109aefa2a	
24	QCoreApplication::sendSpontaneousEvent	qcoreapplication.h	234	0x10843d6cf	
25	qt_sendSpontaneousEvent	qapplication.cpp	5560	0x1084d4770	
26	-[QCocoaWindowDelegate syncSizeForWidget:toSize:fromSize:]	qcocoawindowdelegate_mac.mm	139	0x10845d1bd	
27	-[QCocoaWindowDelegate windowDidResize:]	qcocoawindowdelegate_mac.mm	219	0x10845cd68	
28	_nsnote_callback			0x7fff868e6ad5	
29	__CFXNotificationPost			0x7fff88f6cfd0	
30	_CFXNotificationPostNotification			0x7fff88f59548	
31	-[NSNotificationCenter postNotificationName:object:userInfo:]			0x7fff868dda36	
32	-[NSWindow _setFrameCommon:display:stashSize:]			0x7fff807d284a	
33	-[NSTitledFrame resizeWithEvent:]			0x7fff80d79845	
34	-[NSTitledFrame mouseDown:]			0x7fff809ec255	
35	-[NSThemeFrame mouseDown:]			0x7fff809ec1bb	
36	-[NSWindow sendEvent:]			0x7fff808ea3a7	
37	-[QCocoaWindow sendEvent:]	qcocoasharedwindowmethods_mac_p.h	183	0x10845a01b	
38	-[NSApplication sendEvent:]			0x7fff8081fafa	
39	-[QNSApplication sendEvent:]	qcocoaapplication_mac.mm	186	0x1084604b7	
40	-[NSApplication run]			0x7fff807b66de	
41	QEventDispatcherMac::processEvents	qeventdispatcher_mac.mm	615	0x10846d37a	
42	QEventLoop::processEvents	qeventloop.cpp	149	0x109aec3ca	
43	QEventLoop::exec	qeventloop.cpp	204	0x109aec61c	
44	QCoreApplication::exec	qcoreapplication.cpp	1221	0x109af03a0	
45	QApplication::exec	qapplication.cpp	3823	0x1084d8630	
46	main	IgorQtMain.cpp	497	0x101f0fd77	

The lines at 39 and 37 are Qt code where the NSEvent type is 1, a mouse-down event. So Qt does have the information, but chooses not to use it. I haven't looked at Windows, and we're not yet in a position to look at Linux, so I don't know how it works there.

I was looking at writing a bit of Cocoa code (yuck) to catch NSWindowWillStartLiveResizeNotification and NSWindowDidEndLiveResizeNotification, but a QTimer would be easier. The square brackets are in the right places, and it works on Windows, too.

On 24-Feb-2014, at 5:50 PM, Jason H wrote:

> The problem is the window resize does not come from the application, it comes from the OS/Window Manager.
> 
> 
> From: "william.crocker at analog.com" <william.crocker at analog.com>
> To: interest at qt-project.org 
> Sent: Monday, February 24, 2014 8:46 PM
> Subject: Re: [Interest] Finished resizing a window?
> 
> 
> >
> > We have windows in our application that are potentially expensive to repaint, so
> > when the user resizes a window we may need to put off repainting until the
> > resizing is finished. It seems that we don't get mouse down/mouse up events when
> > the user clicks in the window frame/resize grip area, so I can't wait until
> > mouse up.
> >
> 
> Could you use this to watch for (then paint on) the mouse release?
> 
>     Qt::MouseButtons QApplication::mouseButtons() [static]
> 
> Bill
> 
> 
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
> 
> 
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest

-John

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140225/2790903d/attachment.html>


More information about the Interest mailing list