| 1 | /****************************************************************************
|
|---|
| 2 | **
|
|---|
| 3 | ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
|---|
| 4 | ** All rights reserved.
|
|---|
| 5 | ** Contact: Nokia Corporation ([email protected])
|
|---|
| 6 | **
|
|---|
| 7 | ** This file is part of the documentation of the Qt Toolkit.
|
|---|
| 8 | **
|
|---|
| 9 | ** $QT_BEGIN_LICENSE:FDL$
|
|---|
| 10 | ** Commercial Usage
|
|---|
| 11 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
|---|
| 12 | ** accordance with the Qt Commercial License Agreement provided with the
|
|---|
| 13 | ** Software or, alternatively, in accordance with the terms contained in a
|
|---|
| 14 | ** written agreement between you and Nokia.
|
|---|
| 15 | **
|
|---|
| 16 | ** GNU Free Documentation License
|
|---|
| 17 | ** Alternatively, this file may be used under the terms of the GNU Free
|
|---|
| 18 | ** Documentation License version 1.3 as published by the Free Software
|
|---|
| 19 | ** Foundation and appearing in the file included in the packaging of this
|
|---|
| 20 | ** file.
|
|---|
| 21 | **
|
|---|
| 22 | ** If you have questions regarding the use of this file, please contact
|
|---|
| 23 | ** Nokia at [email protected].
|
|---|
| 24 | ** $QT_END_LICENSE$
|
|---|
| 25 | **
|
|---|
| 26 | ****************************************************************************/
|
|---|
| 27 |
|
|---|
| 28 | /*!
|
|---|
| 29 | \page desktop-integration.html
|
|---|
| 30 | \title Desktop Integration
|
|---|
| 31 | \brief Integrating with the user's desktop environment.
|
|---|
| 32 |
|
|---|
| 33 | \ingroup best-practices
|
|---|
| 34 | \ingroup qt-gui-concepts
|
|---|
| 35 |
|
|---|
| 36 | Qt applications behave well in the user's desktop environment, but certain
|
|---|
| 37 | integrations require additional, and sometimes platform specific, techniques.
|
|---|
| 38 |
|
|---|
| 39 | \tableofcontents
|
|---|
| 40 |
|
|---|
| 41 | \section1 Useful Classes
|
|---|
| 42 |
|
|---|
| 43 | Various classes in Qt are designed to help developers integrate applications into
|
|---|
| 44 | users' desktop environments. These classes enable developers to take advantage
|
|---|
| 45 | of native services while still using a cross-platform API.
|
|---|
| 46 |
|
|---|
| 47 | \annotatedlist desktop
|
|---|
| 48 |
|
|---|
| 49 | \section1 Setting the Application Icon
|
|---|
| 50 |
|
|---|
| 51 | In order to change the icon of the executable application file
|
|---|
| 52 | itself, as it is presented on the desktop (i.e., prior to
|
|---|
| 53 | application execution), it is necessary to employ another,
|
|---|
| 54 | platform-dependent technique.
|
|---|
| 55 |
|
|---|
| 56 | \tableofcontents {1 Setting the Application Icon}
|
|---|
| 57 |
|
|---|
| 58 | \section1 Opening External Resources
|
|---|
| 59 |
|
|---|
| 60 | Although Qt provides facilities to handle and display resources, such as
|
|---|
| 61 | \l{QImageIOHandler}{common image formats} and \l{QTextDocument}{HTML},
|
|---|
| 62 | it is sometimes necessary to open files and external resources using external
|
|---|
| 63 | applications.
|
|---|
| 64 |
|
|---|
| 65 | QDesktopServices provides an interface to services offered by the user's desktop
|
|---|
| 66 | environment. In particular, the \l{QDesktopServices::}{openUrl()} function is
|
|---|
| 67 | used to open resources using the appropriate application, which may have been
|
|---|
| 68 | specifically configured by the user.
|
|---|
| 69 |
|
|---|
| 70 | \section1 System Tray Icons
|
|---|
| 71 |
|
|---|
| 72 | Many modern desktop environments feature docks or panels with \e{system trays}
|
|---|
| 73 | in which applications can install icons. Applications often use system tray icons
|
|---|
| 74 | to display status information, either by updating the icon itself or by showing
|
|---|
| 75 | information in "balloon messages". Additionally, many applications provide
|
|---|
| 76 | pop-up menus that can be accessed via their system tray icons.
|
|---|
| 77 |
|
|---|
| 78 | The QSystemTrayIcon class exposes all of the above features via an intuitive
|
|---|
| 79 | Qt-style API that can be used on all desktop platforms.
|
|---|
| 80 |
|
|---|
| 81 | \section1 Desktop Widgets
|
|---|
| 82 |
|
|---|
| 83 | On systems where the user's desktop is displayed using more than one screen,
|
|---|
| 84 | certain types of applications may need to obtain information about the
|
|---|
| 85 | configuration of the user's workspace to ensure that new windows and dialogs
|
|---|
| 86 | are opened in appropriate locations.
|
|---|
| 87 |
|
|---|
| 88 | The QDesktopWidget class can be used to monitor the positions of widgets and
|
|---|
| 89 | notify applications about changes to the way the desktop is split over the
|
|---|
| 90 | available screens. This enables applications to implement policies for
|
|---|
| 91 | positioning new windows so that, for example, they do not distract a user
|
|---|
| 92 | who is working on a specific task.
|
|---|
| 93 | */
|
|---|