// 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.
*/
