[Interest] Fwd: XAML and CX in Qt for Windows Phone

Knight Andrew Andrew.Knight at digia.com
Wed Aug 13 12:08:49 CEST 2014

Yes, C# frameworks like AdMob require you to write some C# methods which are then exposed to native code. I'm afraid I can't offer much insight into how to do that, but I'm sure you can find examples on the web. As I said, calling CX code from your Qt application is no problem if you set the compiler flag.


From: interest-bounces+andrew.knight=digia.com at qt-project.org [interest-bounces+andrew.knight=digia.com at qt-project.org] on behalf of Đèn cù Phan Quang Huy [matdennoigi at gmail.com]
Sent: Wednesday, August 13, 2014 12:59 PM
To: interest at qt-project.org
Subject: [Interest] Fwd: XAML and CX in Qt for Windows Phone

Thanks, Andrew!

I'm very intersted in Qt UI, and I don't want XAML as GUI for my game. We choosen Qt Quick because Qt Quick :). We have experient with cocos2d-x but we changed to Qt because Qt is fully cross-platform, stable, cute code model and special QML. But C# calling is mandatory in my company, because many our modules and frameworks was implemented in C# or must call C# API, then we very interested in CX.

And, we use AdMob for banner

On Wed, Aug 13, 2014 at 4:32 PM, Knight Andrew <Andrew.Knight at digia.com<mailto:Andrew.Knight at digia.com>> wrote:

> Hi all !
> In Windows Phone 8, Microsoft provided a new technique for native development (C++). There are 2 template for native :
> Native Only (only use C++) template: this template only use pure C++ with limited access to Platform API (C# implementation like Camera, Push Notification, etc.). It has been only used
>  for game development (with DirectX). XAML + C# + C++ template: with this template, in fact, it is “general Windows Phone template” with XAML for
>  layout, C# for logic processing and C++ for backend heavily processing. Example, the game render would be written in C++ (like native only) but it would be rendered on a control in XAML. MS provided a mechanism
>  for communicate between C# and C++, is “CX” (much like C++.net) and it much like JNI mechanism in Android. CX allows C++ can access C# Platform API,
>  which can’t be accessed directly from C++.
> In Qt, when i want to build for Windows Phone, i will create Visual Studio Solution by “qmake” and build it in Visual Studio, but the output solution of it is > “Native Only Template”, thus i can’t write CX and integrated any Ad Banner for my app.
> Please add qmake optional for create Xaml template. It's very useful!

As you have noted, Windows Phone allows for "Native Only" development, and this is what Qt uses. We do not use any CX, C#, or XAML in the Qt codebase, and this is likely to remain the case as we go along.

That said, there is nothing preventing you from using CX in your code. You simply need to add
to your .pro file to enable the extensions.

XAML integration is also possible in theory, but it requires major changes to Qt. If you're not planning to use any Qt UI integration (Widgets, Qt Quick, etc.), then you probably won't have any serious issues using XAML, though. The two experiments are available on Code Review:
They involve modifying winmain, a static BSD-licensed support library in qtbase. You are welcome to do something similar in your app; just rebuild winmain or link to your version of winmain instead.

So, to summarize: we don't use these features in Qt (and have no plans to), but there are ways to use them in your app.


P.S. What ad banner framework are you using? It may actually be possible to use it from native C++ by generating headers from the winrtmidl compiler.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140813/5bf94f0e/attachment.html>

More information about the Interest mailing list