Results 1 to 2 of 2

Thread: Passing a QPainter to a QtScript

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

    Default Passing a QPainter to a QtScript


    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. (code in /plasma/scriptengines/javascript/simplebindings wraps QPainter by hand, hardcore!)

    Last edited by poco; 10th November 2012 at 20:59.

  2. #2
    Join Date
    Feb 2011
    Thanked 28 Times in 27 Posts
    Qt products
    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, 21:36
  2. QtScript: Passing an array of objects to C++
    By Plow in forum Qt Programming
    Replies: 0
    Last Post: 16th April 2010, 13:53
  3. Replies: 0
    Last Post: 25th November 2009, 08:46
  4. QtScript : passing array as argument into function
    By derek_r in forum Qt Programming
    Replies: 4
    Last Post: 27th October 2007, 11:46
  5. passing a QPainter object to widgets
    By vratojr in forum Qt Programming
    Replies: 9
    Last Post: 11th January 2006, 16:27


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.