Page 2 of 2 FirstFirst 12
Results 21 to 32 of 32

Thread: Dynamically add functions to qt program

  1. #21
    Join Date
    Feb 2007
    Location
    Philadelphia, USA
    Posts
    255
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    43
    Thanked 21 Times in 21 Posts

    Default Re: Dynamically add functions to qt program

    Quote Originally Posted by sincnarf View Post
    what are the examples of the plugin functions? I need to teach the students how to create their own plugins too so I need to document it. I sort of need to create my own API for it.
    Here is an example of the ChainLink "rand" plugin function which returns a random multi-dimensional array of numbers.

    Qt Code:
    1. //[function] rand
    2. //input: integer [N1], integer [N2], integer [N3], integer [N4], integer [N5], integer [N6]
    3. //output: mda ret
    4. //description: define a multidimensional array of random numbers
    5. bool rand(mda &ret, integer N1=-1, integer N2=-1, integer N3=-1, integer N4=-1, integer N5=-1,integer N6=-1);
    To copy to clipboard, switch view to plain text mode 


    ... and the implementation ...

    Qt Code:
    1. bool rand(mda &ret, integer N1, integer N2, integer N3, integer N4, integer N5,integer N6) {
    2. ret.allocate(MDA_TYPE_REAL,N1,N2,N3,N4,N5,N6);
    3. int32 j;
    4. for (j=0; j<ret.size(); j++)
    5. ret.set((real)rand()/RAND_MAX,j);
    6. return true;
    7. }
    To copy to clipboard, switch view to plain text mode 

    This is the kind of thing that the students would need to write to create custom functions. Here mda is a fundamental datatype in chaninlink (multi-dimensional array).

    From the console it would just be

    > X=rand(100,100);
    > viewmda(X);


    Quote Originally Posted by sincnarf View Post
    I really would like to get everything going with the QGraphicsView Framework, even the application of the image processing function. But if there's no other way to use the functions, the second step, "> Y = my_processing_function(X)" is alright
    The QGraphicsView framework would certainly be possible even from within chainlink.

    JM

  2. The following user says thank you to magland for this useful post:

    sincnarf (21st September 2007)

  3. #22
    Join Date
    Apr 2007
    Posts
    117
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    84
    Thanked 1 Time in 1 Post

    Default Re: Dynamically add functions to qt program

    Quote Originally Posted by wysota View Post
    So my natural question would be "why?".
    C++ is already the standard P.L. for image processing in this university. Maybe because as compared to other programming languages that are taught here (Java, C, Matlab, etc ) C++ is the fastest on image sequences and the instructors already made their own libraries using C++. So as much as possible they would want to integrate their libraries to other future C++ programs created by us students.
    Quote Originally Posted by wysota View Post
    But you can provide a template that uses Qt and students can fill that template using pure C++ (or whatever they like in fact, including QtScriptEngine)
    Hmmm, how can I find examples of such templates that can be filled?
    Last edited by sincnarf; 19th September 2007 at 15:09. Reason: wrong quote
    Image Analysis Development Framework Using Qt (IADFUQ)

  4. #23
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default

    Quote Originally Posted by sincnarf View Post
    C++ is already the standard P.L. for image processing in this university. Maybe because as compared to other programming languages that are taught here (Java, C, Matlab, etc ) C++ is the fastest on image sequences and the instructors already made their own libraries using C++. So as much as possible they would want to integrate their libraries to other future C++ programs created by us students.
    So why do you want to taint your pure C++ libraries with Qt code? If people were always thinking like that we'd be still writing our programs in binary code or assembly.

    You won't be able to use Qt plugins in other non-Qt based applications in a straightforward way anyway. And if you'll want to incorporate Qt into them, you'll be able to incorporate the script engine as well. So the question still stands.

    And the link you requested: http://doc.trolltech.com/latest/plug...t-applications
    Last edited by wysota; 19th September 2007 at 15:29.

  5. The following user says thank you to wysota for this useful post:

    sincnarf (25th September 2007)

  6. #24
    Join Date
    Apr 2007
    Posts
    117
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    84
    Thanked 1 Time in 1 Post

    Default Re: Dynamically add functions to qt program

    Quote Originally Posted by wysota View Post
    So why do you want to taint your pure C++ libraries with Qt code? If people were always thinking like that we'd be still writing our programs in binary code or assembly.
    I really am not sure, I'm not the one who selected the use of Qt anyway. Maybe because Qt is a fast way to build GUI (compared to others?), and Qt has a large base of users nowadays. So we want to be with the Qt community. Something like that.
    Image Analysis Development Framework Using Qt (IADFUQ)

  7. #25
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: Dynamically add functions to qt program

    Quote Originally Posted by sincnarf View Post
    I really am not sure, I'm not the one who selected the use of Qt anyway.
    The only thing I'm saying is that maybe you should discuss (discuss, not ask) it with the person who introduced the C++ requirement. Maybe it's not important at all and you'll save yourself time and effort trying to implement automatic recompilation and reloading of C++ plugins into your application and you'll help the students using the application. I guess you could even use ChainLink as your base application and implement your image manipulating functionality there not having to write a single line of C++ code.

  8. #26
    Join Date
    Apr 2007
    Posts
    117
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    84
    Thanked 1 Time in 1 Post

    Default Re: Dynamically add functions to qt program

    Quote Originally Posted by wysota View Post
    The only thing I'm saying is that maybe you should discuss (discuss, not ask) it with the person who introduced the C++ requirement. Maybe it's not important at all and you'll save yourself time and effort trying to implement automatic recompilation and reloading of C++ plugins into your application and you'll help the students using the application. I guess you could even use ChainLink as your base application and implement your image manipulating functionality there not having to write a single line of C++ code.
    Well, just asked him a while ago. He's my adviser for my S.P. (Special Problem) - sort of like a thesis. He requires that I make the template for the students in pure C++ or mix of C++/Qt. End of story guru wysota..

    Anyway I saw the Plug and Paint example in the Qt examples. The Filter Interface is the perfect example of what I want to implement... Although I don't know where pnp_extrafilters.dll came from. How can I make a template based on pnp_extrafilters? I want to create a modified pnp_extrafilters.dll that can select what widget it will apply its functions on. Will this be hard and does creating my own dll satisfy the requirement that i only use pure C++ or mix of C++/Qt? If not, then I have to make an extra effort in teaching other students how to create their own dlls that are not pure c++ / mix of c++/qt
    Last edited by sincnarf; 20th September 2007 at 09:13. Reason: wrong quote
    Image Analysis Development Framework Using Qt (IADFUQ)

  9. #27
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: Dynamically add functions to qt program

    Look at the link I gave you in #23.

    BTW. I suggest you implement a QtScript-enabled plugin anyway, just to have an option Especially that it's only a few lines of code...

  10. The following user says thank you to wysota for this useful post:

    sincnarf (20th September 2007)

  11. #28
    Join Date
    Apr 2007
    Posts
    117
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    84
    Thanked 1 Time in 1 Post

    Default Re: Dynamically add functions to qt program

    Okay .. . error here
    g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -mthreads -Wl -Wl,-subsystem,windows -o "debug\SP.exe" object_script.SP.Debug -L"c:\Qt\4.3.1\lib" -L"c:\Qt\4.3.1\lib" -lmingw32 -lqtmaind -LC:/Qt/4.3.1/IADFUQ/SP/plugins -lpnp_extrafiltersd -lQtGuid4 -lQtCored4
    ./tmp\obj\debug_shared\main.o: In function `ZN5QListI7QStringE13node_destructEPNS1_4NodeES3_' :C:/Qt/4.3.1/IADFUQ/SP/../../include/QtCore/../../src/corelib/thread/qatomic.h.text$_ZN36Staticpnp_extrafiltersPluginInstanceC1E v[Staticpnp_extrafiltersPluginInstance::Staticpnp_ex trafiltersPluginInstance()]+0x9): undefined reference to `qt_plugin_instance_pnp_extrafilters()'
    collect2: ld returned 1 exit status
    mingw32-make[1]: *** [debug\SP.exe] Error 1
    mingw32-make[1]: Leaving directory `C:/Qt/4.3.1/IADFUQ/SP'
    mingw32-make: *** [debug-all] Error 2
    Image Analysis Development Framework Using Qt (IADFUQ)

  12. #29
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: Dynamically add functions to qt program

    Ok, but what is it?

  13. #30
    Join Date
    Apr 2007
    Posts
    117
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    84
    Thanked 1 Time in 1 Post

    Default Re: Dynamically add functions to qt program

    Quote Originally Posted by wysota View Post
    Ok, but what is it?
    error solved. still have the dilemma on the template that's supposed to be filled by my students (with pure c++ code)
    Image Analysis Development Framework Using Qt (IADFUQ)

  14. #31
    Join Date
    Apr 2007
    Posts
    117
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    84
    Thanked 1 Time in 1 Post

    Default Re: Dynamically add functions to qt program

    Quote Originally Posted by wysota View Post
    Ok, but what is it?
    error solved. still have the dilemma on the template that's supposed to be filled by my students (with pure c++ code)

    Thanks for all the suggestions especially on chainlink i'm trying to study this still
    Image Analysis Development Framework Using Qt (IADFUQ)

  15. #32
    Join Date
    Apr 2007
    Posts
    117
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    84
    Thanked 1 Time in 1 Post

    Default Re: Dynamically add functions to qt program

    Quote Originally Posted by wysota View Post
    Look at the link I gave you in #23.

    BTW. I suggest you implement a QtScript-enabled plugin anyway, just to have an option Especially that it's only a few lines of code...
    I think I really may have to use QtScript after all if I want to pursue Linux support for this system. Now studying QtScript. Thanks again for all comments and suggestions.
    Image Analysis Development Framework Using Qt (IADFUQ)

Similar Threads

  1. Qt/windows: how to compile program with audiere library
    By punjabikura in forum Qt Programming
    Replies: 3
    Last Post: 21st December 2009, 16:09
  2. QT MySQL
    By sabeeshcs in forum Newbie
    Replies: 6
    Last Post: 12th January 2007, 05:19

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
  •  
Qt is a trademark of The Qt Company.