Reputation: 4823
Using Qt 5.1 on OSX Mountain Lion, I'm noticing that my app is causing the computer to switch from built-in energy efficient graphics to the more power hungry discrete card.
Is there any way to prevent this from happening?
Upvotes: 4
Views: 534
Reputation: 437
Since Qt 5.3 it is possible by using special key in Info.plist for your Qt application.
1) To use custom Info.plist, set QMAKE_INFO_PLIST variable in *.pro file.
# qmake will copy this file to MyApp.app/Contents/Info.plist
QMAKE_INFO_PLIST = MyInfo.plist
By default, qmake generates generic Info.plist file, so you can use it as a template. You can also see the example here.
2) Then add the next key to the "dict" section of your Info.plist:
<dict>
... other keys here ...
<key>NSSupportsAutomaticGraphicsSwitching</key>
<true/>
</dict>
This key should work since Qt 5.3 (see this commit).
3) Make sure Qt will place your custom Info.plist file to the MyApp.app/Contents/Info.plist.
For some reason, Qt Creator won't update the Info.plist in the *.app file if it already exists. Thus, after the modifying Info.plist remove the *.app file from the build directory and rebuild the project to apply the changes.
Upvotes: 2