Hi,
I see data in application output of Qt Creator, but I can not bind this data to text control.
Please guide me.
Thanks

main.cpp:
Qt Code:
  1. int main(int argc, char *argv[])
  2. {
  3. QApplication app(argc, argv);
  4.  
  5. QQmlApplicationEngine engine;
  6. engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
  7.  
  8. MySerialPort iSerialPort;
  9.  
  10. QThread * iTH = new QThread;
  11. iSerialPort.moveToThread(iTH);
  12. iSerialPort.openSerialPort();
  13. iTH->start();
  14.  
  15. return app.exec();
  16. }
To copy to clipboard, switch view to plain text mode 


myserialport.cpp:
Qt Code:
  1. void MySerialPort::readData()
  2. {
  3. QByteArray data = serial->readAll();
  4.  
  5. qDebug() << data;
  6.  
  7. QQmlEngine engine;
  8. QQmlComponent component(&engine, QUrl("qrc:MyItem.qml"));
  9.  
  10. QObject *object = component.create();
  11.  
  12. object->setProperty("text1Text",data);
  13.  
  14. }
To copy to clipboard, switch view to plain text mode 

MyItem.qml:
Qt Code:
  1. import QtQuick 2.0
  2. import QtQuick.Controls 1.2
  3.  
  4. Item {
  5. id: item1
  6. width: 400
  7. height: 400
  8. property alias text1Text: text1.text
  9.  
  10. Text {
  11. id: text1
  12. width: 400
  13. height: 29
  14. color: "red"
  15. text: "This text should change..."
  16. font.pixelSize: 12
  17. }
  18.  
  19. }
To copy to clipboard, switch view to plain text mode 

main.qml:
Qt Code:
  1. import QtQuick 2.3
  2. import QtQuick.Controls 1.2
  3. import QtQuick 2.3
  4.  
  5. ApplicationWindow {
  6. visible: true
  7. width: 640
  8. height: 480
  9. title: qsTr("Hello World")
  10.  
  11. MyItem{
  12.  
  13. }
  14. }
To copy to clipboard, switch view to plain text mode