Windows Store (aka Windows Metro), C#, and Qt

  • Hey,

    I'm completely new to -QT- Qt but I know it's highspeed as it's used in Autodesk and several other quality commercial products.

    So I know it's a GUI and probably more.

    What I want to do is try to #ifdef my way around -QT- Qt bindings and replace them with their C# / Windows Metro bindings. This is in a rather large open source package (of which I'm a new user of as well) so I know it will not be a couple day's work.

    I have compiled many, many open source packages over the years but it's been a while since I tried to port anything complex. The most complex thing I ported and compiled was the X11 System from AT&T Unix to Sco Unix but that was in the early 90s before everything was made rather easy.

    So my main question is for those that are very familiar with -QT- Qt. Is it feasible for me to #ifdef my way around -QT- Qt code to bind it in C# / Metro?

    Or am I going to have to just go in and look at each -QT- Qt* function and figure out the Metro equivalent all the way through. Actually I'm going to have to do that anyway it's a matter of how closely -QT- Qt functions match Metro functions in the way the work.


    Edit: The name of the toolkit is Qt, not QT. The latter refers to Apple's QuickTime; Andre

  • Short answer: No (not yet).

    Long answer: Maybe. The Metro environment (or Windows Runtime/WinRT) is a different beast ( from the traditional Win32 APIs that back Qt on Windows. Therefore, a considerable amount of porting needs to be done to Qt to support the new platform (not only the windowing system/QPA, but also many of the private implementations need to be rewritten for WinRT). The platform is also missing a universal OpenGL solution, a key ingredient to QtQuick 2.

    That said, building an app that is certifiable in the Windows Store is a ways off. However, there are a few things you can do already. I have been dabbling with Qt and WinRT for a while now and have some findings I'd like to share.

    Forget about using C# - Qt is (primarily) a C++ framework. The WRL template library ( is, IMO, the correct approach to accessing WinRT APIs from C++ because it sticks to the standards. Microsoft also has this C++/CX language extension (can you say vendor lock-in?). It has some nice language features, such as memory management and type introspection, but Qt has those already. All you really need is the minimum amount of WRL to use Qt inside Metro.

    So, tell me a little bit more about what you want to accomplish. Is this a QML app (a natural fit)? Are you planning to use Widgets? Do you already know that your target will fit the Windows Store API requirements (e.g. it doesn't rely on any unsupported libraries or functionality)?

  • Actually, the answer to your question is yes, in the sense that it does come down to #ifdeffing a bunch of code (or more likely, rewriting a number of Windows PIMPLs). It just hasn't been done yet. If you feel like pitching in, I've started a wiki page to help ignite the effort:

    Note that I've only sketched out qtbase so far. I've got build instructions and a skeleton QPA plugin in the pipeline.

  • OK, I originally planned of #ifdef'ing around Qt in MusicScore code that I decided to independently compile but I may as well try #ifdef'ing the Qt code till I get stopped.

  • Moderators

    [quote author="ThunderCell" date="1349747203"]So I know it's a GUI and probably more.[/quote]You're right :) Have a look at -- this will give you an idea of what Qt offers (although Qt 5 won't be released for a few more months)

    [quote author="ThunderCell" date="1349809735"]OK, I originally planned of #ifdef'ing around Qt in MusicScore code that I decided to independently compile but I may as well try #ifdef'ing the Qt code till I get stopped.[/quote]Do you mean "get stopped" by the other developers in the project? If that's a possibility, it's probably wise and polite to discuss your plans with the community before you start.

  • No, stop myself and to work on another project.

    I mean if it goes swimmingly I would submit it for review but as Qt is widely adapted commercially I'd expect some kind of commercially employed people tasked to update it and merge into the public branch.

    To merge anything they have control over that anyway.

Log in to reply