This is a journal of my adventures trying to build and use Qt for apps running on Windows 8 Metro tablet. It’s going to be long, rambling and full of randomness, but also maybe with some useful info or nuggets for anyone trying to do the same.. Read on for more. This story gets updated as the story unfolds!
Last updated: 24.7.2012
First things first – machines
I needed a tablet device that runs Windows 8 CP (“Consumer Preview”), and a machine to build Qt for Metro on. I already had a target device: The ExoPC x86 tablet Intel was kind enough to give me last year. It can run the 32-bit version of Windows 8 CP so I proceeded to install Windows 8 CP on it, which went fine. Didn’t even need to plug in a hardware keyboard to do it, unlike some other operating systems I’ve tried on it.
For development purposes, Microsoft gives a free version of Visual Studio 2011 Express, but the catch is that it must run on Windows 8. I had no spare machine to dedicate to this, so I chose to use a VMWare 8 virtual machine instead. Getting Windows 8 CP 64-bit to install into a virtual machine was pretty straightforward; just choose “Windows 7 x64″ as the guest OS type – and do the install on your own using the .ISO image as a virtual DVD drive. However to get it working fully, I had problems with VMWare Tools – if I install the video drivers, the screen goes black. I eventually found some tips on various forums that reducing the amount of RAM in the guest to 2GB during installation of VMWare Tools will fix this, and so they did. Still even now, if I enable more than 3 gigabytes of RAM, the VMWare video driver will not load, resulting in poor graphisc performance. To be on the safe side, I’ve settled on about 2900 megabytes of memory for the guest.
Another small thing was the screen resolution. Setting it inside the guest Windows 8 didn’t fully work – I have a 2560×1440 screen and Windows offered 2560×1600 as a resolution. I chose the View->Autosize-Autofit Guest option from VMWare instead, which works fine.
Installing Visual Studio Express 2011
This is where the fun really starts. I wasted two evenings to this one because of a problem, which was ultimately very simple to fix. I installed VS 2011 Express using the web installer, it would download lots of stuff over my slow network connection, and when done, it wouldn’t work. I would get several error messages such as “The ‘Visual Studio Component Model Host Package’ did not load correctly.” upon startup, and creating new projects didn’t work. I searched the net, and found the same advice several times over and over: Delete your Visual Studio folders from C:\USERS\yourusername\AppData\Local\Microsoft and from C:\USERS\yourusername\AppData\Roaming\Microsoft. But it didn’t help at all. I tried a couple of times with different kinds of clean install Windows 8 CP virtual machines, both 32- and 64-bit, and always ran into the same problem.
[I also wasted some more time installing Visual Studio 2011 Professional Beta into my host Windows 7 environment along with the Windows 8 SDK. Being no Microsoft expert I was not quite sure if this could work for building apps for Windows 8 Metro, as try as I might, I couldn’t find a way to create a new C++ Metro Style project from the IDE. Hopefully someone who reads this will explain this part to me.]
Then FINALLY someone on one of the Microsoft developer forums dropped a hint: Change your language and input formats to US English! I had been using US English as a language but Finnish for the input formats. Switching these all to US English (and whatever else I could find that I could switch to US English, including System Locale, just in case…) solved the problem! So finally, I am ready to run VS Express 2011. Never mind the formats, I can even tolerate the funny US date format, I just want to compile stuff in this virtual machine.
Now that I finally had a working build environment, I naturally made a snapshot of my virtual machine so I can save hours of my time next time something goes wrong. It’s time to start digging into the actual building work!
Qt on Metro? Or Metro QML Components?
The two main resources for the actual Qt on Metro that I found are:
Qt on Metro, a project on Nokia Developer: https://projects.developer.nokia.com/qt_metro
This one attempts to enable creating sandboxed Metro apps using Qt and QML. While it looks promising, the last update to this project was 6 months ago and I don’t know if this work still continues. Nevertheless, this is was I am primarily going to try – and the reason why I spent 2 days putting together my Visual Studio 2011 Express environment, as the Qt on Metro instructions state you need it for building Qt.
Digia’s Qt Commercial blog, two postings from Sami Makkonen:
http://www.digia.com/en/Blogs/Qt-blog/Sami-Makkonen/Dates/2012/1/2012/ “How to create Qt Applications with Metro Style”
Of these the first one gives some examples on how to style QML and Qt C++ apps to look like Metro. It also hints that Digia is working on Metro QML components but gives no timeframe or other details.
Ideally both projects could be combined for creating Metro-styled apps that run in the Metro sandbox model, and this is what I will now continue to do, or fail trying…
After a bit of pause I got back to this endeavour. I installed a Samsung 830 256GB SSD disk to speed up my hackings, and proceeded to try and build Qt for Metro according to the “Qt on Metro” wiki linked above. In the end it went smoothly with the longer configure.exe command line that includes QtDeclarative & friends; however the list of header and library files that you need to get from the Windows 7 SDK is not complete, as I found by trial and error. Here’s an amendment to that list:
accctrl.h security.h secext.h windowsx.h qos.h ws2ipdef.h in6addr.h imm32.lib winmm.lib activscp.h mswsockdef.h
I haven’t finished what I started, having been sidetracked with other things. But today at least I noticed that the Nokia Developer Qt_Metro page is being updated, showing signs of life for the first time in several months. Maybe the project is not so dead after all? Will be interesting to see what transpires there. And does it have anything to do with Nokia’s apparent cancellation of their last, great Qt based mobile phone platform in June?