summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qapplication.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/kernel/qapplication.cpp')
-rw-r--r--src/gui/kernel/qapplication.cpp91
1 files changed, 47 insertions, 44 deletions
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index cbb1f45..7219fed 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -391,6 +391,7 @@ Qt::MouseButtons QApplicationPrivate::mouse_buttons = Qt::NoButton;
Qt::KeyboardModifiers QApplicationPrivate::modifier_buttons = Qt::NoModifier;
QStyle *QApplicationPrivate::app_style = 0; // default application style
+QString QApplicationPrivate::styleOverride; // style override
#ifndef QT_NO_STYLE_STYLESHEET
QString QApplicationPrivate::styleSheet; // default application stylesheet
@@ -438,7 +439,6 @@ bool QApplicationPrivate::animate_tooltip = false;
bool QApplicationPrivate::fade_tooltip = false;
bool QApplicationPrivate::animate_toolbox = false;
bool QApplicationPrivate::widgetCount = false;
-QString* QApplicationPrivate::styleOverride = 0;
#if defined(Q_WS_WIN) && !defined(Q_WS_WINCE)
bool QApplicationPrivate::inSizeMove = false;
#endif
@@ -548,9 +548,7 @@ void QApplicationPrivate::process_cmdline()
delete app_style;
app_style = 0;
}
- if (!styleOverride)
- styleOverride = new QString;
- *styleOverride = s;
+ styleOverride = s;
}
}
@@ -1287,44 +1285,14 @@ QStyle *QApplication::style()
return 0;
}
-#if defined(Q_WS_X11)
- if(!QApplicationPrivate::styleOverride)
- QApplicationPrivate::x11_initialize_style(); // run-time search for default style
-#endif
if (!QApplicationPrivate::app_style) {
// Compile-time search for default style
//
QString style;
- if (QApplicationPrivate::styleOverride) {
- style = *QApplicationPrivate::styleOverride;
- delete QApplicationPrivate::styleOverride;
- QApplicationPrivate::styleOverride = 0;
- } else {
-#if defined(Q_WS_WIN) && defined(Q_WS_WINCE)
- if (qt_wince_is_smartphone() || qt_wince_is_pocket_pc())
- style = QLatin1String("WindowsMobile");
- else
- style = QLatin1String("WindowsCE");
-
-#elif defined(Q_WS_WIN)
- if ((QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA
- && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based))
- style = QLatin1String("WindowsVista");
- else if ((QSysInfo::WindowsVersion >= QSysInfo::WV_XP
- && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based))
- style = QLatin1String("WindowsXP");
- else
- style = QLatin1String("Windows"); // default styles for Windows
-#elif defined(Q_WS_X11) && defined(Q_OS_SOLARIS)
- style = QLatin1String("CDE"); // default style for X11 on Solaris
-#elif defined(Q_WS_X11) && defined(Q_OS_IRIX)
- style = QLatin1String("SGI"); // default style for X11 on IRIX
-#elif defined(Q_WS_X11) || defined(Q_WS_QWS)
- style = QLatin1String("Plastique"); // default style for X11 and small devices
-#elif defined(Q_WS_MAC)
- style = QLatin1String("Macintosh"); // default style for all Mac's
-#endif
- }
+ if (!QApplicationPrivate::styleOverride.isEmpty())
+ style = QApplicationPrivate::styleOverride;
+ else
+ style = QApplicationPrivate::desktopStyleKey();
QStyle *&app_style = QApplicationPrivate::app_style;
app_style = QStyleFactory::create(style);
@@ -1412,9 +1380,8 @@ void QApplication::setStyle(QStyle *style)
} else
#endif // QT_NO_STYLE_STYLESHEET
QApplicationPrivate::app_style = style;
-
QApplicationPrivate::app_style->setParent(qApp); // take ownership
-
+
// take care of possible palette requirements of certain gui
// styles. Do it before polishing the application since the style
// might call QApplication::setPalette() itself
@@ -1936,6 +1903,40 @@ void QApplicationPrivate::setSystemFont(const QFont &font)
QApplication::setFont(*sys_font);
}
+/*! \internal
+*/
+QString QApplicationPrivate::desktopStyleKey()
+{
+QString desktopstyle;
+#if defined(Q_WS_WIN) && defined(Q_WS_WINCE)
+ if (qt_wince_is_smartphone() || qt_wince_is_pocket_pc())
+ desktopstyle = QLatin1String("WindowsMobile");
+ else
+ desktopstyle = QLatin1String("WindowsCE");
+
+#elif defined(Q_WS_WIN)
+ if ((QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA
+ && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based))
+ desktopstyle = QLatin1String("WindowsVista");
+ else if ((QSysInfo::WindowsVersion >= QSysInfo::WV_XP
+ && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based))
+ desktopstyle = QLatin1String("WindowsXP");
+ else
+ desktopstyle = QLatin1String("Windows"); // default styles for Windows
+#elif defined(Q_WS_X11) && defined(Q_OS_SOLARIS)
+ desktopstyle = QLatin1String("CDE"); // default style for X11 on Solaris
+#elif defined(Q_WS_X11) && defined(Q_OS_IRIX)
+ desktopstyle = QLatin1String("SGI"); // default style for X11 on IRIX
+#elif defined(Q_WS_QWS)
+ desktopstyle = QLatin1String("Plastique"); // default style for X11 and small devices
+#elif defined(Q_WS_X11)
+ desktopstyle = QApplicationPrivate::x11_desktop_style(); // default runtime dependant style for X11
+#elif defined(Q_WS_MAC)
+ desktopstyle = QLatin1String("Macintosh"); // default style for all Mac's
+#endif
+ return desktopstyle;
+}
+
/*!
\property QApplication::windowIcon
\brief the default window icon
@@ -3565,10 +3566,12 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
#if !defined(QT_NO_WHEELEVENT) || !defined(QT_NO_TABLETEVENT)
else if (
# ifndef QT_NO_WHEELEVENT
- e->type() == QEvent::Wheel ||
+ e->type() == QEvent::Wheel
+# else
+ false
# endif
# ifndef QT_NO_TABLETEVENT
- e->type() == QEvent::TabletMove
+ || e->type() == QEvent::TabletMove
|| e->type() == QEvent::TabletPress
|| e->type() == QEvent::TabletRelease
# endif