Doing either import "SubPages" or import "SubPages" as SubPages causes the same error, saying that each page I want to access is not defined.
As I see it, I have to import the pages, because on application startup, my gpsio.cpp function gets the users current location, and then updates the text fields in the MainWin page... BEFORE MainWin is even loaded... via a javascript function that is called from gpsio.cpp:
void gpsio::stopOneShotGPS()
{
sourceOneShot->stopUpdates();
QObject *root
= myFileIO
->engine.
rootObjects().
first();
QMetaObject::invokeMethod(root,
"gpsOneShotUpdate",Q_RETURN_ARG
(QVariant, returnedVal
));
====> calls javascript function to update text fields
root->setProperty("myFilePath",myFileIO->myFilePath);
root
->setProperty
("myProdType",
QSysInfo::productType());
root
->setProperty
("myProdVers",
QSysInfo::productVersion());
}
void gpsio::stopOneShotGPS()
{
sourceOneShot->stopUpdates();
QObject *root = myFileIO->engine.rootObjects().first();
QVariant returnedVal;
QMetaObject::invokeMethod(root,"gpsOneShotUpdate",Q_RETURN_ARG(QVariant, returnedVal)); ====> calls javascript function to update text fields
root->setProperty("myFilePath",myFileIO->myFilePath);
root->setProperty("myProdType", QSysInfo::productType());
root->setProperty("myProdVers", QSysInfo::productVersion());
}
To copy to clipboard, switch view to plain text mode
"gpsOneShotUpdate" is exposed to the C++ via main.qml and defined in functions.js:
function gpsOneShotUpdate() {
mainWin.timeLabel.text = "";
mainWin.latLabel.text = appWin.currentLat;
mainWin.lonLabel.text = appWin.currentLon;
mainWin.accyLabel.text = "---";
mainWin.hdgLabel.text = "---";
mainWin.spdLabel.text = "---";
mainWin.cntLabel.text = "---";
mainWin.statusImage.source = "status_64x128_grey.png";
loadPage("SubPages/MainWin");
}
function gpsOneShotUpdate() {
mainWin.timeLabel.text = "";
mainWin.latLabel.text = appWin.currentLat;
mainWin.lonLabel.text = appWin.currentLon;
mainWin.accyLabel.text = "---";
mainWin.hdgLabel.text = "---";
mainWin.spdLabel.text = "---";
mainWin.cntLabel.text = "---";
mainWin.statusImage.source = "status_64x128_grey.png";
loadPage("SubPages/MainWin");
}
To copy to clipboard, switch view to plain text mode
Bookmarks