Results 1 to 6 of 6

Thread: How to integrate Windows specific code into a Qt class

  1. #1
    Join Date
    Jan 2006
    Posts
    162
    Thanks
    9
    Qt products
    Qt3
    Platforms
    Windows

    Default How to integrate Windows specific code into a Qt class

    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.

  2. #2
    Join Date
    Jan 2006
    Posts
    70
    Thanks
    13
    Thanked 5 Times in 5 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to integrate Windows specific code into a Qt class

    I should think that you could simply create a new class

    class QCCanCardIO : public CCanCardIO
    {
    Q_OBJECT

    public slots:

    signals:
    };

    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.

  3. #3
    Join Date
    Jan 2006
    Posts
    162
    Thanks
    9
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: How to integrate Windows specific code into a Qt class

    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

  4. #4
    Join Date
    Jan 2006
    Posts
    162
    Thanks
    9
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: How to integrate Windows specific code into a Qt class

    argh !!!

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

  5. #5
    Join Date
    Jan 2006
    Posts
    70
    Thanks
    13
    Thanked 5 Times in 5 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to integrate Windows specific code into a Qt class

    STL support should already be available by using

    #include <map>

    std::map<type> var;

    What is your compile error?

  6. #6
    Join Date
    Jan 2006
    Posts
    162
    Thanks
    9
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: How to integrate Windows specific code into a Qt class

    Thakns, that's done.

    I forget to add the #include <map>

    Now it works

Similar Threads

  1. problem with linking
    By mickey in forum Qt Programming
    Replies: 49
    Last Post: 12th August 2006, 21:41

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.