Hi.
I intend to display time in Meego QML:
Here is the tcmtime.js file for fetching and returning current time:
function gettime() {
var currenttime;
var today=new Date();
var hh=today.getHours();
var mm=today.getMinutes();
var ss=today.getSeconds();
currenttime=hh+":"+mm+":"+ss;
return currenttime;
}
In MainPage.qml file, the js file is imported and used, howerver, the import is wrong "qrc:/qml/MainPage.qml:1:24: Invalid import qualifier ID "
import "tcmtime.js" as ctime
import QtQuick 1.1
import com.meego 1.0
Page {
id: mainPage
tools: commonTools
Label {
id: label
anchors.centerIn: parent
text: "current time: "+ctime.gettime();
visible: true
}
}
QT+= declarative is in .pro file, tcmtime.js is added into .qrc file as well.
Any mistake?
Another question is how to get current time in main.c then pass it to main.qml file?
Thanks in advance!
zbc

Reply With Quote



