PDA

View Full Version : Detect screen rotation or resize



leoalvesmachado
8th April 2010, 18:35
Hi folks...

I'm just starting to develop using qt and c++, and I'm having a problem that seems to be kind of easy to solve.
Basically I want to detect when the screen is rotated or resized, so I can play an animation when that happens. Today I am able to get screen size and orientation easily, but I don't know how to "hear the event" thrown by the system when the screen gets rotated (or resized) to know when to play my animation.
I've already tryed the code in this link, but unfortunatelly the function is not called when the screen gets rotated or resized.
http://msdn.microsoft.com/en-us/library/ms812142.aspx#detectscreenorient_topic3

Can you help me on this?
I'm using Windows XP, but I'd like the code to work in any platform, if possible (including phones, tablets, etc...).


thanks in advance

leoalvesmachado
8th April 2010, 22:28
Well, I could not detect the screen rotation/resize yet, but with a maximized widget, I use the widget's resizeEvent to get when the resolution changes or the screen is rotated... For now, it works for me :)

soulless
9th April 2010, 01:20
Test resized signal in QDesktopWidget class to detect screen resize.



connect(QApplication::desktop(), SIGNAL(resized(int)), this, SLOT(YouSlot(int));