Important: Please read the Qt Code of Conduct -

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?
    @#include <QtGui/QApplication>
    #include "qmlapplicationviewer.h"

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

    QmlApplicationViewer viewer;
    return app->exec&#40;&#41;;


    @import QtQuick 1.1
    import 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