/****************************************************************************
**
** Copyright (C) 2013 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$
**
****************************************************************************/

/*!
    \page qt-embedded-running.html

    \title Running Qt for Embedded Linux Applications
    \ingroup qt-embedded-linux

    A \l{Qt for Embedded Linux} application requires a server application to be
    running, or to be the server application itself. Any \l{Qt for Embedded Linux}
    application can be the server application by constructing the QApplication
    object with the QApplication::GuiServer type, or by running the application
    with the \c -qws command line option.

    Applications can run using both single and multiple displays, and
    various command line options are available.

    Note that this document assumes that you either are using the
    \l{The Virtual Framebuffer} or that you are running \l{Qt for Embedded Linux}
    using the \l {The VNC Protocol and Qt for Embedded Linux}{VNC} protocol,
    \e or that you have the Linux framebuffer configured
    correctly and that no server process is running. (To test that the
    Linux framebuffer is set up correctly, use the program provided by
    the \l {Testing the Linux Framebuffer} document.)

    \tableofcontents

    \section1 Using a Single Display

    To run the application using a single display, change to a Linux
    console and select an application to run, e.g. \l {Text
    Edit}{demos/textedit}.  Run the application with the \c -qws
    option:

    \snippet doc/src/snippets/code/doc_src_emb-running.qdoc 0

    \table 100%
    \row
    \o
    Provided that the environment variables are adjusted properly
    during the \l {Installing Qt for Embedded Linux}{installation process}, you
    should see the \l {Text Edit} demo appear.

    It might be that the hardware drivers must be specified explicitly
    to make everything work properly. For more information, please
    consult the following documentation:

    \list
        \o \l{Qt for Embedded Linux Pointer Handling}{Pointer Handling}
        \o \l{Qt for Embedded Linux Character Input}{Character Input}
        \o \l{Qt for Embedded Linux Display Management}{Display Management}
    \endlist

    \o
    \inlineimage qt-embedded-runningapplication.png
    \endtable

    Additional applications can be run as clients, i.e., by running
    these applications \e without the \c -qws option they will connect
    to the existing server as clients. You can exit the server
    application at any time using \gui{Ctrl+Alt+Backspace}.

    \section1 Using Multiple Displays

    Qt for Embedded Linux also allows multiple displays to be used
    simultaneously. There are two ways of achieving this: Either run
    multiple Qt for Embedded Linux server processes, or use the
    ready-made \c Multi screen driver.

    When running multiple server processes, the screen driver (and
    display number) must be specified for each process using the \c
    -display command line option or by setting the QWS_DISPLAY
    environment variable. For example:

    \snippet doc/src/snippets/code/doc_src_emb-running.qdoc 1

    See the \l {Qt for Embedded Linux Display Management}{display management}
    documentation for more details on how to specify a screen
    driver. Note that you must also specify the display (i.e., server
    process) when starting client applications:

    \snippet doc/src/snippets/code/doc_src_emb-running.qdoc 2

    There is no way of moving a client from one display to another
    when running multiple server processes. Using the \c Multi screen
    driver, on the other hand, applications can easiliy be moved
    between the various screens.

    The \c Multi screen driver can be specified just like any other
    screen driver by using the \c -display command line option or by
    setting the QWS_DISPLAY environment variable. For example:

    \snippet doc/src/snippets/code/doc_src_emb-running.qdoc 3

    See the \l {Qt for Embedded Linux Display Management}{display management}
    documentation for details regarding arguments.

    \section1 Command Line Options

    \table 100%
    \header
    \o Option \o Description
    \row
    \o \bold -fn <font>
    \o
    Defines the application font. For example:
    \snippet doc/src/snippets/code/doc_src_emb-running.qdoc 4
    The font should be specified using an X logical font description.
    \row
    \o \bold -bg <color>
    \o
    Sets the default application background color. For example:
    \snippet doc/src/snippets/code/doc_src_emb-running.qdoc 5
    The color-name must be one of the names recognized by the QColor constructor.
    \row
    \o \bold -btn <color> \o
    Sets the default button color. For example:
    \snippet doc/src/snippets/code/doc_src_emb-running.qdoc 6
    The color-name must be one of the names recognized by the QColor constructor.
    \row
    \o \bold -fg <color> \o
    Sets the default application foreground color. For example:
    \snippet doc/src/snippets/code/doc_src_emb-running.qdoc 7
    The color-name must be one of the names recognized by the QColor constructor.
    \row
    \o \bold -name <objectname> \o
    Sets the application name, i.e. the application object's object name. For example:
    \snippet doc/src/snippets/code/doc_src_emb-running.qdoc 8
    \row
    \o \bold -title <title> \o
    Sets the application's title. For example:
    \snippet doc/src/snippets/code/doc_src_emb-running.qdoc 9
    \row
    \o \bold -geometry <width>x<height>+<Xoffset>+<Yoffset> \o
    Sets the client geometry of the first window that is shown. For example:
    \snippet doc/src/snippets/code/doc_src_emb-running.qdoc 10
    \row
    \o \bold -keyboard \o
    Enables the keyboard.

    See also: \l {Qt for Embedded Linux Character Input}.
    \row
    \o \bold -nokeyboard \o
    Disables the keyboard.
    \row
    \o \bold -mouse \o
    Enables the mouse cursor.

    See also: \l {Qt for Embedded Linux Pointer Handling}.
    \row
    \o \bold -nomouse \o
    Disables the mouse cursor.
    \row
    \o \bold -qws \o
    Runs the application as a server application, i.e. constructs a
    QApplication object of the QApplication::GuiServer type.
    \row
    \o \bold -display \o
    Specifies the screen driver.

    See also: \l {Qt for Embedded Linux Display Management}.
    \row
    \o \bold -decoration <style>\o
    Sets the application decoration. For example:
    \snippet doc/src/snippets/code/doc_src_emb-running.qdoc 11
    The supported styles are \c windows, \c default and \c styled.

    See also QDecoration.

    \endtable
*/
