Results 1 to 3 of 3

Thread: Calling a widget as a library / dll function from C code how to ?

  1. #1
    Join Date
    May 2011
    Posts
    12
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default Calling a widget as a library / dll function from C code how to ?

    Hello, please bare with me as I'm new hear and new to Qt for sure.

    I have a very complex imbedded Linux application built under GCC, it is all written in C.
    I have managed to build / compile a very simple widget example that are included with my development system. (I'm on TI's OMAP-L138 DVSDK system and evaluation board tools etc)...

    I would like to add this very simple widget (a slider) to send signal to a slot I will hook to in my C code to vary a parameter in the C code... I would like to have the widget / slider to be running on my LCD display on the evaluation board and when the user moves it to send a signal to my C application.

    I'd like to have this be similar to a dll or a library so as not to have to “compile in” the widget in my C code... Can anyone tell me where to look for examples or tutorials on calling a Qt object from my C code and how to make this widget a dll / library, and how to link it to my C code...

    If I have not explained what I'm attempting, please send me a response and I will try to clarify...

    Again I'm new hear on the steep learning curve...
    Thank you all.

    GusQt1
    aka...Brian

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Calling a widget as a library / dll function from C code how to ?

    Quote Originally Posted by gusQt1 View Post
    I'd like to have this be similar to a dll or a library so as not to have to “compile in” the widget in my C code... Can anyone tell me where to look for examples or tutorials on calling a Qt object from my C code and how to make this widget a dll / library, and how to link it to my C code...
    The short answer is, you can not do this.

    But, it is possible in another way.
    I would suggest to put your C code into a library and call it from a real Qt application.

    For signals and slots to work you need to have a Qt event loop running. The easiest way to do that is create a simple Qt application. Then I would call your C code from within the slot connected to the slider.

    Putting your existing C code into a library should be straight forward.
    Google contains lots of tutorials and documentation on how to do that. Usually it requires you to handle the main function (if it is an application right now), adjust the make files, recompile, add the library to the Qt program, include the header and rebuild.

  3. #3
    Join Date
    May 2011
    Posts
    12
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Calling a widget as a library / dll function from C code how to ?

    Thanks tbscope:
    I see now where I have to have Qt running in event loop... I'll try now to make full Qt app and include the relevant, i.e. my c functions to it. Just got the Blanchette / Summerfield book, and going through some of the on line training, as well... Learning... Sorry for the pre-mature question...
    Thanks.

Similar Threads

  1. Replies: 2
    Last Post: 30th July 2010, 16:59
  2. Calling a library in Symbian C++ using Qt
    By zhengping in forum Newbie
    Replies: 2
    Last Post: 22nd June 2010, 03:04
  3. QtConncurrent - calling function within the class
    By jacek_ in forum Qt Programming
    Replies: 5
    Last Post: 28th October 2009, 18:37
  4. QDialog - Calling Main Window Function
    By Preeteesh in forum Newbie
    Replies: 4
    Last Post: 20th June 2007, 19:41
  5. Problems calling C function in C++/Qt class
    By Rayven in forum General Programming
    Replies: 2
    Last Post: 2nd June 2006, 22:32

Tags for this Thread

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.