1

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.

3 Answers 3

1

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).

Sign up to request clarification or add additional context in comments.

Comments

0

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.

1 Comment

Focused the question, I knew these typedef's, just included them as extra annoyances.
0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.