This turned out to be really simple. I was trying to create a Mac OS X version of my game, Nanoparticles, and was having trouble with some flicker when running a QGraphicsView with OpenGL. The solution turned out to simply be to disable some style sheet settings that I didn’t need.
After this I wanted to create a nice .dmg file for easy deployment on Mac OS X. Thankfully, this process is not hard either. I found this through the Qt Documentation, but it is actually simpler than it seems thanks to the macdeployqt tool. This is mentioned on the page, but I decided to give a more thorough walk through on how to use the tool here:
- Build your application
In the build directory, run
macdeployqt yourappname.app -dmg
macdeployqt is found in the \~/Library/QtSDK/Desktop/Qt/474/gcc/bin folder (if that is where you installed Qt)
- You should now have a nice yourappname.dmg file in the build directory. Open this up and check that your application runs from there.
- If everything is working fine, you can do some prettifying of your .dmg file by opening it up using the Disk Utility and converting it to a Read/Write disk image.
Open your Read/Write disk image and create a shortcut to your Applications folder. This could either be done by dragging the Applications folder while holding the command key or by creating a symbolic link in terminal:
ln -s /Applications ./Applications
- Edit the icon size, background image, etc. by clicking Command + J to open the View Options. Also, use View -> Hide Toolbar and Hide Sidebar to hide the excessive toolbars from the disk image.
- Close the image and use Disk Utility to convert it back to a compressed disk image.
- Distribute your .dmg file.
If you need more details about the process and how deployment is performed, have a look in the Qt Docs.