Qt wiki will be updated on October 12th 2023 starting at 11:30 AM (EEST) and the maintenance will last around 2-3 hours. During the maintenance the site will be unavailable.

WinRT TP1 deployment

From Qt Wiki
Jump to navigation Jump to search
This article may require cleanup to meet the Qt Wiki's quality standards. Reason: Auto-imported from ExpressionEngine.
Please improve this article if you can. Remove the {{cleanup}} tag and add this page to Updated pages list after it's clean.

Building and deploying your WinRT apps (Tech Preview 1)

For a template to start building your Qt app in Visual Studio, you can run:

qmake -tp vc

This will create a .vcxproj that you can open and edit in Visual Studio. Note, however, that this support is preliminary and may have bugs (e.g. https://bugreports.qt.io/browse/QTBUG-35328 ).

Phone

Deploying a project to Windows phone 8

I hope most of you understand that deployment of applications is not as easy as it uses to be when using Qt with our first Tech Preview. We of course plan to increase the developer experience in that area but for now there are some manual steps required in order to get your application onto your Windows 8 Phone.

Requirement for building and deploying Windows Phone 8 applications are Visual Studio 2012 or 2013 and the Windows Phone 8 SDK.

First you run "qmake -tp vc" to create a vcxproj file. Creation of these files has been fixed in qtbase's dev branch but for now you have to do some manual steps in order to get them into shape.

  1. You have to get rid of "NotSet" as a setting for the project's character set. As there seems to be no setting for that in Visual Studio 2013 the easiest way to achieve that, is to open the .vcxproj file in a text editor of your choice and remove the occurences of <CharacterSet>NotSet</CharacterSet>
  2. In your project's "Configuration Properties"-> "General" change "Platform Toolset" from "Visual Studio …" to "v110_wp80"
  3. By default the project uses precompiled headers. Just open the project in Visual Studio and set the precompiled headers usage to "Not Using Precompiled Headers"
  4. If you try to compile your project now it will fail with a message that ApplicationIcon.png cannot be found inside the project's directory. Just provide one.
  5. Copy the needed (Qt) dlls and plugins into your project's directory. The easiest way when it comes to deploying the files is having these files copied to this directory as if the vcxproj is your windows executable (put libraries into the same directory where the vcxproj file lives, put Qt plugins into the proper subfolder (like "platforms"). One special file that has to be deployed is "d3dcompiler_qt(d).dll" which can be found inside your Qt's "bin" directory". We might cover this file in a followup post and give more information about it.
  6. Create a "fonts" folder to the same folder the vcxproj file is located in and put the fonts you want to use inside it (from WINDIRfor example). We are looking into loading system fonts but a the moment the freetype font engine is used.
  7. Add the files just added to your project using Visual Studio's GUI. The best approach for that is probably creating a "other files" filter and put the files (libraries, plugins and fonts from the "fonts" folder) in there.
  8. Mark these just added files as "Content" by selecting them in Visual Studio, right click and choose "Properties" and set "Content" to "Yes"

If all these steps are followed you should be able to build, deploy and run your project on your phone. Even though all these steps look cumbersome we hope to improve your experience in the future and hope that you bear with us, that we are not up to Qt standards yet.

Non-phone

Building qt applications for WinRt works the same as for every other Qt Application. Just create your .pro file, call qmake and nmake and you are done. Running and debugging this application is a different matter. As long as there is no proper QtCreator integration there are some manual steps to be done.

Just like every Qt application on Windows your application has to be able to find the needed libraries and plugins, so make sure that it can do so.

First you have to create an app package manifest file in the application's build directory. Creation of that file can be done manually, via Visual Studio, or (in a future release) via Qt Creator.

Afterwards the application can be registered using the PowerShell:

cd <application build dir>
Add-AppxPackage -Register <app package manifest file>

Your application should then show up in your Windows 8 home screen. In order to debug your application you can use Visual Studio 2012 as long as Creator does not support WinRT applications. Therefore start Visual Studio after registering your application. In "DEBUG" there is "Debug Installed App Package…". Just choose your application in the dialog and you are ready to go.

The application can be unregistered via the home screen or using PowerShell. In PowerShell run

Get-AppxPackage<code>
and look for your application's "PackageFullName". It then can be unregistered by calling

Remove-AppxPackage <PackageFullName>

The application can be unregistered via the home screen or using PowerShell. In PowerShell run

Get-AppxPackage

and look for your application's "PackageFullName". It then can be unregistered by calling Remove-AppxPackage <PackageFullName>