I have written a qt quick 2 application which is not running in any windows machine that has not been installed with Qt 5.
I am using Qt 5.0.1. I have shared the images of my release folder and plugins below:
https://docs.google.com/file/d/0B9X1_s7_0KjEeTFkYmc5QjlablU/edit?usp=sharing
https://docs.google.com/file/d/0B9X1_s7_0KjEUTRpb3R4M3RCRWM/edit?usp=sharing
Below is my main function: SingleApplication is a subclass of QAplication.
int main(int argc, char *argv[])
{
int returnVal = 0;
SingleApplication app(argc, argv, SIMULATOR_SINGLE_INSTANCE);
if(app.isRunning())
{
app.sendMessage("another instance exited...");
return 0;
}
QtQuick2ApplicationViewer viewer;
viewer.setMainQmlFile(QStringLiteral("qml/main.qml"));
QQmlContext *pContext = viewer.engine()->rootContext();
QStringList strLibPaths = SingleApplication::libraryPaths();
strLibPaths << SingleApplication::applicationDirPath()+"plugins";
SingleApplication::setLibraryPaths(strLibPaths);
strLibPaths = viewer.engine()->importPathList();
strLibPaths << SingleApplication::applicationDirPath()+"plugins";
viewer.engine()->setImportPathList(strLibPaths);
//qRegisterMetaType("QmlDateTime");
QmlDateTime currentDate;
pContext->setContextProperty("currentDate", &currentDate);
viewer.show();
qDebug("viewer initial size: %d x %d", viewer.initialSize().width(), viewer.initialSize().height());
viewer.setMaximumSize(viewer.initialSize());
viewer.setMinimumSize(viewer.initialSize());
qDebug("viewer final size: %d x %d", viewer.size().width(), viewer.size().height());
QDesktopWidget *pDesktopWdiget = QApplication::desktop();
QRect rectAvailable = pDesktopWdiget->availableGeometry();
int iX = rectAvailable.x() + ((rectAvailable.width() - viewer.size().width())/2);
int iY = rectAvailable.y() + ((rectAvailable.height() - viewer.size().height())/2);
viewer.setPosition(iX, iY);
MessageHandler handler;
returnVal = app.exec();
qDebug("returning...");
return returnVal;
}
Please help me fixing any mistake I am making here.
↧