[SOLVED] QDialog in fullscreen - disable OS screensaver?
-
wrote on 17 Dec 2014, 02:53 last edited by
Anyone good with Objective-C?
I'm getting theses error tryings to compile the new class (mm file) I just added:
duplicate symbol __ZN8MacUtilsC2Ev in:
MacUtils.o
macutils.o
duplicate symbol __ZN8MacUtilsC1Ev in:
MacUtils.o
macutils.oSeems like a conflict with
@#import <IOKit/pwr_mgt/IOPMLib.h> in MacUtil.mm@
and my .pro has already theses:
@ LIBS += -framework IOKit
LIBS += -framework CoreFoundation@ -
wrote on 17 Dec 2014, 02:53 last edited by
Anyone good with Objective-C?
I'm getting theses error tryings to compile the new class (mm file) I just added:
duplicate symbol __ZN8MacUtilsC2Ev in:
MacUtils.o
macutils.o
duplicate symbol __ZN8MacUtilsC1Ev in:
MacUtils.o
macutils.oSeems like a conflict with
@#import <IOKit/pwr_mgt/IOPMLib.h> in MacUtil.mm@
and my .pro has already theses:
@ LIBS += -framework IOKit
LIBS += -framework CoreFoundation@ -
wrote on 17 Dec 2014, 03:02 last edited by
Solved, I had 2 times the OBJECTIVE_SOURCES directive in my pro file pointing to the same .mm file.
Will have to go learn Objective-C now, sigh.. :) -
wrote on 17 Dec 2014, 03:02 last edited by
Solved, I had 2 times the OBJECTIVE_SOURCES directive in my pro file pointing to the same .mm file.
Will have to go learn Objective-C now, sigh.. :) -
wrote on 17 Dec 2014, 04:12 last edited by
Working for both Windows and OS X!
On dialog open (constructor):
@// Disable ScreenSaver
#ifdef Q_OS_MAC
macUtil.disableScreensaver();
#else
SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, FALSE , NULL, SPIF_SENDWININICHANGE);
#endif@On dialog close (destructor):
@#ifdef Q_OS_MAC
macUtil.releaseScreensaverLock();
#else
SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, TRUE , NULL, SPIF_SENDWININICHANGE);
#endif@Tested and work for Windows, if you have no screensaver, it will not put one with the the destructor, all possible cases seems to work
-
wrote on 17 Dec 2014, 04:12 last edited by
Working for both Windows and OS X!
On dialog open (constructor):
@// Disable ScreenSaver
#ifdef Q_OS_MAC
macUtil.disableScreensaver();
#else
SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, FALSE , NULL, SPIF_SENDWININICHANGE);
#endif@On dialog close (destructor):
@#ifdef Q_OS_MAC
macUtil.releaseScreensaverLock();
#else
SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, TRUE , NULL, SPIF_SENDWININICHANGE);
#endif@Tested and work for Windows, if you have no screensaver, it will not put one with the the destructor, all possible cases seems to work
-
You should rather use a elif defined(Q_OS_WIN) since it's completely platform specific
-
You should rather use a elif defined(Q_OS_WIN) since it's completely platform specific
-
Working for both Windows and OS X!
On dialog open (constructor):
@// Disable ScreenSaver
#ifdef Q_OS_MAC
macUtil.disableScreensaver();
#else
SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, FALSE , NULL, SPIF_SENDWININICHANGE);
#endif@On dialog close (destructor):
@#ifdef Q_OS_MAC
macUtil.releaseScreensaverLock();
#else
SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, TRUE , NULL, SPIF_SENDWININICHANGE);
#endif@Tested and work for Windows, if you have no screensaver, it will not put one with the the destructor, all possible cases seems to work
wrote on 2 Feb 2016, 20:37 last edited by@maximus said:
Working for both Windows and OS X!
On dialog open (constructor):
@// Disable ScreenSaver
#ifdef Q_OS_MAC
macUtil.disableScreensaver();
#else
SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, FALSE , NULL, SPIF_SENDWININICHANGE);
#endif@On dialog close (destructor):
@#ifdef Q_OS_MAC
macUtil.releaseScreensaverLock();
#else
SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, TRUE , NULL, SPIF_SENDWININICHANGE);
#endif@Tested and work for Windows, if you have no screensaver, it will not put one with the the destructor, all possible cases seems to work
Can you share your source or at least the relevant part? I've been using the same code for my app to disable/re-enable on Windows, but now need to do the same for Mac clients. Thanks.