title: PySide: passing data from QML to Python
body: <p>I'm trying to send data from QML to Python, but I'm getting an error.</p>
  
  <p>test.py:</p>
  
  <pre><code>#!/usr/bin/env python
  
  import sys
  from PySide import QtCore, QtGui, QtDeclarative
  
  class Test( QtCore.QObject ):
      def __init__( self ):
          QtCore.QObject.__init__(self)
  
      @QtCore.Slot()
      def printText(self,text):
          print text
  
  class MainWindow( QtDeclarative.QDeclarativeView ):
      def __init__( self, parent=None ):
          super( MainWindow, self ).__init__( parent )
          self.setWindowTitle( "Test" )
          self.setSource( QtCore.QUrl.fromLocalFile( './test.qml' ) )
          self.setResizeMode( QtDeclarative.QDeclarativeView.SizeRootObjectToView )
  
  app = QtGui.QApplication( sys.argv )
  window = MainWindow()
  context = window.rootContext()
  context.setContextProperty("testModel",Test())
  window.show()
  sys.exit( app.exec_() )
  </code></pre>
  
  <p>test.qml:</p>
  
  <pre><code>import QtQuick 1.0
  
  Rectangle {
      width: 200
      height: 200
      color: "white"
  
      Rectangle {
          anchors.centerIn: parent
          width: 100
          height: 50
          color: "black"
          Text {
              anchors.centerIn: parent
              text: "click"
              color: "white"
          }
          MouseArea {
              anchors.fill: parent
              onClicked: {
                  testModel.printText("test")
              }
          }
      }
  }
  </code></pre>
  
  <p>When the button is clicked, I expected it to print "test" but instead I get this error:</p>
  
  <blockquote>
    <p>TypeError: printText() takes exactly 2 arguments (1 given)</p>
  </blockquote>
  
  <p>What am I missing?</p>
  
  <p><em>EDIT: changed the example to a simpler one.</em></p>