summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2009-04-28 07:40:30 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2009-04-28 07:40:30 (GMT)
commit427c35771a83cce39f5f48c188c180d35ef6ecc9 (patch)
tree31164c83e5cf610cee9c505e857141866995664d /src/corelib/kernel
parent7a35cb66f1ca6e90655ece3c726f8d2c01c68b53 (diff)
parentf65e60b49395d68be78259ec82c9969b267e591c (diff)
downloadQt-427c35771a83cce39f5f48c188c180d35ef6ecc9.zip
Qt-427c35771a83cce39f5f48c188c180d35ef6ecc9.tar.gz
Qt-427c35771a83cce39f5f48c188c180d35ef6ecc9.tar.bz2
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt into kinetic-declarativeui
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp15
-rw-r--r--src/corelib/kernel/qcoreevent.cpp1
-rw-r--r--src/corelib/kernel/qeventdispatcher_glib.cpp3
-rw-r--r--src/corelib/kernel/qeventloop.cpp5
-rw-r--r--src/corelib/kernel/qvariant.cpp58
5 files changed, 47 insertions, 35 deletions
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index a23b2dd..e4bd664 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -377,12 +377,12 @@ QString qAppName()
QLibrary) can be retrieved with libraryPaths() and manipulated by
setLibraryPaths(), addLibraryPath(), and removeLibraryPath().
- On Unix/Linux Qt is configured to use the system local settings by
- default. This can cause a conflict when using POSIX functions, for
- instance, when converting between data types such as floats and
- strings, since the notation may differ between locales. To get
- around this problem call the POSIX function setlocale(LC_NUMERIC,"C")
- right after initializing QApplication or QCoreApplication to reset
+ On Unix/Linux Qt is configured to use the system local settings by
+ default. This can cause a conflict when using POSIX functions, for
+ instance, when converting between data types such as floats and
+ strings, since the notation may differ between locales. To get
+ around this problem call the POSIX function setlocale(LC_NUMERIC,"C")
+ right after initializing QApplication or QCoreApplication to reset
the locale that is used for number formatting to "C"-locale.
\sa QApplication, QAbstractEventDispatcher, QEventLoop,
@@ -1908,8 +1908,7 @@ QStringList QCoreApplication::arguments()
l1arg == "-qdebug" ||
l1arg == "-reverse" ||
l1arg == "-stylesheet" ||
- l1arg == "-widgetcount" ||
- l1arg == "-direct3d")
+ l1arg == "-widgetcount")
;
else if (l1arg.startsWith("-style="))
;
diff --git a/src/corelib/kernel/qcoreevent.cpp b/src/corelib/kernel/qcoreevent.cpp
index fc1cefb..4b4dfe5 100644
--- a/src/corelib/kernel/qcoreevent.cpp
+++ b/src/corelib/kernel/qcoreevent.cpp
@@ -260,6 +260,7 @@ QT_BEGIN_NAMESPACE
\omitvalue ApplicationActivated
\omitvalue ApplicationDeactivated
\omitvalue MacGLWindowChange
+ \omitvalue MacGLClearDrawable
\omitvalue NetworkReplyUpdated
\omitvalue FutureCallOut
\omitvalue CocoaRequestModal
diff --git a/src/corelib/kernel/qeventdispatcher_glib.cpp b/src/corelib/kernel/qeventdispatcher_glib.cpp
index 3fd768a..3c5b277 100644
--- a/src/corelib/kernel/qeventdispatcher_glib.cpp
+++ b/src/corelib/kernel/qeventdispatcher_glib.cpp
@@ -42,6 +42,7 @@
#include "qeventdispatcher_glib_p.h"
#include "qeventdispatcher_unix_p.h"
+#include <private/qmutexpool_p.h>
#include <private/qthread_p.h>
#include "qcoreapplication.h"
@@ -224,6 +225,8 @@ QEventDispatcherGlibPrivate::QEventDispatcherGlibPrivate(GMainContext *context)
: mainContext(context)
{
if (qgetenv("QT_NO_THREADED_GLIB").isEmpty()) {
+ static int dummyValue = 0; // only used for its address
+ QMutexLocker locker(QMutexPool::instance()->get(&dummyValue));
if (!g_thread_supported())
g_thread_init(NULL);
}
diff --git a/src/corelib/kernel/qeventloop.cpp b/src/corelib/kernel/qeventloop.cpp
index 92bdf73..600f787 100644
--- a/src/corelib/kernel/qeventloop.cpp
+++ b/src/corelib/kernel/qeventloop.cpp
@@ -188,8 +188,9 @@ int QEventLoop::exec(ProcessEventsFlags flags)
d->threadData->eventLoops.push(this);
// remove posted quit events when entering a new event loop
- if (qApp->thread() == thread())
- QCoreApplication::removePostedEvents(qApp, QEvent::Quit);
+ QCoreApplication *app = QCoreApplication::instance();
+ if (app && app->thread() == thread())
+ QCoreApplication::removePostedEvents(app, QEvent::Quit);
#if defined(QT_NO_EXCEPTIONS)
while (!d->exit)
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp
index ea66658..ff59540 100644
--- a/src/corelib/kernel/qvariant.cpp
+++ b/src/corelib/kernel/qvariant.cpp
@@ -325,6 +325,7 @@ static bool isNull(const QVariant::Private *d)
case QVariant::ULongLong:
case QVariant::Bool:
case QVariant::Double:
+ case QMetaType::Float:
break;
}
return d->is_null;
@@ -416,6 +417,8 @@ static bool compare(const QVariant::Private *a, const QVariant::Private *b)
return a->data.b == b->data.b;
case QVariant::Double:
return a->data.d == b->data.d;
+ case QMetaType::Float:
+ return a->data.f == b->data.f;
case QVariant::Date:
return *v_cast<QDate>(a) == *v_cast<QDate>(b);
case QVariant::Time:
@@ -2554,57 +2557,62 @@ static const quint32 qCanConvertMatrix[QVariant::LastCoreType + 1] =
*/
bool QVariant::canConvert(Type t) const
{
- if (d.type == uint(t))
+ //we can treat floats as double
+ //the reason for not doing it the "proper" way is that QMetaTye Float's value is 135,
+ //which can't be handled by qCanConvertMatrix
+ const uint currentType = ((d.type == QMetaType::Float) ? QVariant::Double : d.type);
+ if (t == QMetaType::Float) t = QVariant::Double;
+
+ if (currentType == uint(t))
return true;
- if (d.type > QVariant::LastCoreType || t > QVariant::LastCoreType) {
+ if (currentType > QVariant::LastCoreType || t > QVariant::LastCoreType) {
switch (uint(t)) {
case QVariant::Int:
- return d.type == QVariant::KeySequence
- || d.type == QMetaType::ULong
- || d.type == QMetaType::Long
- || d.type == QMetaType::UShort
- || d.type == QMetaType::UChar
- || d.type == QMetaType::Char
- || d.type == QMetaType::Short;
+ return currentType == QVariant::KeySequence
+ || currentType == QMetaType::ULong
+ || currentType == QMetaType::Long
+ || currentType == QMetaType::UShort
+ || currentType == QMetaType::UChar
+ || currentType == QMetaType::Char
+ || currentType == QMetaType::Short;
case QVariant::Image:
- return d.type == QVariant::Pixmap || d.type == QVariant::Bitmap;
+ return currentType == QVariant::Pixmap || currentType == QVariant::Bitmap;
case QVariant::Pixmap:
- return d.type == QVariant::Image || d.type == QVariant::Bitmap
- || d.type == QVariant::Brush;
+ return currentType == QVariant::Image || currentType == QVariant::Bitmap
+ || currentType == QVariant::Brush;
case QVariant::Bitmap:
- return d.type == QVariant::Pixmap || d.type == QVariant::Image;
+ return currentType == QVariant::Pixmap || currentType == QVariant::Image;
case QVariant::ByteArray:
- return d.type == QVariant::Color;
+ return currentType == QVariant::Color;
case QVariant::String:
- return d.type == QVariant::KeySequence || d.type == QVariant::Font
- || d.type == QVariant::Color;
+ return currentType == QVariant::KeySequence || currentType == QVariant::Font
+ || currentType == QVariant::Color;
case QVariant::KeySequence:
- return d.type == QVariant::String || d.type == QVariant::Int;
+ return currentType == QVariant::String || currentType == QVariant::Int;
case QVariant::Font:
- return d.type == QVariant::String;
+ return currentType == QVariant::String;
case QVariant::Color:
- return d.type == QVariant::String || d.type == QVariant::ByteArray
- || d.type == QVariant::Brush;
+ return currentType == QVariant::String || currentType == QVariant::ByteArray
+ || currentType == QVariant::Brush;
case QVariant::Brush:
- return d.type == QVariant::Color || d.type == QVariant::Pixmap;
+ return currentType == QVariant::Color || currentType == QVariant::Pixmap;
case QMetaType::Long:
case QMetaType::Char:
case QMetaType::UChar:
case QMetaType::ULong:
case QMetaType::Short:
case QMetaType::UShort:
- case QMetaType::Float:
- return qCanConvertMatrix[QVariant::Int] & (1 << d.type) || d.type == QVariant::Int;
+ return qCanConvertMatrix[QVariant::Int] & (1 << currentType) || currentType == QVariant::Int;
default:
return false;
}
}
- if(t == String && d.type == StringList)
+ if(t == String && currentType == StringList)
return v_cast<QStringList>(&d)->count() == 1;
else
- return qCanConvertMatrix[t] & (1 << d.type);
+ return qCanConvertMatrix[t] & (1 << currentType);
}
/*!