Results 1 to 6 of 6

Thread: C code integration with QT

  1. #1

    Default C code integration with QT

    Hello!
    I have written a code in C, now i want to display graphs and provide user interface.All i want to know is that is it possible to integrate my this C code with QT(which is written in C++) and if so than how is it possible? I am new to QT, so please give me a detailed answer

  2. #2
    Join Date
    Oct 2007
    Location
    Lake Forest, CA, USA
    Posts
    132
    Thanks
    10
    Thanked 27 Times in 22 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android

    Default Re: C code integration with QT

    Although this is a bad style, but nothing keeps you from using C code in C++/Qt app. Create a sample Qt application, explore how it works and then put your C code in it. It's hard to provide you detailed instructions, so try and ask if something will go wrong.
    Oleg Shparber

  3. #3
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: C code integration with QT

    Quote Originally Posted by Oleg
    Although this is a bad style
    What is bad about mixing C & C++?

    Quote Originally Posted by zeenish
    All i want to know is that is it possible to integrate my this C code with QT(which is written in C++) and if so than how is it possible? I am new to QT, so please give me a detailed answer
    You need to have some hands on Qt C++ before you start this.

    1. Create a Qt Widget project.
    2. Add C code files to the project.
    3. Add UI components and interface them with C code
    4. You will need to have declarations in place to call C calls from C++ (Google for Mixing C and C++ Code)
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  4. #4
    Join Date
    Oct 2007
    Location
    Lake Forest, CA, USA
    Posts
    132
    Thanks
    10
    Thanked 27 Times in 22 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android

    Default Re: C code integration with QT

    Quote Originally Posted by Santosh Reddy View Post
    What is bad about mixing C & C++?
    Actually I mean that such project is harder to support, as you have both c and c++ stdlibs, different memory management functions, type casts, etc, and for example
    Qt Code:
    1. struct class
    To copy to clipboard, switch view to plain text mode 
    is valid C, but not C++.
    Oleg Shparber

  5. #5

    Default Re: C code integration with QT

    Please anyone help me out of this problem, i am quite confused because i am not that much a good programmer
    I want to keep my work attractive but at the same time simple and easy
    Kindly guide me which library will be better in my case?? If not QT than which one i should prefer, please a detailed answer

  6. #6
    Join Date
    Jun 2011
    Posts
    69
    Thanks
    13
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: C code integration with QT

    Of course it's possible, every day programmers those living with minimal wage :d make c++ wrapper for old c codes and it's obvious!
    what do you need to do exactly with it? for instance for string conversation you can just simply use QString function do to that between simple c/c++ string/char.
    If not QT than which one i should prefer, please a detailed answer
    when you have C codes, and you need UI/gui stuff which toolkit will come in to scene? in my opinion Qt
    Actually what you need is just some researching (googling ) and yay!
    ...یه مرد هیچوقت زمین نمیخوره

Similar Threads

  1. qml qnd c++ integration
    By katta_ashish in forum Qt Quick
    Replies: 1
    Last Post: 1st June 2011, 10:34
  2. Replies: 2
    Last Post: 12th March 2010, 21:25
  3. qwt integration with qt
    By sandhyarani in forum Qt Programming
    Replies: 0
    Last Post: 31st July 2009, 09:21
  4. Eclipse Integration sans Integration
    By ChrisW67 in forum Qt Tools
    Replies: 3
    Last Post: 17th March 2009, 08:29
  5. Pasting code from code tag in emacs
    By Gopala Krishna in forum General Discussion
    Replies: 0
    Last Post: 16th February 2007, 06:47

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.