Book Image

QT5 Blueprints

By : Symeon Huang
Book Image

QT5 Blueprints

By: Symeon Huang

Overview of this book

Table of Contents (17 chapters)
Qt 5 Blueprints
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Translating Qt Quick applications


The procedure of translating a Qt Quick application is similar to a Qt Widgets application. We'll walk through the process with another example application.

Create a new Qt Quick application project and name it Internationalization_QML. The generated main.qml file has already added a qsTr() function for us. The contents may differ slightly in a later version of Qt Creator and (or) Qt Library. However, it should look similar to this one:

import QtQuick 2.3
import QtQuick.Controls 1.2

ApplicationWindow {
  visible: true
  width: 640
  height: 480
  title: qsTr("Hello World")

  menuBar: MenuBar {
    Menu {
      title: qsTr("File")
      MenuItem {
        text: qsTr("&Open")
        onTriggered: console.log("Open action triggered");
      }
      MenuItem {
        text: qsTr("Exit")
        onTriggered: Qt.quit();
      }
    }
  }

  Text {
    text: qsTr("Hello World")
    anchors.centerIn: parent
  }
}

Now, let's edit the Internationalization_QML.pro...