QtBase: Removed moved linguist examples.

Linguist examples are now in qttools.

Change-Id: I8abfff50d81cda143a080711bf9583e7be777009
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@digia.com>
This commit is contained in:
David Schulz 2012-12-12 11:20:30 +01:00 committed by The Qt Project
parent a0a4c06736
commit d64c4662f0
26 changed files with 0 additions and 1624 deletions

View File

@ -1,223 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
\example linguist/arrowpad
\title Arrow Pad Example
This example is a slightly more involved and introduces a key \e
{Qt Linguist} concept: "contexts". It also shows how to use two
or more languages.
\image linguist-arrowpad_en.png
We will use two translations, French and Dutch, although there is no
effective limit on the number of possible translations that can be used
with an application. The relevant lines of \c arrowpad.pro are
\snippet examples/linguist/arrowpad/arrowpad.pro 0
\codeline
\snippet examples/linguist/arrowpad/arrowpad.pro 1
Run \c lupdate; it should produce two identical message files
\c arrowpad_fr.ts and \c arrowpad_nl.ts. These files will contain all the source
texts marked for translation with \c tr() calls and their contexts.
See the \l{Qt Linguist manual} for more information about
translating Qt application.
\section1 Line by Line Walkthrough
In \c arrowpad.h we define the \c ArrowPad subclass which is a
subclass of QWidget. In the screenshot above, the central
widget with the four buttons is an \c ArrowPad.
\snippet examples/linguist/arrowpad/arrowpad.h 0
\snippet examples/linguist/arrowpad/arrowpad.h 1
\snippet examples/linguist/arrowpad/arrowpad.h 2
When \c lupdate is run it not only extracts the source texts but it
also groups them into contexts. A context is the name of the class in
which the source text appears. Thus, in this example, "ArrowPad" is a
context: it is the context of the texts in the \c ArrowPad class.
The \c Q_OBJECT macro defines \c tr(x) in \c ArrowPad like this:
\snippet doc/src/snippets/code/doc_src_examples_arrowpad.cpp 0
Knowing which class each source text appears in enables \e {Qt
Linguist} to group texts that are logically related together, e.g.
all the text in a dialog will have the context of the dialog's class
name and will be shown together. This provides useful information for
the translator since the context in which text appears may influence how
it should be translated. For some translations keyboard
accelerators may need to be changed and having all the source texts in a
particular context (class) grouped together makes it easier for the
translator to perform any accelerator changes without introducing
conflicts.
In \c arrowpad.cpp we implement the \c ArrowPad class.
\snippet examples/linguist/arrowpad/arrowpad.cpp 0
\snippet examples/linguist/arrowpad/arrowpad.cpp 1
\snippet examples/linguist/arrowpad/arrowpad.cpp 2
\snippet examples/linguist/arrowpad/arrowpad.cpp 3
We call \c ArrowPad::tr() for each button's label since the labels are
user-visible text.
\image linguist-arrowpad_en.png
\snippet examples/linguist/arrowpad/mainwindow.h 0
\snippet examples/linguist/arrowpad/mainwindow.h 1
In the screenshot above, the whole window is a \c MainWindow.
This is defined in the \c mainwindow.h header file. Here too, we
use \c Q_OBJECT, so that \c MainWindow will become a context in
\e {Qt Linguist}.
\snippet examples/linguist/arrowpad/mainwindow.cpp 0
In the implementation of \c MainWindow, \c mainwindow.cpp, we create
an instance of our \c ArrowPad class.
\snippet examples/linguist/arrowpad/mainwindow.cpp 1
We also call \c MainWindow::tr() twice, once for the action and
once for the shortcut.
Note the use of \c tr() to support different keys in other
languages. "Ctrl+Q" is a good choice for Quit in English, but a
Dutch translator might want to use "Ctrl+A" (for Afsluiten) and a
German translator "Strg+E" (for Beenden). When using \c tr() for
\uicontrol Ctrl key accelerators, the two argument form should be used
with the second argument describing the function that the
accelerator performs.
Our \c main() function is defined in \c main.cpp as usual.
\snippet examples/linguist/arrowpad/main.cpp 2
\snippet examples/linguist/arrowpad/main.cpp 3
We choose which translation to use according to the current locale.
QLocale::system() can be influenced by setting the \c LANG
environment variable, for example. Notice that the use of a naming
convention that incorporates the locale for \c .qm message files,
(and TS files), makes it easy to implement choosing the
translation file according to locale.
If there is no QM message file for the locale chosen the original
source text will be used and no error raised.
\section1 Translating to French and Dutch
We'll begin by translating the example application into French. Start
\e {Qt Linguist} with \c arrowpad_fr.ts. You should get the seven source
texts ("\&Up", "\&Left", etc.) grouped in two contexts ("ArrowPad"
and "MainWindow").
Now, enter the following translations:
\list
\li \c ArrowPad
\list
\li \&Up - \&Haut
\li \&Left - \&Gauche
\li \&Right - \&Droite
\li \&Down - \&Bas
\endlist
\li \c MainWindow
\list
\li E\&xit - \&Quitter
\li Ctrl+Q - Ctrl+Q
\li \&File - \&Fichier
\endlist
\endlist
It's quickest to press \uicontrol{Alt+D} (which clicks the \uicontrol {Done \& Next}
button) after typing each translation, since this marks the
translation as done and moves on to the next source text.
Save the file and do the same for Dutch working with \c arrowpad_nl.ts:
\list
\li \c ArrowPad
\list
\li \&Up - \&Omhoog
\li \&Left - \&Links
\li \&Right - \&Rechts
\li \&Down - Omlaa\&g
\endlist
\li \c MainWindow
\list
\li E\&xit - \&Afsluiten
\li Ctrl+Q - Ctrl+A
\li File - \&Bestand
\endlist
\endlist
We have to convert the \c tt1_fr.ts and \c tt1_nl.ts translation source
files into QM files. We could use \e {Qt Linguist} as we've done
before; however using the command line tool \c lrelease ensures that
\e all the QM files for the application are created without us
having to remember to load and \uicontrol File|Release each one
individually from \e {Qt Linguist}.
Type
\snippet doc/src/snippets/code/doc_src_examples_arrowpad.qdoc 1
This should create both \c arrowpad_fr.qm and \c arrowpad_nl.qm. Set the \c
LANG environment variable to \c fr. In Unix, one of the two following
commands should work
\snippet doc/src/snippets/code/doc_src_examples_arrowpad.qdoc 2
In Windows, either modify \c autoexec.bat or run
\snippet doc/src/snippets/code/doc_src_examples_arrowpad.qdoc 3
When you run the program, you should now see the French version:
\image linguist-arrowpad_fr.png
Try the same with Dutch, by setting \c LANG=nl. Now the Dutch
version should appear:
\image linguist-arrowpad_nl.png
\section1 Exercises
Mark one of the translations in \e {Qt Linguist} as not done, i.e.
by unchecking the "done" checkbox; run \c lupdate, then \c lrelease,
then the example. What effect did this change have?
Set \c LANG=fr_CA (French Canada) and run the example program again.
Explain why the result is the same as with \c LANG=fr.
Change one of the accelerators in the Dutch translation to eliminate the
conflict between \e \&Bestand and \e \&Boven.
*/

View File

@ -1,174 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
\example linguist/hellotr
\title Hello tr() Example
This example is a small Hello World program with a Latin translation. The
screenshot below shows the English version.
\image linguist-hellotr_en.png
See the \l{Qt Linguist manual} for more information about
translating Qt application.
\section1 Line by Line Walkthrough
\snippet examples/linguist/hellotr/main.cpp 0
This line includes the definition of the QTranslator class.
Objects of this class provide translations for user-visible text.
\snippet examples/linguist/hellotr/main.cpp 5
Creates a QTranslator object without a parent.
\snippet examples/linguist/hellotr/main.cpp 6
Tries to load a file called \c hellotr_la.qm (the \c .qm file extension is
implicit) that contains Latin translations for the source texts used in
the program. No error will occur if the file is not found.
\snippet examples/linguist/hellotr/main.cpp 7
Adds the translations from \c hellotr_la.qm to the pool of translations used
by the program.
\snippet examples/linguist/hellotr/main.cpp 8
Creates a push button that displays "Hello world!". If \c hellotr_la.qm
was found and contains a translation for "Hello world!", the
translation appears; if not, the source text appears.
All classes that inherit QObject have a \c tr() function. Inside
a member function of a QObject class, we simply write \c tr("Hello
world!") instead of \c QPushButton::tr("Hello world!") or \c
QObject::tr("Hello world!").
\section1 Running the Application in English
Since we haven't made the translation file \c hellotr_la.qm, the source text
is shown when we run the application:
\image linguist-hellotr_en.png
\section1 Creating a Latin Message File
The first step is to create a project file, \c hellotr.pro, that lists
all the source files for the project. The project file can be a qmake
project file, or even an ordinary makefile. Any file that contains
\snippet examples/linguist/hellotr/hellotr.pro 0
\snippet examples/linguist/hellotr/hellotr.pro 1
will work. \c TRANSLATIONS specifies the message files we want to
maintain. In this example, we just maintain one set of translations,
namely Latin.
Note that the file extension is \c .ts, not \c .qm. The \c .ts
translation source format is designed for use during the
application's development. Programmers or release managers run
the \c lupdate program to generate and update TS files with
the source text that is extracted from the source code.
Translators read and update the TS files using \e {Qt
Linguist} adding and editing their translations.
The TS format is human-readable XML that can be emailed directly
and is easy to put under version control. If you edit this file
manually, be aware that the default encoding for XML is UTF-8, not
Latin1 (ISO 8859-1). One way to type in a Latin1 character such as
'\oslash' (Norwegian o with slash) is to use an XML entity:
"\&#xf8;". This will work for any Unicode 4.0 character.
Once the translations are complete the \c lrelease program is used to
convert the TS files into the QM Qt message file format. The
QM format is a compact binary format designed to deliver very
fast lookup performance. Both \c lupdate and \c lrelease read all the
project's source and header files (as specified in the HEADERS and
SOURCES lines of the project file) and extract the strings that
appear in \c tr() function calls.
\c lupdate is used to create and update the message files (\c hellotr_la.ts
in this case) to keep them in sync with the source code. It is safe to
run \c lupdate at any time, as \c lupdate does not remove any
information. For example, you can put it in the makefile, so the TS
files are updated whenever the source changes.
Try running \c lupdate right now, like this:
\snippet doc/src/snippets/code/doc_src_examples_hellotr.qdoc 0
(The \c -verbose option instructs \c lupdate to display messages that
explain what it is doing.) You should now have a file \c hellotr_la.ts in
the current directory, containing this:
\snippet doc/src/snippets/code/doc_src_examples_hellotr.qdoc 1
You don't need to understand the file format since it is read and
updated using tools (\c lupdate, \e {Qt Linguist}, \c lrelease).
\section1 Translating to Latin with Qt Linguist
We will use \e {Qt Linguist} to provide the translation, although
you can use any XML or plain text editor to enter a translation into a
TS file.
To start \e {Qt Linguist}, type
\snippet doc/src/snippets/code/doc_src_examples_hellotr.qdoc 2
You should now see the text "QPushButton" in the top left pane.
Double-click it, then click on "Hello world!" and enter "Orbis, te
saluto!" in the \uicontrol Translation pane (the middle right of the
window). Don't forget the exclamation mark!
Click the \uicontrol Done checkbox and choose \uicontrol File|Save from the
menu bar. The TS file will no longer contain
\snippet doc/src/snippets/code/doc_src_examples_hellotr.qdoc 3
but instead will have
\snippet doc/src/snippets/code/doc_src_examples_hellotr.qdoc 4
\section1 Running the Application in Latin
To see the application running in Latin, we have to generate a QM
file from the TS file. Generating a QM file can be achieved
either from within \e {Qt Linguist} (for a single TS file), or
by using the command line program \c lrelease which will produce one
QM file for each of the TS files listed in the project file.
Generate \c hellotr_la.qm from \c hellotr_la.ts by choosing
\uicontrol File|Release from \e {Qt Linguist}'s menu bar and pressing
\uicontrol Save in the file save dialog that pops up. Now run the \c hellotr
program again. This time the button will be labelled "Orbis, te
saluto!".
\image linguist-hellotr_la.png
*/

View File

@ -1,43 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation 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 Digia Plc and its Subsidiary(-ies) 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$
**
****************************************************************************/
//! [0]
qApp->translate("ArrowPad", x)
//! [0]

View File

@ -1,54 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation 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 Digia Plc and its Subsidiary(-ies) 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$
**
****************************************************************************/
//! [1]
lrelease arrowpad.pro
//! [1]
//! [2]
export LANG=fr
setenv LANG fr
//! [2]
//! [3]
set LANG=fr
//! [3]

View File

@ -1,71 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation 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 Digia Plc and its Subsidiary(-ies) 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$
**
****************************************************************************/
//! [0]
lupdate -verbose hellotr.pro
//! [0]
//! [1]
<!DOCTYPE TS><TS>
<context>
<name>QPushButton</name>
<message>
<source>Hello world!</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>
//! [1]
//! [2]
linguist hellotr_la.ts
//! [2]
//! [3]
<translation type='unfinished'></translation>
//! [3]
//! [4]
<translation>Orbis, te saluto!</translation>
//! [4]

View File

@ -1,77 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation 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 Digia Plc and its Subsidiary(-ies) 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$
**
****************************************************************************/
//! [0]
twoSidedEnabledRadio = new QRadioButton(tr("Enabled", "two-sided"));
twoSidedDisabledRadio = new QRadioButton(tr("Disabled", "two-sided"));
//! [0]
//! [1]
colorsEnabledRadio = new QRadioButton(tr("Enabled", "colors"), colors);
colorsDisabledRadio = new QRadioButton(tr("Disabled", "colors"), colors);
//! [1]
//! [2]
/*
TRANSLATOR MainWindow
In this application the whole application is a MainWindow.
Choose Help|About from the menu bar to see some text
belonging to MainWindow.
...
*/
//! [2]
//! [3]
/*
TRANSLATOR ZClientErrorDialog
Choose Client|Edit to reach the Client Edit dialog, then choose
Client Specification from the drop down list at the top and pick
client Bartel Leendert van der Waerden. Now check the Profile
checkbox and then click the Start Processing button. You should
now see a pop up window with the text "Error: Name too long!".
This window is a ZClientErrorDialog.
*/
//! [3]

View File

@ -11,7 +11,6 @@ SUBDIRS = \
!contains(QT_CONFIG, no-widgets) {
SUBDIRS += widgets \
ipc \
linguist \
sql \
tools \
touch \
@ -24,7 +23,6 @@ contains(QT_BUILD_PARTS, tools):!contains(QT_CONFIG, no-gui):!contains(QT_CONFIG
contains(QT_CONFIG, opengl):!contains(QT_CONFIG, no-widgets):SUBDIRS += opengl
contains(QT_CONFIG, dbus): SUBDIRS += dbus
contains(QT_CONFIG, concurrent): SUBDIRS += qtconcurrent
contains(DEFINES, QT_NO_TRANSLATION): SUBDIRS -= linguist
aggregate.files = aggregate/examples.pro
aggregate.path = $$[QT_INSTALL_EXAMPLES]

View File

@ -1,11 +0,0 @@
#! [0]
SOURCES = main.cpp
#! [0] #! [1]
TRANSLATIONS = hellotr_ja.ts
#! [1]
# install
target.path = $$[QT_INSTALL_EXAMPLES]/linguist/hellotr
INSTALLS += target
QT += widgets

View File

@ -1,70 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the 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 Digia Plc and its Subsidiary(-ies) 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$
**
****************************************************************************/
#include <QApplication>
#include <QPushButton>
//! [0]
#include <QTranslator>
//! [0]
//! [1] //! [2]
int main(int argc, char *argv[])
//! [1] //! [3] //! [4]
{
QApplication app(argc, argv);
//! [3]
//! [5]
QTranslator translator;
//! [5] //! [6]
translator.load("hellotr_ja");
//! [6] //! [7]
app.installTranslator(&translator);
//! [4] //! [7]
//! [8]
QPushButton hello(QPushButton::tr("Hello world!"));
//! [8]
hello.resize(100, 30);
hello.show();
return app.exec();
}
//! [2]

View File

@ -1,6 +0,0 @@
Internationalization is a core feature of Qt. These examples show how to
access translation and localization facilities at run-time.
Documentation for these examples can be found via the Examples
link in the main Qt documentation.

View File

@ -1,64 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the 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 Digia Plc and its Subsidiary(-ies) 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$
**
****************************************************************************/
#include <QtWidgets>
#include "arrowpad.h"
ArrowPad::ArrowPad(QWidget *parent)
: QWidget(parent)
{
//! [0]
upButton = new QPushButton(tr("&Up"));
//! [0] //! [1]
downButton = new QPushButton(tr("&Down"));
//! [1] //! [2]
leftButton = new QPushButton(tr("&Left"));
//! [2] //! [3]
rightButton = new QPushButton(tr("&Right"));
//! [3]
QGridLayout *mainLayout = new QGridLayout;
mainLayout->addWidget(upButton, 0, 1);
mainLayout->addWidget(leftButton, 1, 0);
mainLayout->addWidget(rightButton, 1, 2);
mainLayout->addWidget(downButton, 2, 1);
setLayout(mainLayout);
}

View File

@ -1,68 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the 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 Digia Plc and its Subsidiary(-ies) 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$
**
****************************************************************************/
#ifndef ARROWPAD_H
#define ARROWPAD_H
#include <QWidget>
QT_BEGIN_NAMESPACE
class QPushButton;
QT_END_NAMESPACE
//! [0]
class ArrowPad : public QWidget
//! [0] //! [1]
{
//! [1] //! [2]
Q_OBJECT
//! [2]
public:
ArrowPad(QWidget *parent = 0);
private:
QPushButton *upButton;
QPushButton *downButton;
QPushButton *leftButton;
QPushButton *rightButton;
};
#endif

View File

@ -1,18 +0,0 @@
#! [0]
HEADERS = arrowpad.h \
mainwindow.h
SOURCES = arrowpad.cpp \
main.cpp \
mainwindow.cpp
#! [0] #! [1]
TRANSLATIONS = arrowpad_fr.ts \
arrowpad_nl.ts
#! [1]
# install
target.path = $$[QT_INSTALL_EXAMPLES]/linguist/arrowpad
INSTALLS += target
QT += widgets
simulator: warning(This example might not fully work on Simulator platform)

View File

@ -1,63 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the 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 Digia Plc and its Subsidiary(-ies) 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$
**
****************************************************************************/
#include <QtWidgets>
#include "mainwindow.h"
//! [0]
int main(int argc, char *argv[])
//! [0] //! [1]
{
QApplication app(argc, argv);
QString locale = QLocale::system().name();
//! [2]
QTranslator translator;
//! [2] //! [3]
translator.load(QString("arrowpad_") + locale);
app.installTranslator(&translator);
//! [1] //! [3]
MainWindow mainWindow;
mainWindow.show();
return app.exec();
}

View File

@ -1,61 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the 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 Digia Plc and its Subsidiary(-ies) 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$
**
****************************************************************************/
#include <QtWidgets>
#include "arrowpad.h"
#include "mainwindow.h"
MainWindow::MainWindow()
{
//! [0]
arrowPad = new ArrowPad;
//! [0]
setCentralWidget(arrowPad);
//! [1]
exitAct = new QAction(tr("E&xit"), this);
exitAct->setShortcuts(QKeySequence::Quit);
connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));
//! [1]
fileMenu = menuBar()->addMenu(tr("&File"));
fileMenu->addAction(exitAct);
}

View File

@ -1,68 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the 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 Digia Plc and its Subsidiary(-ies) 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$
**
****************************************************************************/
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
QT_BEGIN_NAMESPACE
class QAction;
class QMenu;
QT_END_NAMESPACE
class ArrowPad;
//! [0]
class MainWindow : public QMainWindow
//! [0] //! [1]
{
Q_OBJECT
//! [1]
public:
MainWindow();
private:
ArrowPad *arrowPad;
QMenu *fileMenu;
QAction *exitAct;
};
#endif

View File

@ -1,13 +0,0 @@
#! [0]
SOURCES = main.cpp
#! [0] #! [1]
TRANSLATIONS = hellotr_la.ts
#! [1]
# install
target.path = $$[QT_INSTALL_EXAMPLES]/linguist/hellotr
INSTALLS += target
QT += widgets
simulator: warning(This example might not fully work on Simulator platform)

View File

@ -1,70 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the 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 Digia Plc and its Subsidiary(-ies) 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$
**
****************************************************************************/
#include <QApplication>
#include <QPushButton>
//! [0]
#include <QTranslator>
//! [0]
//! [1] //! [2]
int main(int argc, char *argv[])
//! [1] //! [3] //! [4]
{
QApplication app(argc, argv);
//! [3]
//! [5]
QTranslator translator;
//! [5] //! [6]
translator.load("hellotr_la");
//! [6] //! [7]
app.installTranslator(&translator);
//! [4] //! [7]
//! [8]
QPushButton hello(QPushButton::tr("Hello world!"));
//! [8]
hello.resize(100, 30);
hello.show();
return app.exec();
}
//! [2]

View File

@ -1,6 +0,0 @@
TEMPLATE = subdirs
SUBDIRS = arrowpad \
hellotr \
trollprint
QT += widgets

View File

@ -1,60 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the 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 Digia Plc and its Subsidiary(-ies) 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$
**
****************************************************************************/
#include <QtWidgets>
#include "mainwindow.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QString locale = QLocale::system().name();
//! [0]
QTranslator translator;
translator.load(QString("trollprint_") + locale);
app.installTranslator(&translator);
//! [0]
MainWindow mainWindow;
mainWindow.show();
return app.exec();
}

View File

@ -1,95 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the 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 Digia Plc and its Subsidiary(-ies) 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$
**
****************************************************************************/
#include <QtWidgets>
#include "mainwindow.h"
#include "printpanel.h"
MainWindow::MainWindow()
{
printPanel = new PrintPanel;
setCentralWidget(printPanel);
createActions();
createMenus();
//! [0]
setWindowTitle(tr("Troll Print 1.0"));
//! [0]
}
void MainWindow::about()
{
QMessageBox::information(this, tr("About Troll Print 1.0"),
tr("Troll Print 1.0.\n\n"
"Copyright 1999 Software, Inc."));
}
//! [1]
void MainWindow::createActions()
{
//! [2]
exitAct = new QAction(tr("E&xit"), this);
exitAct->setShortcut(tr("Ctrl+Q", "Quit"));
//! [2]
connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));
aboutAct = new QAction(tr("&About"), this);
aboutAct->setShortcut(Qt::Key_F1);
connect(aboutAct, SIGNAL(triggered()), this, SLOT(about()));
aboutQtAct = new QAction(tr("About &Qt"), this);
connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
}
void MainWindow::createMenus()
//! [1] //! [3]
{
QMenu *fileMenu = menuBar()->addMenu(tr("&File"));
fileMenu->addAction(exitAct);
menuBar()->addSeparator();
QMenu *helpMenu = menuBar()->addMenu(tr("&Help"));
helpMenu->addAction(aboutAct);
helpMenu->addAction(aboutQtAct);
}
//! [3]

View File

@ -1,74 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the 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 Digia Plc and its Subsidiary(-ies) 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$
**
****************************************************************************/
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
QT_BEGIN_NAMESPACE
class QAction;
class QMenu;
QT_END_NAMESPACE
class PrintPanel;
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow();
private slots:
void about();
private:
void createActions();
void createMenus();
PrintPanel *printPanel;
QMenu *fileMenu;
QMenu *helpMenu;
QAction *exitAct;
QAction *aboutAct;
QAction *aboutQtAct;
};
#endif

View File

@ -1,85 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the 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 Digia Plc and its Subsidiary(-ies) 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$
**
****************************************************************************/
#include <QtWidgets>
#include "printpanel.h"
//! [0]
PrintPanel::PrintPanel(QWidget *parent)
: QWidget(parent)
{
/*
QLabel *label = new QLabel(tr("<b>TROLL PRINT</b>"));
label->setAlignment(Qt::AlignCenter);
*/
//! [0]
//! [1]
twoSidedGroupBox = new QGroupBox(tr("2-sided"));
twoSidedEnabledRadio = new QRadioButton(tr("Enabled"));
twoSidedDisabledRadio = new QRadioButton(tr("Disabled"));
//! [1] //! [2]
twoSidedDisabledRadio->setChecked(true);
colorsGroupBox = new QGroupBox(tr("Colors"));
colorsEnabledRadio = new QRadioButton(tr("Enabled"));
colorsDisabledRadio = new QRadioButton(tr("Disabled"));
//! [2]
colorsDisabledRadio->setChecked(true);
QHBoxLayout *twoSidedLayout = new QHBoxLayout;
twoSidedLayout->addWidget(twoSidedEnabledRadio);
twoSidedLayout->addWidget(twoSidedDisabledRadio);
twoSidedGroupBox->setLayout(twoSidedLayout);
QHBoxLayout *colorsLayout = new QHBoxLayout;
colorsLayout->addWidget(colorsEnabledRadio);
colorsLayout->addWidget(colorsDisabledRadio);
colorsGroupBox->setLayout(colorsLayout);
QVBoxLayout *mainLayout = new QVBoxLayout;
/*
mainLayout->addWidget(label);
*/
mainLayout->addWidget(twoSidedGroupBox);
mainLayout->addWidget(colorsGroupBox);
setLayout(mainLayout);
}

View File

@ -1,69 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the 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 Digia Plc and its Subsidiary(-ies) 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$
**
****************************************************************************/
#ifndef PRINTPANEL_H
#define PRINTPANEL_H
#include <QWidget>
QT_BEGIN_NAMESPACE
class QGroupBox;
class QRadioButton;
QT_END_NAMESPACE
//! [0]
class PrintPanel : public QWidget
{
Q_OBJECT
//! [0]
public:
PrintPanel(QWidget *parent = 0);
private:
QGroupBox *twoSidedGroupBox;
QGroupBox *colorsGroupBox;
QRadioButton *twoSidedEnabledRadio;
QRadioButton *twoSidedDisabledRadio;
QRadioButton *colorsEnabledRadio;
QRadioButton *colorsDisabledRadio;
};
#endif

View File

@ -1,14 +0,0 @@
HEADERS = mainwindow.h \
printpanel.h
SOURCES = main.cpp \
mainwindow.cpp \
printpanel.cpp
TRANSLATIONS = trollprint_pt.ts
# install
target.path = $$[QT_INSTALL_EXAMPLES]/linguist/trollprint
INSTALLS += target
QT += widgets
simulator: warning(This example might not fully work on Simulator platform)

View File

@ -1,65 +0,0 @@
<!DOCTYPE TS><TS>
<context>
<name>MainWindow</name>
<message>
<source>Troll Print 1.0</source>
<translation>Troll Imprimir 1.0</translation>
</message>
<message>
<source>E&amp;xit</source>
<translation>&amp;Sair</translation>
</message>
<message>
<source>&amp;About</source>
<translation>&amp;Sobre</translation>
</message>
<message>
<source>About &amp;Qt</source>
<translation>Sobre &amp;Qt</translation>
</message>
<message>
<source>&amp;File</source>
<translation>&amp;Arquivo</translation>
</message>
<message>
<source>&amp;Help</source>
<translation>A&amp;juda</translation>
</message>
<message>
<source>About Troll Print 1.0</source>
<translation>Sobre Troll Imprimir 1.0</translation>
</message>
<message>
<source>Troll Print 1.0.
Copyright 1999 Software, Inc.</source>
<translation>Troll Imprimir 1.0
Copyright 1999 Software, Inc.</translation>
</message>
<message>
<source>Ctrl+Q</source>
<comment>Quit</comment>
<translation>Ctrl+Q</translation>
</message>
</context>
<context>
<name>PrintPanel</name>
<message>
<source>2-sided</source>
<translation>2-lados</translation>
</message>
<message>
<source>Enabled</source>
<translation>Ativado</translation>
</message>
<message>
<source>Disabled</source>
<translation>Desativado</translation>
</message>
<message>
<source>Colors</source>
<translation>Cores</translation>
</message>
</context>
</TS>