Results 1 to 4 of 4

Thread: How can I do pixel image drawing with Python and QML?

  1. #1
    Join Date
    Aug 2010
    Posts
    5

    Default How can I do pixel image drawing with Python and QML?

    I wrote some applications which do pixel drawing with a QPainter.
    I am now wondering how I could port this to QML.

    I searched the web quite a while, but couldnt find any examples how to paint from Python on a QML page.

    On PyQt I did it like this:
    Qt Code:
    1. class MyCanvas(QtGui.QWidget):
    2. def __init__(self, parent=None):
    3. QtGui.QWidget.__init__(self, xxx)
    4. self.setGeometry(10, 180, 781, 241)
    5.  
    6.  
    7. def paintEvent(self, event):
    8. paint = QtGui.QPainter()
    9. paint.begin(self)
    10. paint.setPen(QtGui.QColor("gray"))
    11. paint.setBrush(QtGui.QColor("black"))
    12. paint.drawRect(0,0,780,240)
    13. paint.end()
    14.  
    15. canvas = MyCanvas()
    16. canvas.show()
    To copy to clipboard, switch view to plain text mode 

    This then draw directly on my QWidget.

    So my question is, how would I be able to do something like this with QML?

  2. #2
    Join Date
    Sep 2011
    Location
    London UK
    Posts
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60

    Default Re: How can I do pixel image drawing with Python and QML?

    I am looking for exactly same solution. Please if you have manage to find the solution let us know.

    Thank you

  3. #3
    Join Date
    Aug 2010
    Posts
    5

    Default Re: How can I do pixel image drawing with Python and QML?

    Quote Originally Posted by khalidh View Post
    I am looking for exactly same solution. Please if you have manage to find the solution let us know.
    Yes, I got it working.
    I wrote a demo application: http://forum.meego.com/showthread.ph...ighlight=angle

  4. #4
    Join Date
    Sep 2011
    Location
    London UK
    Posts
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60

    Thumbs up Re: How can I do pixel image drawing with Python and QML?

    That was great help!!!!

    Thank you

    Khalidh

Similar Threads

  1. Embedding PyQt4 into an Application running Python via Boost::Python
    By GreyHound in forum Installation and Deployment
    Replies: 1
    Last Post: 6th February 2012, 06:48
  2. Select pixel from image
    By sergio87 in forum Qt Programming
    Replies: 4
    Last Post: 2nd May 2011, 11:48
  3. Replies: 0
    Last Post: 8th April 2011, 20:10
  4. Raw Pixel Data to Image or Picture, to draw in a Widget
    By augusbas in forum Qt Programming
    Replies: 1
    Last Post: 7th September 2010, 13:15
  5. Replies: 0
    Last Post: 7th May 2010, 22:45

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.