From f5cc4e9a020e78f0bf0d929ff2780b5bf01749ae Mon Sep 17 00:00:00 2001 From: Andreas Hartmetz Date: Tue, 1 Jun 2010 10:35:30 +0200 Subject: Added environment variable graphicssystem switch. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/gui/kernel/qapplication.cpp | 17 ++++++++++++++--- 1 file 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. -- cgit v0.12