How to get the string length in QML?
Solved
QML and Qt Quick
-
TypeError: property 'length' of object is not a function
QUrl source(“qrc:/qmlTest.qml”); QQuickWidget* quickWidget = new QQuickWidget; quickWidget->setResizeMode(QQuickWidget::SizeRootObjectToView ); quickWidget->setSource(source); import QtQuick 2.8 import QtQuick.Controls 2.1 Rectangle { id: mapWindow property string date: "" Text{ x:0 y:0 font.family:"微软雅黑" font.pointSize:7 text:date.substring(0,date.length()) color:"#0AAAB1" } }
-
TypeError: property 'length' of object is not a function
QUrl source(“qrc:/qmlTest.qml”); QQuickWidget* quickWidget = new QQuickWidget; quickWidget->setResizeMode(QQuickWidget::SizeRootObjectToView ); quickWidget->setSource(source); import QtQuick 2.8 import QtQuick.Controls 2.1 Rectangle { id: mapWindow property string date: "" Text{ x:0 y:0 font.family:"微软雅黑" font.pointSize:7 text:date.substring(0,date.length()) color:"#0AAAB1" } }