Results 1 to 3 of 3

Thread: Objective C, Python and Ruby code with C++ Qt application

  1. #1
    Join Date
    Apr 2008
    Posts
    4
    Thanks
    2
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Objective C, Python and Ruby code with C++ Qt application

    Hello,

    I need to embed ObjectiveC/Python/Ruby code in C++ Qt application. Did anybody do it before ? I'm not sure what I need to start:
    a) Using some C++ language keywords as "extern C" and embed the source code ? But how to call those objects ?
    b) Some specific wrapper that is C++ class that contains calls to ObjectiveC/Python/Ruby code ?
    c) To compile ObjectiveC/Python/Ruby into library and then use some C++ compiler directives and embed it ? How to use header files then ?

    Won't it cause any Qt compatibility problems ?

    P.S. My end goal is to make use Applie Script program in Qt application. As Apple Script has bridge to ObjectiveC/Python/Ruby (http://www.apple.com/applescript/fea...ingbridge.html), I want first call my program written in Apple Script from ObjectiveC/Python/Ruby and then call ObjectiveC/Python/Ruby code from C++ Qt application.

    If somebody knows how to do that, please share your experience.
    Thank you

  2. #2
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Objective C, Python and Ruby code with C++ Qt application

    Apple script is like javascript to call

    QProcess from qt help you


    This sample make a background image on Desktop....
    Qt Code:
    1. //MacOSX
    2. #elif defined(Q_OS_MACX)
    3.  
    4. //create script
    5. QString scriptFilename = ((Window*)qApp->mainWidget())->getTitle()->getAlbum()->getTmpDir() +
    6. "/tmpBackgroundScript";
    7.  
    8. QFile file( scriptFilename );
    9. if(file.open(IO_WriteOnly))
    10. {
    11. //-----
    12. QTextStream stream;
    13. stream.setDevice( &file );
    14. stream.setEncoding( QTextStream::UnicodeUTF8 );
    15. //-----
    16. stream << "tell application \"Finder\"\n";
    17. stream << "set pFile to POSIX file \"" << chosenFilename.ascii() << "\"\n";
    18. stream << "set desktop picture to file pFile\n";
    19. stream << "end tell";
    20. }
    21. file.close();
    22.  
    23. //run script to set background
    24. p.addArgument( "/usr/bin/osascript" );
    25. p.addArgument( scriptFilename );
    26. p.start();
    27.  
    28. //if there is an old file remove it
    29. if(!oldFilename.isNull())
    30. { tmpDir.remove( oldFilename ); }
    31.  
    32. //-------------------------------
    33. //UNIX
    34. #else
    To copy to clipboard, switch view to plain text mode 

    Python on qt is possibel show the source code from
    http://www.scribus.net/ and grep python command
    other way is QScriptEngine http://doc.trolltech.com/4.3/qscriptengine.html

    IMO: Java class QT button not work on firefox 3.

  3. The following user says thank you to patrik08 for this useful post:

    Berberis (5th June 2008)

  4. #3
    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: Objective C, Python and Ruby code with C++ Qt application

    Check out PythonQt.

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

    Berberis (5th June 2008)

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.