Results 1 to 4 of 4

Thread: How to Integrate Qt with 'C'

  1. #1
    Join Date
    Jun 2007
    Location
    India
    Posts
    33
    Thanks
    8
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Arrow How to Integrate Qt with 'C'

    Hello folks,
    I will be much grateful if anybody can give me a simple example where some code written in C [some simple application, like a hello world ] is executed through Qt [ie., through a Qt UI ].

    Any pointers in Trolltech docs? or some previous threads here? I tried searching here, but found none so far.

    Any kind of guidance will be much appreciated.
    Thanks
    Deepak

    PS: I am using Qt 4.2.2 on WinXp

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to Integrate Qt with 'C'

    I don't know...
    I think there was a C bindings for Qt package, but for version 3.x.
    I don't remember the link anyway.

    What about making a C++ Qt library( shared or static) and link your C program against it?
    In the library you will have the functionality implemented in C++( classes, etc...), but you will export only some C style functions, which are wrappers for those classes.

    Or, switch to C++ .

    Regards

  3. #3
    Join Date
    Aug 2006
    Location
    Bangalore,India
    Posts
    419
    Thanks
    37
    Thanked 53 Times in 40 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: How to Integrate Qt with 'C'

    Well , qt and kde bindings for language such as python, ruby , c# etc are all(or most of them) based on smoke qt library which is completely c based (ofcourse qt4). I couldn't find exact link on google but may be if you install qtruby or qtc# you will get the libraries. You might even contact the respective authors.
    The biggest difference between time and space is that you can't reuse time.
    -- Merrick Furst

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to Integrate Qt with 'C'

    Quote Originally Posted by deepakn View Post
    I will be much grateful if anybody can give me a simple example where some code written in C [some simple application, like a hello world ] is executed through Qt [ie., through a Qt UI ].
    Do you want to execute a C appplication from within Qt application or simply call some C functions from Qt code?

    You can do the latter without any problems, since C++ is compatible with C. All you need is to wrap C headers in extern "C" block. For the former use QProcess.

Similar Threads

  1. ActiveX - Integrate dumpcpp interfaces
    By durbrak in forum Qt Programming
    Replies: 3
    Last Post: 10th February 2011, 06:54
  2. how to integrate qt into kdevelop correct way
    By amit_pansuria in forum KDE Forum
    Replies: 1
    Last Post: 25th November 2006, 08:58
  3. Install and integrate Qt4 with VC6 ?
    By aamer4yu in forum Installation and Deployment
    Replies: 3
    Last Post: 3rd October 2006, 10:10
  4. Replies: 5
    Last Post: 15th March 2006, 07:33

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.