{"id":388,"date":"2011-11-09T10:39:12","date_gmt":"2011-11-09T17:39:12","guid":{"rendered":"http:\/\/www.lothlorien.com\/kf6gpe\/?p=388"},"modified":"2012-01-02T15:17:27","modified_gmt":"2012-01-02T22:17:27","slug":"deploying-qt-quick-applications-that-rely-on-qt-mobility-on-windows","status":"publish","type":"post","link":"https:\/\/www.lothlorien.com\/kf6gpe\/deploying-qt-quick-applications-that-rely-on-qt-mobility-on-windows\/","title":{"rendered":"Deploying Qt Quick Applications that rely on Qt Mobility on Windows&#8230;"},"content":{"rendered":"<p>Whew! Some things seem to take <em>forever<\/em> for me to figure out!<\/p>\n<p>Here&#8217;s the scenario: we&#8217;re working on a Qt Quick (QML and C++) application at the lab to run on Microsoft Windows. We&#8217;d like to deploy the app to a bunch of study participants to use for a week or so. It&#8217;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&#8217;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&#8217;re using. We&#8217;re using Qt Mobility in our QML &#8212; so we need to include the Qt Mobility plugins for Qt Quick, not just the Qt Mobility libraries.<\/p>\n<p>Packaging a Qt application for Windows is straightforward &#8212; just follow <a href=\"http:\/\/doc.qt.nokia.com\/latest\/deployment-windows.html\">these<\/a> instructions for packaging as a shared library. But what about the Qt Quick plugins for Qt Mobility we need?<\/p>\n<p>Well, Qt Quick supports modules for that, as described <a href=\"http:\/\/doc.qt.nokia.com\/4.7-snapshot\/qdeclarativemodules.html\">here<\/a>. In fact, if your application required QtWebKit&#8217;s Qt Quick plugin, you&#8217;d create a QtWebKit directory, stick a <code>qmldir<\/code> file with the line<br \/>\n<code><br \/>\nplugin QtWebKit<br \/>\n<\/code><br \/>\ncopy <code>qtwebkitplugin.dll<\/code> into the directory you made and Bob&#8217;s your uncle!<\/p>\n<p>We use QtMultimediaKit, so at first I created a <code>QtMultimediaKit<\/code> directory, created a <code>qmldir<\/code> file in that directory, and copied <code>QtMultimediaKit1.dll<\/code> from my Qt Mobility build output directory to the <code>QtMultimediaKit<\/code> directory I&#8217;d created.<\/p>\n<p>No luck &#8212; in fact, the app just launches and shows nothing. (To add insult to injury, my app uses Qt&#8217;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.)<\/p>\n<p>Turns out that <code>QtMultimediaKit1.dll<\/code> goes in the same directory as the application, and the declarative plugin file is somewhere else! If you look in the <code>plugins<\/code> directory, you&#8217;ll see a <code>declarative<\/code> directory, and the actual Qt Quick declarative plugin you&#8217;re looking for is in there! In my case, I needed to copy <code>plugins\/declarative\/multimedia\/release\/declarative_multimedia.dll<\/code> to a new directory <code>QtMultimediaKit<\/code>, create a single <code>qmldir<\/code> file that read<br \/>\n<code><br \/>\nplugin declarative_multimedia<br \/>\n<\/code><br \/>\nand put that adjacent to my application executable.<\/p>\n<p>So, the resulting files and directories for me look something like:<br \/>\n<code><br \/>\nimageformats\/qgif4.dll<br \/>\nimageformats\/qjpeg.dll<br \/>\nQtMultimediaKit\/declarative_multimedia.dll<br \/>\nQtMultimediaKit\/qmldir<br \/>\nmsvcr90.dll<br \/>\nQtCore4.dll<br \/>\nQtDeclarative4.dll<br \/>\nQtGui4.dll<br \/>\nQtMultimedia4.dll<br \/>\nQtMultimediaKit1.dll<br \/>\nQtNetwork4.dll<br \/>\nQtOpenGL4.dll<br \/>\nQtScript4.dll<br \/>\nQtSql4,dll<br \/>\nQtXml4.dll<br \/>\nQtXmlPatterns4.dll<br \/>\nmyapplication.exe<br \/>\n<\/code><\/p>\n<p>Now off to learn how to make a Windows installer. I think I&#8217;ll try <a href=\"http:\/\/www.jrsoftware.org\/isinfo.php\">Inno Setup<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Whew! Some things seem to take forever for me to figure out! Here&#8217;s the scenario: we&#8217;re working on a Qt Quick (QML and C++) application at the lab to run on Microsoft Windows. We&#8217;d like to deploy the app to a bunch of study participants to use for a week or so. It&#8217;s obviously not &hellip; <a href=\"https:\/\/www.lothlorien.com\/kf6gpe\/deploying-qt-quick-applications-that-rely-on-qt-mobility-on-windows\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Deploying Qt Quick Applications that rely on Qt Mobility on Windows&#8230;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10,9],"tags":[21,20,22,23],"class_list":["post-388","post","type-post","status-publish","format-standard","hentry","category-mobile","category-programming","tag-qml","tag-qt","tag-qt-quick","tag-windows"],"_links":{"self":[{"href":"https:\/\/www.lothlorien.com\/kf6gpe\/wp-json\/wp\/v2\/posts\/388","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.lothlorien.com\/kf6gpe\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.lothlorien.com\/kf6gpe\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.lothlorien.com\/kf6gpe\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lothlorien.com\/kf6gpe\/wp-json\/wp\/v2\/comments?post=388"}],"version-history":[{"count":6,"href":"https:\/\/www.lothlorien.com\/kf6gpe\/wp-json\/wp\/v2\/posts\/388\/revisions"}],"predecessor-version":[{"id":395,"href":"https:\/\/www.lothlorien.com\/kf6gpe\/wp-json\/wp\/v2\/posts\/388\/revisions\/395"}],"wp:attachment":[{"href":"https:\/\/www.lothlorien.com\/kf6gpe\/wp-json\/wp\/v2\/media?parent=388"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.lothlorien.com\/kf6gpe\/wp-json\/wp\/v2\/categories?post=388"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.lothlorien.com\/kf6gpe\/wp-json\/wp\/v2\/tags?post=388"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}