View Full Version : How to integrate Windows specific code into a Qt class

14th March 2006, 15:02
Hi !

So today my problem is the following :

I have an "already-developped" C++ class that works on windows platform. This class can read/write frame on a CAN network. The code has been written in C++ (not using Qt) and uses some specific windows function call, library and std templates (std::map). This class is named CCanCardIO.

Due to a lake of time (and also because I don't have the can card API documentation) I must use the CCanCardIO class as it, but I whish to integrate it into a Qt class using slots and signals mechanisms.

My question is the following :
"Is it possible to do such an integretion if the CCanCardIO uses specific code such as std::map, CreateThread function call ?"

Thanks in advance.

14th March 2006, 15:14
I should think that you could simply create a new class

class QCCanCardIO : public CCanCardIO

public slots:


This way you have Qt like class that has all of the features of your IO class and you can use signals and slots.

You may have to inherit QWidget as well.

14th March 2006, 15:43
So, what I did is creating a class named QCan which inherits from QObject and encapsulates the CCanCardIO.

But the problem I have is that this class used std::map and since it now inherits from QObject, it does not compile any more ... so I'm trying to build Qt with stl support. It may compile after :)

14th March 2006, 15:48
argh !!!

The qt compilation always failed on my PC with STL support.

14th March 2006, 15:49
STL support should already be available by using

#include <map>

std::map<type> var;

What is your compile error?

15th March 2006, 08:33
Thakns, that's done.

I forget to add the #include <map> :o

Now it works :D