summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp48
-rw-r--r--src/corelib/kernel/qcoreapplication.h21
-rw-r--r--src/corelib/kernel/qcoreapplication_p.h2
-rw-r--r--src/corelib/kernel/qcoreapplication_win.cpp2
-rw-r--r--src/corelib/kernel/qcoreevent.cpp1
-rw-r--r--src/corelib/kernel/qcoreevent.h8
-rw-r--r--src/corelib/kernel/qeventdispatcher_win.cpp74
-rw-r--r--src/corelib/kernel/qeventdispatcher_win_p.h71
-rw-r--r--src/corelib/kernel/qmetatype.cpp41
-rw-r--r--src/corelib/kernel/qmetatype.h16
-rw-r--r--src/corelib/kernel/qobject.cpp1
-rw-r--r--src/corelib/kernel/qobject.h4
-rw-r--r--src/corelib/kernel/qvariant.h37
13 files changed, 171 insertions, 155 deletions
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index 6d8bf20b7c..d716c7b0f6 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -171,7 +171,7 @@ CApaCommandLine* QCoreApplicationPrivate::symbianCommandLine()
#endif
-#if defined(Q_WS_WIN) || defined(Q_WS_MAC)
+#if defined(Q_OS_WIN) || defined(Q_WS_MAC)
extern QString qAppFileName();
#endif
@@ -319,7 +319,7 @@ Q_GLOBAL_STATIC(QCoreApplicationData, coreappdata)
QCoreApplicationPrivate::QCoreApplicationPrivate(int &aargc, char **aargv, uint flags)
: QObjectPrivate(), argc(aargc), argv(aargv), application_type(0), eventFilter(0),
- in_exec(false), aboutToQuitEmitted(false)
+ in_exec(false), aboutToQuitEmitted(false), threadData_clean(false)
{
app_compile_version = flags & 0xffffff;
static const char *const empty = "";
@@ -344,7 +344,12 @@ QCoreApplicationPrivate::QCoreApplicationPrivate(int &aargc, char **aargv, uint
QCoreApplicationPrivate::~QCoreApplicationPrivate()
{
- if (threadData) {
+ cleanupThreadData();
+}
+
+void QCoreApplicationPrivate::cleanupThreadData()
+{
+ if (threadData && !threadData_clean) {
#ifndef QT_NO_THREAD
void *data = &threadData->tls;
QThreadStorageData::finish((void **)data);
@@ -363,6 +368,7 @@ QCoreApplicationPrivate::~QCoreApplicationPrivate()
threadData->postEventList.clear();
threadData->postEventList.recursion = 0;
threadData->quitNow = false;
+ threadData_clean = true;
}
}
@@ -578,23 +584,6 @@ void QCoreApplication::flush()
\a argc must be greater than zero and \a argv must contain at least
one valid character string.
*/
-QCoreApplication::QCoreApplication(int &argc, char **argv)
- : QObject(*new QCoreApplicationPrivate(argc, argv, 0x040000))
-{
- init();
- QCoreApplicationPrivate::eventDispatcher->startingUp();
-#if defined(Q_OS_SYMBIAN) && !defined(QT_NO_LIBRARY)
- // Refresh factoryloader, as text codecs are requested during lib path
- // resolving process and won't be therefore properly loaded.
- // Unknown if this is symbian specific issue.
- QFactoryLoader::refreshAll();
-#endif
-
-#if defined(Q_OS_SYMBIAN) && !defined(QT_NO_SYSTEMLOCALE)
- d_func()->symbianInit();
-#endif
-}
-
QCoreApplication::QCoreApplication(int &argc, char **argv, int _internal)
: QObject(*new QCoreApplicationPrivate(argc, argv, _internal))
{
@@ -754,20 +743,6 @@ void QCoreApplication::setAttribute(Qt::ApplicationAttribute attribute, bool on)
QCoreApplicationPrivate::attribs |= 1 << attribute;
else
QCoreApplicationPrivate::attribs &= ~(1 << attribute);
-#ifdef Q_OS_MAC
- // Turn on the no native menubar here, since we used to
- // do this implicitly. We DO NOT flip it off if someone sets
- // it to false.
- // Ideally, we'd have magic that would be something along the lines of
- // "follow MacPluginApplication" unless explicitly set.
- // Considering this attribute isn't only at the beginning
- // it's unlikely it will ever be a problem, but I want
- // to have the behavior documented here.
- if (attribute == Qt::AA_MacPluginApplication && on
- && !testAttribute(Qt::AA_DontUseNativeMenuBar)) {
- setAttribute(Qt::AA_DontUseNativeMenuBar, true);
- }
-#endif
}
/*!
@@ -1274,7 +1249,7 @@ void QCoreApplication::postEvent(QObject *receiver, QEvent *event, int priority)
*/
bool QCoreApplication::compressEvent(QEvent *event, QObject *receiver, QPostEventList *postedEvents)
{
-#ifdef Q_WS_WIN
+#ifdef Q_OS_WIN
Q_ASSERT(event);
Q_ASSERT(receiver);
Q_ASSERT(postedEvents);
@@ -1965,7 +1940,7 @@ QString QCoreApplication::applicationFilePath()
if (!d->cachedApplicationFilePath.isNull())
return d->cachedApplicationFilePath;
-#if defined(Q_WS_WIN)
+#if defined(Q_OS_WIN)
d->cachedApplicationFilePath = QFileInfo(qAppFileName()).filePath();
return d->cachedApplicationFilePath;
#elif defined(Q_WS_MAC)
@@ -2160,7 +2135,6 @@ QStringList QCoreApplication::arguments()
;
else if (l1arg == "-style" ||
l1arg == "-session" ||
- l1arg == "-graphicssystem" ||
l1arg == "-testability")
++a;
else
diff --git a/src/corelib/kernel/qcoreapplication.h b/src/corelib/kernel/qcoreapplication.h
index adc70387cc..04d538d1b3 100644
--- a/src/corelib/kernel/qcoreapplication.h
+++ b/src/corelib/kernel/qcoreapplication.h
@@ -46,7 +46,7 @@
#include <QtCore/qcoreevent.h>
#include <QtCore/qeventloop.h>
-#if defined(Q_WS_WIN) && !defined(tagMSG)
+#if defined(Q_OS_WIN) && !defined(tagMSG)
typedef struct tagMSG MSG;
#endif
@@ -77,16 +77,7 @@ public:
enum { ApplicationFlags = QT_VERSION
};
-#if defined(QT_BUILD_CORE_LIB) || defined(qdoc)
- QCoreApplication(int &argc, char **argv); // ### Qt5 remove
-#endif
-#if !defined(qdoc)
- QCoreApplication(int &argc, char **argv, int
-#if !defined(QT_BUILD_CORE_LIB)
- = ApplicationFlags
-#endif
- );
-#endif
+ QCoreApplication(int &argc, char **argv, int = ApplicationFlags);
~QCoreApplication();
@@ -157,7 +148,7 @@ public:
static void flush();
-#if defined(Q_WS_WIN)
+#if defined(Q_OS_WIN)
virtual bool winEventFilter(MSG *message, long *result);
#endif
@@ -198,11 +189,15 @@ private:
friend class QEventDispatcherUNIXPrivate;
friend class QApplication;
friend class QApplicationPrivate;
+ friend class QGuiApplication;
+ friend class QGuiApplicationPrivate;
friend class QETWidget;
friend class Q3AccelManager;
friend class QShortcutMap;
friend class QWidget;
+ friend class QWidgetWindow;
friend class QWidgetPrivate;
+ friend class QCocoaEventDispatcherPrivate;
friend bool qt_sendSpontaneousEvent(QObject*, QEvent*);
friend Q_CORE_EXPORT QString qAppName();
friend class QClassFactory;
@@ -266,7 +261,7 @@ Q_CORE_EXPORT void qAddPostRoutine(QtCleanUpFunction);
Q_CORE_EXPORT void qRemovePostRoutine(QtCleanUpFunction);
Q_CORE_EXPORT QString qAppName(); // get application name
-#if defined(Q_WS_WIN) && !defined(QT_NO_DEBUG_STREAM)
+#if defined(Q_OS_WIN) && !defined(QT_NO_DEBUG_STREAM)
Q_CORE_EXPORT QString decodeMSG(const MSG &);
Q_CORE_EXPORT QDebug operator<<(QDebug, const MSG &);
#endif
diff --git a/src/corelib/kernel/qcoreapplication_p.h b/src/corelib/kernel/qcoreapplication_p.h
index 8dff4ed80c..0914b24a16 100644
--- a/src/corelib/kernel/qcoreapplication_p.h
+++ b/src/corelib/kernel/qcoreapplication_p.h
@@ -110,6 +110,7 @@ public:
int &argc;
char **argv;
void appendApplicationPathToLibraryPaths(void);
+ void cleanupThreadData();
#ifndef QT_NO_TRANSLATION
QTranslatorList translators;
@@ -120,6 +121,7 @@ public:
bool in_exec;
bool aboutToQuitEmitted;
+ bool threadData_clean;
QString cachedApplicationDirPath;
QString cachedApplicationFilePath;
#if defined(Q_OS_SYMBIAN)
diff --git a/src/corelib/kernel/qcoreapplication_win.cpp b/src/corelib/kernel/qcoreapplication_win.cpp
index 6a77a74861..cb6d39a481 100644
--- a/src/corelib/kernel/qcoreapplication_win.cpp
+++ b/src/corelib/kernel/qcoreapplication_win.cpp
@@ -240,7 +240,7 @@ void QCoreApplicationPrivate::removePostedTimerEvent(QObject *object, int timerI
}
}
-#if defined(Q_WS_WIN) && !defined(QT_NO_DEBUG_STREAM)
+#if defined(Q_OS_WIN) && !defined(QT_NO_DEBUG_STREAM)
/*****************************************************************************
Convenience functions for convert WM_* messages into human readable strings,
including a nifty QDebug operator<< for simpel QDebug() << msg output.
diff --git a/src/corelib/kernel/qcoreevent.cpp b/src/corelib/kernel/qcoreevent.cpp
index 20376b9fa4..213f0e4a58 100644
--- a/src/corelib/kernel/qcoreevent.cpp
+++ b/src/corelib/kernel/qcoreevent.cpp
@@ -126,6 +126,7 @@ QT_BEGIN_NAMESPACE
\value Enter Mouse enters widget's boundaries.
\value EnterEditFocus An editor widget gains focus for editing.
\value EnterWhatsThisMode Send to toplevel widgets when the application enters "What's This?" mode.
+ \value Expose Sent to a window when its on-screen contents are invalidated and need to be flushed from the backing store.
\value FileOpen File open request (QFileOpenEvent).
\value FocusIn Widget gains keyboard focus (QFocusEvent).
\value FocusOut Widget loses keyboard focus (QFocusEvent).
diff --git a/src/corelib/kernel/qcoreevent.h b/src/corelib/kernel/qcoreevent.h
index 01a5356f73..831a403975 100644
--- a/src/corelib/kernel/qcoreevent.h
+++ b/src/corelib/kernel/qcoreevent.h
@@ -273,7 +273,13 @@ public:
ScrollPrepare = 204,
Scroll = 205,
- OrientationChange = 206, // Screen orientation has changed
+ Map = 206,
+ Unmap = 207,
+
+ Expose = 208,
+
+ InputMethodQuery = 209,
+ OrientationChange = 210, // Screen orientation has changed
// 512 reserved for Qt Jambi's MetaCall event
// 513 reserved for Qt Jambi's DeleteOnMainThread event
diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp
index 84663fa5ea..fc66e9bfd6 100644
--- a/src/corelib/kernel/qeventdispatcher_win.cpp
+++ b/src/corelib/kernel/qeventdispatcher_win.cpp
@@ -50,7 +50,6 @@
#include "qvarlengtharray.h"
#include "qwineventnotifier_p.h"
-#include "qabstracteventdispatcher_p.h"
#include "qcoreapplication_p.h"
#include <private/qthread_p.h>
#include <private/qmutexpool_p.h>
@@ -280,33 +279,7 @@ int WSAAsyncSelect(SOCKET, HWND, unsigned int, long)
class QEventDispatcherWin32Private;
-struct QSockNot {
- QSocketNotifier *obj;
- int fd;
-};
-typedef QHash<int, QSockNot *> QSNDict;
-
-struct WinTimerInfo { // internal timer info
- QObject *dispatcher;
- int timerId;
- int interval;
- QObject *obj; // - object to receive events
- bool inTimerEvent;
- int fastTimerId;
-};
-
-class QZeroTimerEvent : public QTimerEvent
-{
-public:
- inline QZeroTimerEvent(int timerId)
- : QTimerEvent(timerId)
- { t = QEvent::ZeroTimerEvent; }
-};
-
-typedef QList<WinTimerInfo*> WinTimerVec; // vector of TimerInfo structs
-typedef QHash<int, WinTimerInfo*> WinTimerDict; // fast dict of timers
-
-#if !defined(DWORD_PTR) && !defined(Q_WS_WIN64)
+#if !defined(DWORD_PTR) && !defined(Q_OS_WIN64)
#define DWORD_PTR DWORD
#endif
@@ -338,47 +311,6 @@ static void resolveTimerAPI()
}
}
-
-class QEventDispatcherWin32Private : public QAbstractEventDispatcherPrivate
-{
- Q_DECLARE_PUBLIC(QEventDispatcherWin32)
-public:
- QEventDispatcherWin32Private();
- ~QEventDispatcherWin32Private();
-
- DWORD threadId;
-
- bool interrupt;
-
- // internal window handle used for socketnotifiers/timers/etc
- HWND internalHwnd;
- HHOOK getMessageHook;
-
- // for controlling when to send posted events
- QAtomicInt serialNumber;
- int lastSerialNumber, sendPostedEventsWindowsTimerId;
- QAtomicInt wakeUps;
-
- // timers
- WinTimerVec timerVec;
- WinTimerDict timerDict;
- void registerTimer(WinTimerInfo *t);
- void unregisterTimer(WinTimerInfo *t, bool closingDown = false);
- void sendTimerEvent(int timerId);
-
- // socket notifiers
- QSNDict sn_read;
- QSNDict sn_write;
- QSNDict sn_except;
- void doWsaAsyncSelect(int socket);
-
- QList<QWinEventNotifier *> winEventNotifierList;
- void activateEventNotifier(QWinEventNotifier * wen);
-
- QList<MSG> queuedUserInputEvents;
- QList<MSG> queuedSocketEvents;
-};
-
QEventDispatcherWin32Private::QEventDispatcherWin32Private()
: threadId(GetCurrentThreadId()), interrupt(false), internalHwnd(0), getMessageHook(0),
serialNumber(0), lastSerialNumber(0), sendPostedEventsWindowsTimerId(0), wakeUps(0)
@@ -703,6 +635,10 @@ QEventDispatcherWin32::QEventDispatcherWin32(QObject *parent)
{
}
+QEventDispatcherWin32::QEventDispatcherWin32(QEventDispatcherWin32Private &dd, QObject *parent)
+ : QAbstractEventDispatcher(dd, parent)
+{ }
+
QEventDispatcherWin32::~QEventDispatcherWin32()
{
}
diff --git a/src/corelib/kernel/qeventdispatcher_win_p.h b/src/corelib/kernel/qeventdispatcher_win_p.h
index 8fa77fdc4e..4a7aac0c04 100644
--- a/src/corelib/kernel/qeventdispatcher_win_p.h
+++ b/src/corelib/kernel/qeventdispatcher_win_p.h
@@ -56,6 +56,8 @@
#include "QtCore/qabstracteventdispatcher.h"
#include "QtCore/qt_windows.h"
+#include "qabstracteventdispatcher_p.h"
+
QT_BEGIN_NAMESPACE
class QWinEventNotifier;
@@ -100,11 +102,80 @@ public:
bool event(QEvent *e);
+protected:
+ QEventDispatcherWin32(QEventDispatcherWin32Private &dd, QObject *parent = 0);
+
private:
friend LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp);
friend LRESULT QT_WIN_CALLBACK qt_GetMessageHook(int, WPARAM, LPARAM);
};
+struct QSockNot {
+ QSocketNotifier *obj;
+ int fd;
+};
+typedef QHash<int, QSockNot *> QSNDict;
+
+struct WinTimerInfo { // internal timer info
+ QObject *dispatcher;
+ int timerId;
+ int interval;
+ QObject *obj; // - object to receive events
+ bool inTimerEvent;
+ int fastTimerId;
+};
+
+class QZeroTimerEvent : public QTimerEvent
+{
+public:
+ inline QZeroTimerEvent(int timerId)
+ : QTimerEvent(timerId)
+ { t = QEvent::ZeroTimerEvent; }
+};
+
+typedef QList<WinTimerInfo*> WinTimerVec; // vector of TimerInfo structs
+typedef QHash<int, WinTimerInfo*> WinTimerDict; // fast dict of timers
+
+class Q_CORE_EXPORT QEventDispatcherWin32Private : public QAbstractEventDispatcherPrivate
+{
+ Q_DECLARE_PUBLIC(QEventDispatcherWin32)
+public:
+ QEventDispatcherWin32Private();
+ ~QEventDispatcherWin32Private();
+
+ DWORD threadId;
+
+ bool interrupt;
+
+ // internal window handle used for socketnotifiers/timers/etc
+ HWND internalHwnd;
+ HHOOK getMessageHook;
+
+ // for controlling when to send posted events
+ QAtomicInt serialNumber;
+ int lastSerialNumber, sendPostedEventsWindowsTimerId;
+ QAtomicInt wakeUps;
+
+ // timers
+ WinTimerVec timerVec;
+ WinTimerDict timerDict;
+ void registerTimer(WinTimerInfo *t);
+ void unregisterTimer(WinTimerInfo *t, bool closingDown = false);
+ void sendTimerEvent(int timerId);
+
+ // socket notifiers
+ QSNDict sn_read;
+ QSNDict sn_write;
+ QSNDict sn_except;
+ void doWsaAsyncSelect(int socket);
+
+ QList<QWinEventNotifier *> winEventNotifierList;
+ void activateEventNotifier(QWinEventNotifier * wen);
+
+ QList<MSG> queuedUserInputEvents;
+ QList<MSG> queuedSocketEvents;
+};
+
QT_END_NAMESPACE
#endif // QEVENTDISPATCHER_WIN_P_H
diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp
index f241903cb9..c97f9d260e 100644
--- a/src/corelib/kernel/qmetatype.cpp
+++ b/src/corelib/kernel/qmetatype.cpp
@@ -265,19 +265,16 @@ static const struct { const char * typeName; int typeNameLength; int type; } typ
QT_ADD_STATIC_METATYPE("QEasingCurve", QMetaType::QEasingCurve),
/* All GUI types */
- QT_ADD_STATIC_METATYPE("QColorGroup", 63),
QT_ADD_STATIC_METATYPE("QFont", QMetaType::QFont),
QT_ADD_STATIC_METATYPE("QPixmap", QMetaType::QPixmap),
QT_ADD_STATIC_METATYPE("QBrush", QMetaType::QBrush),
QT_ADD_STATIC_METATYPE("QColor", QMetaType::QColor),
QT_ADD_STATIC_METATYPE("QPalette", QMetaType::QPalette),
- QT_ADD_STATIC_METATYPE("QIcon", QMetaType::QIcon),
QT_ADD_STATIC_METATYPE("QImage", QMetaType::QImage),
QT_ADD_STATIC_METATYPE("QPolygon", QMetaType::QPolygon),
QT_ADD_STATIC_METATYPE("QRegion", QMetaType::QRegion),
QT_ADD_STATIC_METATYPE("QBitmap", QMetaType::QBitmap),
QT_ADD_STATIC_METATYPE("QCursor", QMetaType::QCursor),
- QT_ADD_STATIC_METATYPE("QSizePolicy", QMetaType::QSizePolicy),
QT_ADD_STATIC_METATYPE("QKeySequence", QMetaType::QKeySequence),
QT_ADD_STATIC_METATYPE("QPen", QMetaType::QPen),
QT_ADD_STATIC_METATYPE("QTextLength", QMetaType::QTextLength),
@@ -290,6 +287,10 @@ static const struct { const char * typeName; int typeNameLength; int type; } typ
QT_ADD_STATIC_METATYPE("QVector4D", QMetaType::QVector4D),
QT_ADD_STATIC_METATYPE("QQuaternion", QMetaType::QQuaternion),
+ /* All Widgets types */
+ QT_ADD_STATIC_METATYPE("QIcon", QMetaType::QIcon),
+ QT_ADD_STATIC_METATYPE("QSizePolicy", QMetaType::QSizePolicy),
+
/* All Metatype builtins */
QT_ADD_STATIC_METATYPE("void*", QMetaType::VoidStar),
QT_ADD_STATIC_METATYPE("long", QMetaType::Long),
@@ -338,6 +339,7 @@ struct QMetaTypeGuiHelper
#endif
};
Q_CORE_EXPORT const QMetaTypeGuiHelper *qMetaTypeGuiHelper = 0;
+Q_CORE_EXPORT const QMetaTypeGuiHelper *qMetaTypeWidgetsHelper = 0;
class QCustomTypeInfo
{
@@ -399,14 +401,17 @@ void QMetaType::registerStreamOperators(int idx, SaveOperator saveOp,
*/
const char *QMetaType::typeName(int type)
{
- enum { GuiTypeCount = LastGuiType - FirstGuiType };
+ enum { GuiTypeCount = LastGuiType - FirstGuiType,
+ WidgetsTypeCount = LastWidgetsType - FirstWidgetsType };
if (type >= 0 && type <= LastCoreType) {
return types[type].typeName;
} else if (type >= FirstGuiType && type <= LastGuiType) {
return types[type - FirstGuiType + LastCoreType + 1].typeName;
+ } else if (type >= FirstWidgetsType && type <= LastWidgetsType) {
+ return types[type - FirstWidgetsType + GuiTypeCount + LastCoreType + 2].typeName;
} else if (type >= FirstCoreExtType && type <= LastCoreExtType) {
- return types[type - FirstCoreExtType + GuiTypeCount + LastCoreType + 2].typeName;
+ return types[type - FirstCoreExtType + GuiTypeCount + WidgetsTypeCount + LastCoreType + 3].typeName;
} else if (type >= User) {
const QVector<QCustomTypeInfo> * const ct = customTypes();
QReadLocker locker(customTypesLock());
@@ -765,13 +770,11 @@ bool QMetaType::save(QDataStream &stream, int type, const void *data)
case QMetaType::QBrush:
case QMetaType::QColor:
case QMetaType::QPalette:
- case QMetaType::QIcon:
case QMetaType::QImage:
case QMetaType::QPolygon:
case QMetaType::QRegion:
case QMetaType::QBitmap:
case QMetaType::QCursor:
- case QMetaType::QSizePolicy:
case QMetaType::QKeySequence:
case QMetaType::QPen:
case QMetaType::QTextLength:
@@ -787,6 +790,12 @@ bool QMetaType::save(QDataStream &stream, int type, const void *data)
return false;
qMetaTypeGuiHelper[type - FirstGuiType].saveOp(stream, data);
break;
+ case QMetaType::QIcon:
+ case QMetaType::QSizePolicy:
+ if (!qMetaTypeWidgetsHelper)
+ return false;
+ qMetaTypeWidgetsHelper[type - FirstWidgetsType].saveOp(stream, data);
+ break;
default: {
const QVector<QCustomTypeInfo> * const ct = customTypes();
if (!ct)
@@ -967,13 +976,11 @@ bool QMetaType::load(QDataStream &stream, int type, void *data)
case QMetaType::QBrush:
case QMetaType::QColor:
case QMetaType::QPalette:
- case QMetaType::QIcon:
case QMetaType::QImage:
case QMetaType::QPolygon:
case QMetaType::QRegion:
case QMetaType::QBitmap:
case QMetaType::QCursor:
- case QMetaType::QSizePolicy:
case QMetaType::QKeySequence:
case QMetaType::QPen:
case QMetaType::QTextLength:
@@ -989,6 +996,12 @@ bool QMetaType::load(QDataStream &stream, int type, void *data)
return false;
qMetaTypeGuiHelper[type - FirstGuiType].loadOp(stream, data);
break;
+ case QMetaType::QIcon:
+ case QMetaType::QSizePolicy:
+ if (!qMetaTypeWidgetsHelper)
+ return false;
+ qMetaTypeWidgetsHelper[type - FirstWidgetsType].loadOp(stream, data);
+ break;
default: {
const QVector<QCustomTypeInfo> * const ct = customTypes();
if (!ct)
@@ -1218,6 +1231,10 @@ void *QMetaType::construct(int type, const void *copy)
if (!qMetaTypeGuiHelper)
return 0;
constr = qMetaTypeGuiHelper[type - FirstGuiType].constr;
+ } else if (type >= FirstWidgetsType && type <= LastWidgetsType) {
+ if (!qMetaTypeWidgetsHelper)
+ return 0;
+ constr = qMetaTypeWidgetsHelper[type - FirstWidgetsType].constr;
} else {
const QVector<QCustomTypeInfo> * const ct = customTypes();
QReadLocker locker(customTypesLock());
@@ -1380,6 +1397,12 @@ void QMetaType::destroy(int type, void *data)
if (!qMetaTypeGuiHelper)
return;
destr = qMetaTypeGuiHelper[type - FirstGuiType].destr;
+ } else if (type >= FirstWidgetsType && type <= LastWidgetsType) {
+ Q_ASSERT(qMetaTypeWidgetsHelper);
+
+ if (!qMetaTypeWidgetsHelper)
+ return;
+ destr = qMetaTypeWidgetsHelper[type - FirstWidgetsType].destr;
} else {
QReadLocker locker(customTypesLock());
if (type < User || !ct || ct->count() <= type - User)
diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h
index 767d79a14e..5df7658a13 100644
--- a/src/corelib/kernel/qmetatype.h
+++ b/src/corelib/kernel/qmetatype.h
@@ -71,16 +71,20 @@ public:
QLine = 23, QLineF = 24, QPoint = 25, QPointF = 26, QRegExp = 27,
QVariantHash = 28, QEasingCurve = 29, LastCoreType = QEasingCurve,
- FirstGuiType = 63 /* QColorGroup */,
+ FirstGuiType = 64 /* QFont */,
QFont = 64, QPixmap = 65, QBrush = 66, QColor = 67, QPalette = 68,
- QIcon = 69, QImage = 70, QPolygon = 71, QRegion = 72, QBitmap = 73,
- QCursor = 74, QSizePolicy = 75, QKeySequence = 76, QPen = 77,
- QTextLength = 78, QTextFormat = 79, QMatrix = 80, QTransform = 81,
- QMatrix4x4 = 82, QVector2D = 83, QVector3D = 84, QVector4D = 85,
- QQuaternion = 86,
+ QImage = 69, QPolygon = 70, QRegion = 71, QBitmap = 72,
+ QCursor = 73, QKeySequence = 74, QPen = 75,
+ QTextLength = 76, QTextFormat = 77, QMatrix = 78, QTransform = 79,
+ QMatrix4x4 = 80, QVector2D = 81, QVector3D = 82, QVector4D = 83,
+ QQuaternion = 84,
LastGuiType = QQuaternion,
+ FirstWidgetsType = 120, /* QIcon */
+ QIcon = 120, QSizePolicy = 121,
+ LastWidgetsType = QSizePolicy,
+
FirstCoreExtType = 128 /* VoidStar */,
VoidStar = 128, Long = 129, Short = 130, Char = 131, ULong = 132,
UShort = 133, UChar = 134, Float = 135, QObjectStar = 136, QWidgetStar = 137,
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index b769beac03..0f314d45f1 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -177,6 +177,7 @@ QObjectPrivate::QObjectPrivate(int version)
#endif
metaObject = 0;
hasGuards = false;
+ isWindow = false;
}
QObjectPrivate::~QObjectPrivate()
diff --git a/src/corelib/kernel/qobject.h b/src/corelib/kernel/qobject.h
index 59ff988ba9..591c5c88bf 100644
--- a/src/corelib/kernel/qobject.h
+++ b/src/corelib/kernel/qobject.h
@@ -102,7 +102,8 @@ public:
uint inEventHandler : 1; //only used if QT_JAMBI_BUILD
uint inThreadChangeEvent : 1;
uint hasGuards : 1; //true iff there is one or more QPointer attached to this object
- uint unused : 22;
+ uint isWindow : 1; //for QWindow
+ uint unused : 21;
int postedEvents;
QMetaObject *metaObject; // assert dynamic
};
@@ -144,6 +145,7 @@ public:
void setObjectName(const QString &name);
inline bool isWidgetType() const { return d_ptr->isWidget; }
+ inline bool isWindowType() const { return d_ptr->isWindow; }
inline bool signalsBlocked() const { return d_ptr->blockSig; }
bool blockSignals(bool b);
diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h
index de8f9111f9..e77fc90b92 100644
--- a/src/corelib/kernel/qvariant.h
+++ b/src/corelib/kernel/qvariant.h
@@ -132,26 +132,27 @@ class Q_CORE_EXPORT QVariant
Brush = 66,
Color = 67,
Palette = 68,
- Icon = 69,
- Image = 70,
- Polygon = 71,
- Region = 72,
- Bitmap = 73,
- Cursor = 74,
- SizePolicy = 75,
- KeySequence = 76,
- Pen = 77,
- TextLength = 78,
- TextFormat = 79,
- Matrix = 80,
- Transform = 81,
- Matrix4x4 = 82,
- Vector2D = 83,
- Vector3D = 84,
- Vector4D = 85,
- Quaternion = 86,
+ Image = 69,
+ Polygon = 70,
+ Region = 71,
+ Bitmap = 72,
+ Cursor = 73,
+ KeySequence = 74,
+ Pen = 75,
+ TextLength = 76,
+ TextFormat = 77,
+ Matrix = 78,
+ Transform = 79,
+ Matrix4x4 = 80,
+ Vector2D = 81,
+ Vector3D = 82,
+ Vector4D = 83,
+ Quaternion = 84,
LastGuiType = Quaternion,
+ Icon = 120,
+ SizePolicy = 121,
+
UserType = 127,
LastType = 0xffffffff // need this so that gcc >= 3.4 allocates 32 bits for Type
};