How to use a special qm file?



  • I have main.cpp, main.qml, MainPage.qml. The language file is MainPage_zh.qm.
    What should I change the main.cpp to use the MainPage_zh.qm file?
    main.cpp
    @#include <QtGui/QApplication>
    #include "qmlapplicationviewer.h"

    Q_DECL_EXPORT int main(int argc, char *argv[])
    {
    QScopedPointer<QApplication> app(createApplication(argc, argv));

    QmlApplicationViewer viewer;
    viewer.setMainQmlFile&#40;QLatin1String("qml/app1/main.qml"&#41;);
    viewer.showExpanded();
    
    return app->exec&#40;&#41;;
    

    }@

    main.qml
    @import QtQuick 1.1
    import com.nokia.symbian 1.1

    PageStackWindow {
    id: window
    initialPage: MainPage { x: 0; y: 0;tools: toolBarLayout

    }
    showStatusBar: true
    showToolBar: true

    ToolBarLayout {
        id: toolBarLayout
        ToolButton {
            flat: true
            iconSource: "toolbar-back"
            onClicked: window.pageStack.depth <= 1 ? Qt.quit() : window.pageStack.pop()
        }
    }
    

    }@


  • Moderators

    Take a look at:


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.