summaryrefslogtreecommitdiffstats
path: root/qtsingleapplication/examples/loader/loader.qdoc
blob: 1f550267780831a43ed783e1eb2cbd77a5514447 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
// SPDX-License-Identifier: BSD-3-Clause

/*! \page qtsingleapplication-example-loader.html
    \title Loading Documents

    The application in this example loads or prints the documents 
    passed as commandline parameters to further instances of this
    application.

    \quotefromfile loader/main.cpp
    \printuntil };
    The user interface in this application is a QMainWindow subclass
    with a QMdiArea as the central widget. It implements a slot
    \c handleMessage() that will be connected to the messageReceived()
    signal of the QtSingleApplication class.

    \printuntil }
    The MainWindow constructor creates a minimal user interface.

    \printto case Print:
    The handleMessage() slot interprets the message passed in as a
    filename that can be prepended with \e /print to indicate that
    the file should just be printed rather than loaded.

    \printto #include
    Loading the file will also activate the window.

    \printto mw
    The \c main entry point function creates a QtSingleApplication
    object, and creates a message to send to a running instance
    of the application. If the message was sent successfully the
    process exits immediately.

    \printuntil }
    If the message could not be sent the application starts up.  Note
    that \c false is passed to the call to setActivationWindow() to
    prevent automatic activation for every message received, e.g. when
    the application should just print a file. Instead, the message
    handling function determines whether activation is requested, and
    signals that by emitting the needToShow() signal. This is then
    simply connected directly to QtSingleApplication's
    activateWindow() slot.
*/