Deploying Qt Quick Applications that rely on Qt Mobility on Windows…

Whew! Some things seem to take forever for me to figure out!

Here’s the scenario: we’re working on a Qt Quick (QML and C++) application at the lab to run on Microsoft Windows. We’d like to deploy the app to a bunch of study participants to use for a week or so. It’s obviously not practical for me to go around and set everybody up with Qt, Qt Mobility, and build our app. (Especially not this app; we’re using the Qt 4.8 prerelease at this point!). So we need to build a Windows installer that includes the Qt DLLs, our app and its QML, and the Qt Mobility plugins we’re using. We’re using Qt Mobility in our QML — so we need to include the Qt Mobility plugins for Qt Quick, not just the Qt Mobility libraries.

Packaging a Qt application for Windows is straightforward — just follow these instructions for packaging as a shared library. But what about the Qt Quick plugins for Qt Mobility we need?

Well, Qt Quick supports modules for that, as described here. In fact, if your application required QtWebKit’s Qt Quick plugin, you’d create a QtWebKit directory, stick a qmldir file with the line

plugin QtWebKit

copy qtwebkitplugin.dll into the directory you made and Bob’s your uncle!

We use QtMultimediaKit, so at first I created a QtMultimediaKit directory, created a qmldir file in that directory, and copied QtMultimediaKit1.dll from my Qt Mobility build output directory to the QtMultimediaKit directory I’d created.

No luck — in fact, the app just launches and shows nothing. (To add insult to injury, my app uses Qt’s support for Open GL, so not only did I not get the black screen characteristic of a QML error, but I got junk in the application window and no errors on the console.)

Turns out that QtMultimediaKit1.dll goes in the same directory as the application, and the declarative plugin file is somewhere else! If you look in the plugins directory, you’ll see a declarative directory, and the actual Qt Quick declarative plugin you’re looking for is in there! In my case, I needed to copy plugins/declarative/multimedia/release/declarative_multimedia.dll to a new directory QtMultimediaKit, create a single qmldir file that read

plugin declarative_multimedia

and put that adjacent to my application executable.

So, the resulting files and directories for me look something like:

imageformats/qgif4.dll
imageformats/qjpeg.dll
QtMultimediaKit/declarative_multimedia.dll
QtMultimediaKit/qmldir
msvcr90.dll
QtCore4.dll
QtDeclarative4.dll
QtGui4.dll
QtMultimedia4.dll
QtMultimediaKit1.dll
QtNetwork4.dll
QtOpenGL4.dll
QtScript4.dll
QtSql4,dll
QtXml4.dll
QtXmlPatterns4.dll
myapplication.exe

Now off to learn how to make a Windows installer. I think I’ll try Inno Setup.

Nokia N9 PR 1.1 and new Qt SDK…

The N9 PR 1.1 is out, with lots of great updates. Your N9 should see the update automatically; if like me you’re in a hurry:

  1. Open Settings
  2. Choose Applications
  3. Choose Manage Applications
  4. Press Updates
  5. Press the refresh button at the top of the display.

Budget about a half hour for the update; it downloads the update over WiFi or the cell connection, and then re-flashes your device. While it’s updating, your phone won’t do anything else (although I had a calendar alarm pop up during the update process!) I followed the suggestion and made a back-up first, although it looks like user data preservation works correctly; I didn’t lose anything after the update.

To go along with this, be sure to check out the new Qt SDK! See here for the links and news about what’s in it. I’ve been using Qt Mobility 1.2 on the desktop for a while, so it’s nice to have an integrated build with all the bits and pieces.

Happy hacking!

Enabling WiFi Hotspot on Nokia N9s in the United States…

I’m going to forget this the first time I have to reset my Nokia N9.

As it turns out, the WiFi Hotspot mode on the N9 doesn’t fully meet FCC SAR regulations, so it’s disabled in the United States (launching it generates a brief error and then the app exits). While I appreciate Nokia’s respect for regulations, I don’t plan on holding my N9 close to soft tissues while in hotspot mode, and dang it, I need hotspot mode occasionally.

Fortunately, brighter folks than me have found a hack; here’s a link to a post by salyavin at talk.maemo.org. It involves adding a new startup script that touches a configuration file on boot to enable the application. You’ll need to download the script from the link, install developer mode if you haven’t, and copy the script to the correct location.

Now my iPhone can stay safely locked in my desk drawer on weekends when I go cafe-hopping!

Edit: Another link with the same information is