summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorAndreas Hartmetz <ahartmetz@gmail.com>2010-06-01 08:35:30 (GMT)
committerSamuel Rødal <samuel.rodal@nokia.com>2010-06-01 08:59:54 (GMT)
commitf5cc4e9a020e78f0bf0d929ff2780b5bf01749ae (patch)
tree56d10f3a61dae68e5c37a1727ce3ced121ce81c2 /src/gui
parent805126ebc2aa9a683edefbc21d4ee7362ae26f55 (diff)
downloadQt-f5cc4e9a020e78f0bf0d929ff2780b5bf01749ae.zip
Qt-f5cc4e9a020e78f0bf0d929ff2780b5bf01749ae.tar.gz
Qt-f5cc4e9a020e78f0bf0d929ff2780b5bf01749ae.tar.bz2
Added environment variable graphicssystem switch.
Add environment variable switch for graphicssystem so a default can be set at runtime without passing a command-line parameter. Merge-request: 622 Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/kernel/qapplication.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index a2c058a..09a3bfe 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -780,6 +780,9 @@ void QApplicationPrivate::construct(
qt_is_gui_used = (qt_appType != QApplication::Tty);
process_cmdline();
+ // the environment variable has the lowest precedence of runtime graphicssystem switches
+ if (graphics_system_name.isEmpty())
+ graphics_system_name = QString::fromLocal8Bit(qgetenv("QT_GRAPHICSSYSTEM"));
// Must be called before initialize()
qt_init(this, qt_appType
#ifdef Q_WS_X11
@@ -1560,10 +1563,18 @@ QStyle* QApplication::setStyle(const QString& style)
on-screen widgets and QPixmaps. The available systems are \c{"native"},
\c{"raster"} and \c{"opengl"}.
- This function call overrides both the application commandline
- \c{-graphicssystem} switch and the configure \c{-graphicssystem} switch.
+ There are several ways to set the graphics backend, in order of decreasing
+ precedence:
+ \list
+ \o the application commandline \c{-graphicssystem} switch
+ \o QApplication::setGraphicsSystem()
+ \o the QT_GRAPHICSSYSTEM environment variable
+ \o the Qt configure \c{-graphicssystem} switch
+ \endlist
+ If the highest precedence switch sets an invalid name, the error will be
+ ignored and the default backend will be used.
- \warning This function must be called before the QApplication constructor
+ \warning This function is only effective before the QApplication constructor
is called.
\note The \c{"opengl"} option is currently experimental.