Quantcast
Channel: QtWebEngine
Viewing all articles
Browse latest Browse all 13965

QML Problems

$
0
0
I have a QML file that contains the excerpt   Utils{     id: myUtils   }   TextArea {     id: myTextArea     readOnly: true     text: ""   }   TextField{     id: mytTextField     placeholderText: "Enter text"   }   Button {     id: myButton     text: "Submit"     onClicked: {       myUtils.addRow("myTextArea", mytTextField.text)     }   } and a QML file Utils.qml that contains the excerpt   function addRow(textAreaId, text){     textAreaId.append("<i>" + text + "</i>");   } The problems I’m having are: The error message “TypeError: Property ‘append’ of object myTextArea is not a function” is produced. It works when I replace textAreaId.append by myTextArea.append in addRow but I want a more general solution. [BTW, I am not interested in solutions that use eval.] “<i>” + text + “</i>” appears in myTextArea instead of text being italicized when I make the change indicated in 1. Any suggestions? Thanks. Steve

Viewing all articles
Browse latest Browse all 13965

Trending Articles