summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qapplication.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2010-06-01 17:40:53 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2010-06-01 17:40:53 (GMT)
commit5c6e671c8cbab281af4685d3698790ab566ed2f2 (patch)
tree0f3e15d12cf984d8f49c7adfaf056063cc726803 /src/gui/kernel/qapplication.cpp
parent7165826d2e9ff77951a289c62746d6c87f725139 (diff)
parent0b034e816994f3c6ad5ba5e0e9f7c0c60ab9440d (diff)
downloadQt-5c6e671c8cbab281af4685d3698790ab566ed2f2.zip
Qt-5c6e671c8cbab281af4685d3698790ab566ed2f2.tar.gz
Qt-5c6e671c8cbab281af4685d3698790ab566ed2f2.tar.bz2
Merge remote branch 'origin/4.7' into qt-master-from-4.7
Diffstat (limited to 'src/gui/kernel/qapplication.cpp')
-rw-r--r--src/gui/kernel/qapplication.cpp52
1 files changed, 40 insertions, 12 deletions
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index 920000e..6caa7ee 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -70,6 +70,10 @@
#include "qmessagebox.h"
#include <QtGui/qgraphicsproxywidget.h>
+#ifdef QT_GRAPHICSSYSTEM_RUNTIME
+#include "private/qgraphicssystem_runtime_p.h"
+#endif
+
#include "qinputcontext.h"
#include "qkeymapper_p.h"
@@ -440,6 +444,7 @@ QPalette *QApplicationPrivate::set_pal = 0; // default palette set by pro
QGraphicsSystem *QApplicationPrivate::graphics_system = 0; // default graphics system
QString QApplicationPrivate::graphics_system_name; // graphics system id - for delayed initialization
+bool QApplicationPrivate::runtime_graphics_system = false;
Q_GLOBAL_STATIC(QMutex, applicationFontMutex)
QFont *QApplicationPrivate::app_font = 0; // default application font
@@ -664,7 +669,8 @@ void QApplicationPrivate::process_cmdline()
\o -geometry \e geometry, sets the client geometry of the first window
that is shown.
\o -fn or \c -font \e font, defines the application font. The font
- should be specified using an X logical font description.
+ should be specified using an X logical font description. Note that
+ this option is ignored when Qt is built with fontconfig support enabled.
\o -bg or \c -background \e color, sets the default background color
and an application palette (light and dark shades are calculated).
\o -fg or \c -foreground \e color, sets the default foreground color.
@@ -772,6 +778,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
@@ -1552,10 +1561,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.
@@ -1563,7 +1580,14 @@ QStyle* QApplication::setStyle(const QString& style)
void QApplication::setGraphicsSystem(const QString &system)
{
- QApplicationPrivate::graphics_system_name = system;
+#ifdef QT_GRAPHICSSYSTEM_RUNTIME
+ if (QApplicationPrivate::graphics_system_name == QLatin1String("runtime")) {
+ QRuntimeGraphicsSystem *r =
+ static_cast<QRuntimeGraphicsSystem *>(QApplicationPrivate::graphics_system);
+ r->setGraphicsSystem(system);
+ } else
+#endif
+ QApplicationPrivate::graphics_system_name = system;
}
/*!
@@ -2216,15 +2240,17 @@ void QApplication::closeAllWindows()
{
bool did_close = true;
QWidget *w;
- while((w = activeModalWidget()) && did_close) {
- if(!w->isVisible())
+ while ((w = activeModalWidget()) && did_close) {
+ if (!w->isVisible() || w->data->is_closing)
break;
did_close = w->close();
}
QWidgetList list = QApplication::topLevelWidgets();
for (int i = 0; did_close && i < list.size(); ++i) {
w = list.at(i);
- if (w->isVisible() && w->windowType() != Qt::Desktop) {
+ if (w->isVisible()
+ && w->windowType() != Qt::Desktop
+ && !w->data->is_closing) {
did_close = w->close();
list = QApplication::topLevelWidgets();
i = -1;
@@ -5261,18 +5287,20 @@ bool QApplication::keypadNavigationEnabled()
This function replaces the QInputContext instance used by the application
with \a inputContext.
+ Qt takes ownership of the given \a inputContext.
+
\sa inputContext()
*/
void QApplication::setInputContext(QInputContext *inputContext)
{
- Q_D(QApplication);
- Q_UNUSED(d);// only static members being used.
+ if (inputContext == QApplicationPrivate::inputContext)
+ return;
if (!inputContext) {
qWarning("QApplication::setInputContext: called with 0 input context");
return;
}
- delete d->inputContext;
- d->inputContext = inputContext;
+ delete QApplicationPrivate::inputContext;
+ QApplicationPrivate::inputContext = inputContext;
}
/*!