We have moved to a new Sailfish OS Forum. Please start new discussions there.

Revision history [back]

click to hide/show revision 1
initial version

posted 2015-02-24 23:47:47 +0200

Help with .cpp file

After changing the .cpp file to get translation for to my app I can't start my from the app logo. However I can start it from the terminal. When starting the app from the app-list the busy indication starts and after a while it disappears.

This is my .cpp file

//#ifdef QT_QML_DEBUG #include <qtquick> //#endif

#include <sailfishapp.h> #include <qtranslator> #include <qtextcodec> #include <qlocale> #include <qtqml qqmlengine=""> #include <qscopedpointer> #include <qquickview> #include <qtgui qguiapplication="">

#include <qqml.h>

int main(int argc, char *argv[]) { // SailfishApp::main() will display "qml/template.qml", if you need more // control over initialization, you can use: // // - SailfishApp::application(int, char *[]) to get the QGuiApplication * // - SailfishApp::createView() to get a new QQuickView * instance // - SailfishApp::pathTo(QString) to get a QUrl to a resource file // // To display the view, call "show()" (will show fullscreen on device).

QGuiApplication *app = (SailfishApp::application(argc, argv));

//Translations
QString translationPath(SailfishApp::pathTo("translations").toLocalFile());

qDebug() << "Translation Path:" << translationPath;
static QTranslator translator;
if(translator.load(QLocale(), "SLSailor", "_", translationPath)) {
    app->installTranslator(&translator);
    qDebug() << "Translation file loaded";
} else
    qDebug() << "Translation file not loaded";


QScopedPointer <QQuickView> view(SailfishApp::createView());
app->setApplicationName("SLSailor");
app->setOrganizationDomain("SLSailor");
app->setOrganizationName("SLSailor");
view->setTitle("SLSailor");
QUrl pageSource = SailfishApp::pathTo("qml/SLSailor.qml");
view->setSource(pageSource);
view->showFullScreen();
return app->exec();

}

Help with .cpp file

After changing the .cpp file to get translation for to my app I can't start my from the app logo. "app-list". However I can start it from the terminal. When starting the app from the app-list "app-list" the busy indication starts and after a while it disappears.

This is my .cpp file

//#ifdef QT_QML_DEBUG #include <qtquick> //#endif

#include <sailfishapp.h> #include <qtranslator> #include <qtextcodec> #include <qlocale> #include <qtqml qqmlengine=""> #include <qscopedpointer> #include <qquickview> #include <qtgui qguiapplication="">

#include <qqml.h>

int main(int argc, char *argv[]) { // SailfishApp::main() will display "qml/template.qml", if you need more // control over initialization, you can use: // // - SailfishApp::application(int, char *[]) to get the QGuiApplication * // - SailfishApp::createView() to get a new QQuickView * instance // - SailfishApp::pathTo(QString) to get a QUrl to a resource file // // To display the view, call "show()" (will show fullscreen on device).

QGuiApplication *app = (SailfishApp::application(argc, argv));

//Translations
QString translationPath(SailfishApp::pathTo("translations").toLocalFile());

qDebug() << "Translation Path:" << translationPath;
static QTranslator translator;
if(translator.load(QLocale(), "SLSailor", "_", translationPath)) {
    app->installTranslator(&translator);
    qDebug() << "Translation file loaded";
} else
    qDebug() << "Translation file not loaded";


QScopedPointer <QQuickView> view(SailfishApp::createView());
app->setApplicationName("SLSailor");
app->setOrganizationDomain("SLSailor");
app->setOrganizationName("SLSailor");
view->setTitle("SLSailor");
QUrl pageSource = SailfishApp::pathTo("qml/SLSailor.qml");
view->setSource(pageSource);
view->showFullScreen();
return app->exec();

}

Help with .cpp file

After changing the .cpp file to get translation for to my app I can't start from the "app-list". However I can start it from the terminal. When starting the app from the "app-list" the busy indication starts and after a while it disappears.

This is my .cpp file

//#ifdef QT_QML_DEBUG
#include <qtquick>
//#endif

<QtQuick> //#endif #include <sailfishapp.h> #include <qtranslator> #include <qtextcodec> #include <qlocale> #include <qtqml qqmlengine=""> #include <qscopedpointer> #include <qquickview> #include <qtgui qguiapplication="">

#include <qqml.h>

<QTranslator> #include <QTextCodec> #include <QLocale> #include <QtQml/QQmlEngine> #include <QScopedPointer> #include <QQuickView> #include <QtGui/QGuiApplication> #include <qqml.h> int main(int argc, char *argv[]) { // SailfishApp::main() will display "qml/template.qml", if you need more // control over initialization, you can use: // // - SailfishApp::application(int, char *[]) to get the QGuiApplication * // - SailfishApp::createView() to get a new QQuickView * instance // - SailfishApp::pathTo(QString) to get a QUrl to a resource file // // To display the view, call "show()" (will show fullscreen on device).

device).

    QGuiApplication *app = (SailfishApp::application(argc, argv));

 //Translations
 QString translationPath(SailfishApp::pathTo("translations").toLocalFile());

 qDebug() << "Translation Path:" << translationPath;
 static QTranslator translator;
 if(translator.load(QLocale(), "SLSailor", "_", translationPath)) {
     app->installTranslator(&translator);
     qDebug() << "Translation file loaded";
 } else
     qDebug() << "Translation file not loaded";


 QScopedPointer <QQuickView> view(SailfishApp::createView());
 app->setApplicationName("SLSailor");
 app->setOrganizationDomain("SLSailor");
 app->setOrganizationName("SLSailor");
 view->setTitle("SLSailor");
 QUrl pageSource = SailfishApp::pathTo("qml/SLSailor.qml");
 view->setSource(pageSource);
 view->showFullScreen();
 return app->exec();
}

}