aboutsummaryrefslogtreecommitdiffstats
path: root/examples/widgets/linguist
diff options
context:
space:
mode:
Diffstat (limited to 'examples/widgets/linguist')
-rw-r--r--examples/widgets/linguist/doc/linguist.rst7
-rw-r--r--examples/widgets/linguist/linguist.qrc4
-rw-r--r--examples/widgets/linguist/linguist_rc.py4
-rw-r--r--examples/widgets/linguist/main.py53
4 files changed, 19 insertions, 49 deletions
diff --git a/examples/widgets/linguist/doc/linguist.rst b/examples/widgets/linguist/doc/linguist.rst
new file mode 100644
index 000000000..24a49a617
--- /dev/null
+++ b/examples/widgets/linguist/doc/linguist.rst
@@ -0,0 +1,7 @@
+.. _qt-linguist-example:
+
+Qt Linguist Example
+===================
+
+This example demonstrates the use of Qt Linguist and related tools for translating
+applications as described in :ref:`translations`.
diff --git a/examples/widgets/linguist/linguist.qrc b/examples/widgets/linguist/linguist.qrc
index 2b08ae577..6ca287c20 100644
--- a/examples/widgets/linguist/linguist.qrc
+++ b/examples/widgets/linguist/linguist.qrc
@@ -1,5 +1,5 @@
<!DOCTYPE RCC><RCC version="1.0">
-<qresource>
- <file>translations/example_de.qm</file>
+<qresource prefix="translations">
+ <file>example_de.qm</file>
</qresource>
</RCC>
diff --git a/examples/widgets/linguist/linguist_rc.py b/examples/widgets/linguist/linguist_rc.py
index 72575e549..233952779 100644
--- a/examples/widgets/linguist/linguist_rc.py
+++ b/examples/widgets/linguist/linguist_rc.py
@@ -1,6 +1,6 @@
# Resource object code (Python 3)
# Created by: object code
-# Created by: The Resource Compiler for Qt version 6.2.0
+# Created by: The Resource Compiler for Qt version 6.2.2
# WARNING! All changes made in this file will be lost!
from PySide6 import QtCore
@@ -56,7 +56,7 @@ qt_resource_struct = b"\
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x02\
\x00\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x00\x1e\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\
-\x00\x00\x01z\x80\x03\xea\xc1\
+\x00\x00\x01}\xbdR\x0f\xc5\
"
def qInitResources():
diff --git a/examples/widgets/linguist/main.py b/examples/widgets/linguist/main.py
index 03783d046..dd6ef4d09 100644
--- a/examples/widgets/linguist/main.py
+++ b/examples/widgets/linguist/main.py
@@ -1,53 +1,16 @@
-#############################################################################
-##
-## Copyright (C) 2021 The Qt Company Ltd.
-## Contact: http://www.qt.io/licensing/
-##
-## This file is part of the Qt for Python examples of the Qt Toolkit.
-##
-## $QT_BEGIN_LICENSE:BSD$
-## You may use this file under the terms of the BSD license as follows:
-##
-## "Redistribution and use in source and binary forms, with or without
-## modification, are permitted provided that the following conditions are
-## met:
-## * Redistributions of source code must retain the above copyright
-## notice, this list of conditions and the following disclaimer.
-## * Redistributions in binary form must reproduce the above copyright
-## notice, this list of conditions and the following disclaimer in
-## the documentation and/or other materials provided with the
-## distribution.
-## * Neither the name of The Qt Company Ltd nor the names of its
-## contributors may be used to endorse or promote products derived
-## from this software without specific prior written permission.
-##
-##
-## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+from __future__ import annotations
-from pathlib import Path
import sys
from PySide6.QtCore import (QItemSelection, QLibraryInfo, QLocale, QTranslator,
- Qt, Slot)
+ Slot)
from PySide6.QtWidgets import (QAbstractItemView, QApplication, QListWidget,
- QMainWindow, QWidget)
+ QMainWindow)
-import linguist_rc
+import linguist_rc # noqa: F401
class Window(QMainWindow):
@@ -59,7 +22,7 @@ class Window(QMainWindow):
quit_action.triggered.connect(self.close)
help_menu = self.menuBar().addMenu(self.tr("&Help"))
about_qt_action = help_menu.addAction(self.tr("About Qt"))
- about_qt_action.triggered.connect(qApp.aboutQt)
+ about_qt_action.triggered.connect(qApp.aboutQt) # noqa: F821
self._list_widget = QListWidget()
self._list_widget.setSelectionMode(QAbstractItemView.MultiSelection)
@@ -79,7 +42,7 @@ class Window(QMainWindow):
if __name__ == '__main__':
app = QApplication(sys.argv)
- path = QLibraryInfo.location(QLibraryInfo.TranslationsPath)
+ path = QLibraryInfo.path(QLibraryInfo.TranslationsPath)
translator = QTranslator(app)
if translator.load(QLocale.system(), 'qtbase', '_', path):
app.installTranslator(translator)