Results 1 to 2 of 2

Thread: Passing a QPainter to a QtScript

  1. #1
    Join Date
    Nov 2012
    Posts
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Passing a QPainter to a QtScript

    Hi,

    I am trying to make some painting inside my QtScript. My main issue is to be able to transfer a QPainter object from the C++ code to the QtScript I am executing. It would be trivial if QPainter was a QObject, but since it is not, I am looking for an easy way to make QPainter’s method accessible from inside the QtScript (e.g. QPainter::fillRect(), QPainter::setBrush()). Is there any easy way to do it? I would like avoiding to create by hand the QPainter wrapper and registering myself all the available methods. It seems someone has already done it, but I cannot find a nice C++ code.

    https://qt.gitorious.org/qt-labs/gra...rt/barchart.qs

    http://lists.kde.org/?l=kde-commits&...5572930177&w=2 (code in /plasma/scriptengines/javascript/simplebindings wraps QPainter by hand, hardcore!)

    Thanks!
    Last edited by poco; 10th November 2012 at 19:59.

  2. #2
    Join Date
    Feb 2011
    Location
    Bangalore
    Posts
    207
    Thanks
    20
    Thanked 28 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Passing a QPainter to a QtScript

    What you need is Qt Script Bindings generator. It has a license problem though. GPL. But you can always look at the generated code which introduces the classes to script and hand code yourself.

Similar Threads

  1. Passing a value between QtScript and QML?
    By Lendrick in forum Qt Programming
    Replies: 0
    Last Post: 21st January 2012, 20:36
  2. QtScript: Passing an array of objects to C++
    By Plow in forum Qt Programming
    Replies: 0
    Last Post: 16th April 2010, 12:53
  3. Replies: 0
    Last Post: 25th November 2009, 07:46
  4. QtScript : passing array as argument into function
    By derek_r in forum Qt Programming
    Replies: 4
    Last Post: 27th October 2007, 10:46
  5. passing a QPainter object to widgets
    By vratojr in forum Qt Programming
    Replies: 9
    Last Post: 11th January 2006, 15:27

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.