views:

592

answers:

3

It is a messy question, hopefully you can figure out what I want :)

What is the best way to use Win32 functionality in a Qt Open Source Edition project?

Currently I have included the necessary Windows SDK libraries and include directories to qmake project file by hand. It works fine on a small scale, but its inconvenient and cumbersome.

So, should I separate the Win32 stuff into a library or is there a sensible way of combining these two? Or have I just overlooked some Qt aspect that simplifies this?

EDIT

Removed the syntax stuff, its not really relevant, just annoying.

A: 

LPCWSTR should not be a problem; that's just a stupid name for wchar_t const*. LPARAM is not a problem either, you can store them in a long. Sure, those are just C++ types, not Qt. But Qt can still handle them.

VS integration, as I understand it is related to the Visual Studio IDE, not the (V)C++ language.

MSalters
Focused the question, I knew these typedef's, just included them as extra annoyances.
Tuminoid
+1  A: 

You could build an interface layer to wrap the Win32 functionality and provide it in a DLL or static library. The DLL would minimize the need for linking directly to the Win32 libraries with your qmake project. It would be more in keeping with the portability of Qt to create generic interfaces like this and then hide the platform specific data in a private implementation. Trolltech has typically employed the pimpl idiom to accomplish such tasks. So, take a look at the Qt source code to see examples (i.e. look for the "d" pointers).

Judge Maygarden
A: 

You could use win32 scopes in your .pro file;

win32:HEADERS+=mywinheader.h

or with .pri (pro include) files to compartmentalize it even more;

win32:include( mywinpri.pri )

You would typically use this apprpoach with the PIMPL idiom as monjardin describes

Henrik Hartz