summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/animation/qabstractanimation.cpp7
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_tools_qregexp.cpp2
-rw-r--r--src/corelib/global/qglobal.h4
-rw-r--r--src/corelib/global/qlogging.cpp36
-rw-r--r--src/corelib/io/qfiledevice.cpp7
-rw-r--r--src/corelib/io/qfileinfo.cpp11
-rw-r--r--src/corelib/io/qfileselector.cpp5
-rw-r--r--src/corelib/io/qfilesystemengine.cpp4
-rw-r--r--src/corelib/io/qfilesystemiterator_p.h4
-rw-r--r--src/corelib/io/qfilesystemiterator_unix.cpp15
-rw-r--r--src/corelib/io/qfilesystemwatcher_polling.cpp10
-rw-r--r--src/corelib/io/qtemporarydir.cpp14
-rw-r--r--src/corelib/io/qtextstream.cpp4
-rw-r--r--src/corelib/io/qwindowspipereader.cpp1
-rw-r--r--src/corelib/io/qwindowspipewriter.cpp1
-rw-r--r--src/corelib/kernel/qcoreevent.h1
-rw-r--r--src/corelib/kernel/qmath.cpp84
-rw-r--r--src/corelib/kernel/qmath.qdoc95
-rw-r--r--src/corelib/kernel/qobject.cpp4
-rw-r--r--src/corelib/kernel/qsharedmemory.cpp8
-rw-r--r--src/corelib/tools/qcollator.cpp5
-rw-r--r--src/corelib/tools/qdatetime.cpp21
-rw-r--r--src/corelib/tools/qregexp.cpp4
-rw-r--r--src/corelib/tools/qsize.cpp2
-rw-r--r--src/corelib/tools/tools.pri4
25 files changed, 195 insertions, 158 deletions
diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp
index f7bb1e91bd..95d7713cfe 100644
--- a/src/corelib/animation/qabstractanimation.cpp
+++ b/src/corelib/animation/qabstractanimation.cpp
@@ -253,8 +253,9 @@ QUnifiedTimer *QUnifiedTimer::instance()
void QUnifiedTimer::maybeUpdateAnimationsToCurrentTime()
{
- if (time.elapsed() - lastTick > 50)
- updateAnimationTimers(driver->elapsed());
+ qint64 elapsed = driver->elapsed();
+ if (elapsed - lastTick > 50)
+ updateAnimationTimers(elapsed);
}
void QUnifiedTimer::updateAnimationTimers(qint64 currentTick)
@@ -263,7 +264,7 @@ void QUnifiedTimer::updateAnimationTimers(qint64 currentTick)
if(insideTick)
return;
- qint64 totalElapsed = currentTick >= 0 ? currentTick : time.elapsed();
+ qint64 totalElapsed = currentTick >= 0 ? currentTick : driver->elapsed();
// ignore consistentTiming in case the pause timer is active
qint64 delta = (consistentTiming && !pauseTimer.isActive()) ?
diff --git a/src/corelib/doc/snippets/code/src_corelib_tools_qregexp.cpp b/src/corelib/doc/snippets/code/src_corelib_tools_qregexp.cpp
index 779fbaa723..530819a173 100644
--- a/src/corelib/doc/snippets/code/src_corelib_tools_qregexp.cpp
+++ b/src/corelib/doc/snippets/code/src_corelib_tools_qregexp.cpp
@@ -77,7 +77,7 @@ QRegExp mark("\\b" // word boundary
QRegExp rx("^\\d\\d?$"); // match integers 0 to 99
rx.indexIn("123"); // returns -1 (no match)
rx.indexIn("-6"); // returns -1 (no match)
-rx.indexIn("6"); // returns 0 (matched as position 0)
+rx.indexIn("6"); // returns 0 (matched at position 0)
//! [4]
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 391466448f..707e46dd40 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -45,11 +45,11 @@
#include <stddef.h>
-#define QT_VERSION_STR "5.3.0"
+#define QT_VERSION_STR "5.3.1"
/*
QT_VERSION is (major << 16) + (minor << 8) + patch.
*/
-#define QT_VERSION 0x050300
+#define QT_VERSION 0x050301
/*
can be used like #if (QT_VERSION >= QT_VERSION_CHECK(4, 4, 0))
*/
diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp
index da26490d18..4a602e4b2b 100644
--- a/src/corelib/global/qlogging.cpp
+++ b/src/corelib/global/qlogging.cpp
@@ -1207,6 +1207,23 @@ static void android_default_message_handler(QtMsgType type,
static void qDefaultMessageHandler(QtMsgType type, const QMessageLogContext &context,
const QString &buf)
{
+ // to determine logging destination and marking logging environment variable as deprecated
+ // ### remove when deprecated
+ struct LogDestination {
+ LogDestination(const char *deprecated, bool forceConsole) {
+ const char* replacement = "QT_LOGGING_TO_CONSOLE";
+ bool newEnv = qEnvironmentVariableIsSet(replacement);
+ bool oldEnv = qEnvironmentVariableIsSet(deprecated);
+ if (oldEnv && !newEnv && !forceConsole) {
+ fprintf(stderr, "Warning: Environment variable %s is deprecated, "
+ "use %s instead.\n", deprecated, replacement);
+ fflush(stderr);
+ }
+ toConsole = newEnv || oldEnv || forceConsole;
+ }
+ bool toConsole;
+ };
+
QString logMessage = qMessageFormatString(type, context, buf);
#if defined(Q_OS_WIN) && defined(QT_BUILD_CORE_LIB)
@@ -1217,12 +1234,19 @@ static void qDefaultMessageHandler(QtMsgType type, const QMessageLogContext &con
#endif // Q_OS_WIN
#if defined(QT_USE_SLOG2)
- slog2_default_handler(type, logMessage.toLocal8Bit().constData());
+ static const bool logToConsole = qEnvironmentVariableIsSet("QT_LOGGING_TO_CONSOLE");
+ if (!logToConsole) {
+ slog2_default_handler(type, logMessage.toLocal8Bit().constData());
+ } else {
+ fprintf(stderr, "%s", logMessage.toLocal8Bit().constData());
+ fflush(stderr);
+ }
#elif defined(QT_USE_JOURNALD) && !defined(QT_BOOTSTRAPPED)
// We use isatty to catch the obvious case of someone running something interactively.
- // We also support an environment variable for Qt Creator use, or more complicated cases like subprocesses.
- static bool logToConsole = isatty(fileno(stdin)) || !qEnvironmentVariableIsEmpty("QT_NO_JOURNALD_LOG");
- if (Q_LIKELY(!logToConsole)) {
+ // We also support environment variables for Qt Creator use, or more complicated cases
+ // like subprocesses.
+ static const LogDestination logdest("QT_NO_JOURNALD_LOG", isatty(fileno(stdin)));
+ if (Q_LIKELY(!logdest.toConsole)) {
// remove trailing \n, systemd appears to want them newline-less
logMessage.chop(1);
systemd_default_message_handler(type, context, logMessage);
@@ -1231,8 +1255,8 @@ static void qDefaultMessageHandler(QtMsgType type, const QMessageLogContext &con
fflush(stderr);
}
#elif defined(Q_OS_ANDROID)
- static bool logToAndroid = qEnvironmentVariableIsEmpty("QT_ANDROID_PLAIN_LOG");
- if (logToAndroid) {
+ static const LogDestination logdest("QT_ANDROID_PLAIN_LOG", false);
+ if (!logdest.toConsole) {
android_default_message_handler(type, context, logMessage);
} else {
fprintf(stderr, "%s", logMessage.toLocal8Bit().constData());
diff --git a/src/corelib/io/qfiledevice.cpp b/src/corelib/io/qfiledevice.cpp
index d2c8d37d4a..f7e58a7bed 100644
--- a/src/corelib/io/qfiledevice.cpp
+++ b/src/corelib/io/qfiledevice.cpp
@@ -139,10 +139,9 @@ void QFileDevicePrivate::setError(QFileDevice::FileError err, int errNum)
are returned and on Windows the rights of the current user are
returned. This behavior might change in a future Qt version.
- Note that Qt does not by default check for permissions on NTFS
- file systems, as this may decrease the performance of file
- handling considerably. It is possible to force permission checking
- on NTFS by including the following code in your source:
+ \note On NTFS file systems, ownership and permissions checking is
+ disabled by default for performance reasons. To enable it,
+ include the following line:
\snippet ntfsp.cpp 0
diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp
index 2cf97ef94e..60f7e47e62 100644
--- a/src/corelib/io/qfileinfo.cpp
+++ b/src/corelib/io/qfileinfo.cpp
@@ -271,6 +271,17 @@ QDateTime &QFileInfoPrivate::getFileTime(QAbstractFileEngine::FileTime request)
groupId(). You can examine a file's permissions and ownership in a
single statement using the permission() function.
+ \note On NTFS file systems, ownership and permissions checking is
+ disabled by default for performance reasons. To enable it,
+ include the following line:
+
+ \snippet ntfsp.cpp 0
+
+ Permission checking is then turned on and off by incrementing and
+ decrementing \c qt_ntfs_permission_lookup by 1.
+
+ \snippet ntfsp.cpp 1
+
\section1 Performance Issues
Some of QFileInfo's functions query the file system, but for
diff --git a/src/corelib/io/qfileselector.cpp b/src/corelib/io/qfileselector.cpp
index b4021c060f..0fa1f02f5c 100644
--- a/src/corelib/io/qfileselector.cpp
+++ b/src/corelib/io/qfileselector.cpp
@@ -365,6 +365,11 @@ QStringList QFileSelectorPrivate::platformSelectors()
ret << QStringLiteral("windows");
# if defined(Q_OS_WINCE)
ret << QStringLiteral("wince");
+# elif defined(Q_OS_WINRT)
+ ret << QStringLiteral("winrt");
+# if defined(Q_OS_WINPHONE)
+ ret << QStringLiteral("winphone");
+# endif
# endif
#elif defined(Q_OS_UNIX)
ret << QStringLiteral("unix");
diff --git a/src/corelib/io/qfilesystemengine.cpp b/src/corelib/io/qfilesystemengine.cpp
index 53cf6158ad..8b6ceebc62 100644
--- a/src/corelib/io/qfilesystemengine.cpp
+++ b/src/corelib/io/qfilesystemengine.cpp
@@ -224,7 +224,7 @@ bool QFileSystemEngine::fillMetaData(int fd, QFileSystemMetaData &data)
return false;
}
-#if defined(Q_OS_QNX)
+#if defined(QT_EXT_QNX_READDIR_R)
static void fillStat64fromStat32(struct stat64 *statBuf64, const struct stat &statBuf32)
{
statBuf64->st_mode = statBuf32.st_mode;
@@ -289,7 +289,7 @@ void QFileSystemMetaData::fillFromStatBuf(const QT_STATBUF &statBuffer)
void QFileSystemMetaData::fillFromDirEnt(const QT_DIRENT &entry)
{
-#if defined(Q_OS_QNX)
+#if defined(QT_EXT_QNX_READDIR_R)
knownFlagsMask = 0;
entryFlags = 0;
for (dirent_extra *extra = _DEXTRA_FIRST(&entry); _DEXTRA_VALID(extra, &entry);
diff --git a/src/corelib/io/qfilesystemiterator_p.h b/src/corelib/io/qfilesystemiterator_p.h
index 4164020359..18a9c2dbda 100644
--- a/src/corelib/io/qfilesystemiterator_p.h
+++ b/src/corelib/io/qfilesystemiterator_p.h
@@ -95,10 +95,10 @@ private:
#else
QT_DIR *dir;
QT_DIRENT *dirEntry;
-#if defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_CYGWIN)
+#if defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_CYGWIN) || defined(QT_EXT_QNX_READDIR_R)
// for readdir_r
QScopedPointer<QT_DIRENT, QScopedPointerPodDeleter> mt_file;
-#if defined(Q_OS_QNX) && defined(__EXT_QNX__READDIR_R)
+#if defined(QT_EXT_QNX_READDIR_R)
// for _readdir_r
size_t direntSize;
#endif
diff --git a/src/corelib/io/qfilesystemiterator_unix.cpp b/src/corelib/io/qfilesystemiterator_unix.cpp
index 0b59aa169a..0f9bbd8a29 100644
--- a/src/corelib/io/qfilesystemiterator_unix.cpp
+++ b/src/corelib/io/qfilesystemiterator_unix.cpp
@@ -70,7 +70,7 @@ QFileSystemIterator::QFileSystemIterator(const QFileSystemEntry &entry, QDir::Fi
if (!nativePath.endsWith('/'))
nativePath.append('/');
-#if defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_CYGWIN)
+#if defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_CYGWIN) || defined(QT_EXT_QNX_READDIR_R)
// ### Race condition; we should use fpathconf and dirfd().
size_t maxPathName = ::pathconf(nativePath.constData(), _PC_NAME_MAX);
if (maxPathName == size_t(-1))
@@ -81,13 +81,14 @@ QFileSystemIterator::QFileSystemIterator(const QFileSystemEntry &entry, QDir::Fi
Q_CHECK_PTR(p);
mt_file.reset(p);
-#if defined(Q_OS_QNX) && defined(__EXT_QNX__READDIR_R)
+#if defined(QT_EXT_QNX_READDIR_R)
direntSize = maxPathName;
- // Include extra stat information in the readdir() call (d_stat member of dirent_extra_stat).
- // This is used in QFileSystemMetaData::fillFromDirEnt() to avoid extra stat() calls when iterating
- // over directories
- if (dircntl(dir, D_SETFLAG, D_FLAG_STAT) == -1)
+ // Include extra stat information in the readdir() call (d_stat member of
+ // dirent_extra_stat). This is used in QFileSystemMetaData::fillFromDirEnt() to
+ // avoid extra stat() calls when iterating over directories
+ int flags = dircntl(dir, D_GETFLAG) | D_FLAG_STAT | D_FLAG_FILTER;
+ if (dircntl(dir, D_SETFLAG, flags) == -1)
lastError = errno;
#endif
#endif
@@ -105,7 +106,7 @@ bool QFileSystemIterator::advance(QFileSystemEntry &fileEntry, QFileSystemMetaDa
if (!dir)
return false;
-#if defined(Q_OS_QNX) && defined(QT_EXT_QNX_READDIR_R)
+#if defined(QT_EXT_QNX_READDIR_R)
lastError = QT_EXT_QNX_READDIR_R(dir, mt_file.data(), &dirEntry, direntSize);
if (lastError)
return false;
diff --git a/src/corelib/io/qfilesystemwatcher_polling.cpp b/src/corelib/io/qfilesystemwatcher_polling.cpp
index 689f05bb1b..401f95ae82 100644
--- a/src/corelib/io/qfilesystemwatcher_polling.cpp
+++ b/src/corelib/io/qfilesystemwatcher_polling.cpp
@@ -65,14 +65,16 @@ QStringList QPollingFileSystemWatcherEngine::addPaths(const QStringList &paths,
if (!fi.exists())
continue;
if (fi.isDir()) {
- if (!directories->contains(path))
- directories->append(path);
+ if (directories->contains(path))
+ continue;
+ directories->append(path);
if (!path.endsWith(QLatin1Char('/')))
fi = QFileInfo(path + QLatin1Char('/'));
this->directories.insert(path, fi);
} else {
- if (!files->contains(path))
- files->append(path);
+ if (files->contains(path))
+ continue;
+ files->append(path);
this->files.insert(path, fi);
}
it.remove();
diff --git a/src/corelib/io/qtemporarydir.cpp b/src/corelib/io/qtemporarydir.cpp
index 2c526847b4..1e615956d7 100644
--- a/src/corelib/io/qtemporarydir.cpp
+++ b/src/corelib/io/qtemporarydir.cpp
@@ -218,25 +218,25 @@ QTemporaryDir::QTemporaryDir()
}
/*!
- Constructs a QTemporaryFile with a template name of \a templateName.
+ Constructs a QTemporaryDir with a template of \a templatePath.
- If \a templateName is a relative path, the path will be relative to the
+ If \a templatePath is a relative path, the path will be relative to the
current working directory. You can use QDir::tempPath() to construct \a
- templateName if you want use the system's temporary directory.
+ templatePath if you want use the system's temporary directory.
- If the \a templateName ends with XXXXXX it will be used as the dynamic portion
+ If the \a templatePath ends with XXXXXX it will be used as the dynamic portion
of the directory name, otherwise it will be appended.
Unlike QTemporaryFile, XXXXXX in the middle of the template string is not supported.
\sa QDir::tempPath()
*/
-QTemporaryDir::QTemporaryDir(const QString &templateName)
+QTemporaryDir::QTemporaryDir(const QString &templatePath)
: d_ptr(new QTemporaryDirPrivate)
{
- if (templateName.isEmpty())
+ if (templatePath.isEmpty())
d_ptr->create(defaultTemplateName());
else
- d_ptr->create(templateName);
+ d_ptr->create(templatePath);
}
/*!
diff --git a/src/corelib/io/qtextstream.cpp b/src/corelib/io/qtextstream.cpp
index 163b087436..288a939ab2 100644
--- a/src/corelib/io/qtextstream.cpp
+++ b/src/corelib/io/qtextstream.cpp
@@ -569,7 +569,9 @@ void QTextStreamPrivate::flushWriteBuffer()
#endif
// convert from unicode to raw data
- QByteArray data = codec->fromUnicode(writeBuffer.data(), writeBuffer.size(), &writeConverterState);
+ // codec might be null if we're already inside global destructors (QTestCodec::codecForLocale returned null)
+ QByteArray data = Q_LIKELY(codec) ? codec->fromUnicode(writeBuffer.data(), writeBuffer.size(), &writeConverterState)
+ : writeBuffer.toLatin1();
#else
QByteArray data = writeBuffer.toLocal8Bit();
#endif
diff --git a/src/corelib/io/qwindowspipereader.cpp b/src/corelib/io/qwindowspipereader.cpp
index df65aebcff..7dd2125e70 100644
--- a/src/corelib/io/qwindowspipereader.cpp
+++ b/src/corelib/io/qwindowspipereader.cpp
@@ -318,6 +318,7 @@ bool QWindowsPipeReader::waitForPipeClosed(int msecs)
QElapsedTimer stopWatch;
stopWatch.start();
forever {
+ waitForReadyRead(0);
checkPipeState();
if (pipeBroken)
return true;
diff --git a/src/corelib/io/qwindowspipewriter.cpp b/src/corelib/io/qwindowspipewriter.cpp
index daa8068734..daad542705 100644
--- a/src/corelib/io/qwindowspipewriter.cpp
+++ b/src/corelib/io/qwindowspipewriter.cpp
@@ -40,7 +40,6 @@
****************************************************************************/
#include "qwindowspipewriter_p.h"
-#include <string.h>
QT_BEGIN_NAMESPACE
diff --git a/src/corelib/kernel/qcoreevent.h b/src/corelib/kernel/qcoreevent.h
index 3ee0eaaa61..8b58fdf55f 100644
--- a/src/corelib/kernel/qcoreevent.h
+++ b/src/corelib/kernel/qcoreevent.h
@@ -323,6 +323,7 @@ private:
friend class QGraphicsViewPrivate;
friend class QGraphicsScene;
friend class QGraphicsScenePrivate;
+ friend class QWidgetWindow;
#ifndef QT_NO_GESTURES
friend class QGestureManager;
#endif
diff --git a/src/corelib/kernel/qmath.cpp b/src/corelib/kernel/qmath.cpp
index b1860fa24a..9f276b4ca9 100644
--- a/src/corelib/kernel/qmath.cpp
+++ b/src/corelib/kernel/qmath.cpp
@@ -303,88 +303,4 @@ const qreal qt_sine_table[QT_SINE_TABLE_SIZE] = {
qreal(-0.024541228522912448)
};
-/*!
- \headerfile <QtMath>
- \title Generic Math Declarations
- \ingroup funclists
-
- \brief The <QtMath> header file includes generic math declarations.
-
- These functions are partly convenience definitions for basic
- operations, for instance not available in the Standard Template Library et
- al.
-*/
-
-/*!
- \fn float qDegreesToRadians(float degrees)
- \relates <QtMath>
- \since 5.1
-
- \brief The function converts the \a degrees in float to radians.
-
- The purpose of the function is to aid the conversion as such a convenient
- function is not part of the Standard Template Library, i.e. in <cmath> or
- elsewhere.
-
- Example:
-
- \snippet code/src_corelib_kernel_qmath.cpp 0
-
- \sa qRadiansToDegrees()
-*/
-
-/*!
- \fn double qDegreesToRadians(double degrees)
- \relates <QtMath>
- \since 5.1
-
- \brief The function converts the \a degrees in double to radians.
-
- The purpose of the function is to aid the conversion as such a convenient
- function is not part of the Standard Template Library, i.e. in <cmath> or
- elsewhere.
-
- Example:
-
- \snippet code/src_corelib_kernel_qmath.cpp 1
-
- \sa qRadiansToDegrees()
-*/
-
-/*!
- \fn float qRadiansToDegrees(float radians)
- \relates <QtMath>
- \since 5.1
-
- \brief The function converts the \a radians in float to degrees.
-
- The purpose of the function is to aid the conversion as such a convenient
- function is not part of the Standard Template Library, i.e. in <cmath> or
- elsewhere.
-
- Example:
-
- \snippet code/src_corelib_kernel_qmath.cpp 2
-
- \sa qDegreesToRadians()
-*/
-
-/*!
- \fn double qRadiansToDegrees(double radians)
- \relates <QtMath>
- \since 5.1
-
- \brief The function converts the \a radians in double to degrees.
-
- The purpose of the function is to aid the conversion as such a convenient
- function is not part of the Standard Template Library, i.e. in <cmath> or
- elsewhere.
-
- Example:
-
- \snippet code/src_corelib_kernel_qmath.cpp 3
-
- \sa qDegreesToRadians()
-*/
-
QT_END_NAMESPACE
diff --git a/src/corelib/kernel/qmath.qdoc b/src/corelib/kernel/qmath.qdoc
index 06d8db9277..04dbbb0a3b 100644
--- a/src/corelib/kernel/qmath.qdoc
+++ b/src/corelib/kernel/qmath.qdoc
@@ -26,10 +26,15 @@
****************************************************************************/
/*!
- \headerfile <QtCore/qmath.h>
- \title Math Functions
+ \headerfile <QtMath>
+ \title Generic Math Functions
\ingroup funclists
- \brief The <QtCore/qmath.h> header provides various math functions.
+
+ \brief The <QtMath> header file provides various math functions.
+
+ These functions are partly convenience definitions for basic math operations
+ not available in the C or Standard Template Libraries.
+
\pagekeywords math trigonometry qmath floor ceiling absolute sine cosine tangent inverse tan exponent power natural logarithm
*/
@@ -40,7 +45,7 @@
The ceiling is the smallest integer that is not less than \a v.
For example, if \a v is 41.2, then the ceiling is 42.
- \relates <QtCore/qmath.h>
+ \relates <QtMath>
\sa qFloor()
*/
@@ -51,7 +56,7 @@
The floor is the largest integer that is not greater than \a v.
For example, if \a v is 41.2, then the floor is 41.
- \relates <QtCore/qmath.h>
+ \relates <QtMath>
\sa qCeil()
*/
@@ -59,14 +64,14 @@
\fn qreal qFabs(qreal v)
Returns the absolute value of \a v as a qreal.
- \relates <QtCore/qmath.h>
+ \relates <QtMath>
*/
/*!
\fn qreal qSin(qreal v)
Returns the sine of the angle \a v in radians.
- \relates <QtCore/qmath.h>
+ \relates <QtMath>
\sa qCos(), qTan()
*/
@@ -74,7 +79,7 @@
\fn qreal qCos(qreal v)
Returns the cosine of an angle \a v in radians.
- \relates <QtCore/qmath.h>
+ \relates <QtMath>
\sa qSin(), qTan()
*/
@@ -82,7 +87,7 @@
\fn qreal qTan(qreal v)
Returns the tangent of an angle \a v in radians.
- \relates <QtCore/qmath.h>
+ \relates <QtMath>
\sa qSin(), qCos()
*/
@@ -91,7 +96,7 @@
Returns the arccosine of \a v as an angle in radians.
Arccosine is the inverse operation of cosine.
- \relates <QtCore/qmath.h>
+ \relates <QtMath>
\sa qAtan(), qAsin(), qCos()
*/
@@ -100,7 +105,7 @@
Returns the arcsine of \a v as an angle in radians.
Arcsine is the inverse operation of sine.
- \relates <QtCore/qmath.h>
+ \relates <QtMath>
\sa qSin(), qAtan(), qAcos()
*/
@@ -109,7 +114,7 @@
Returns the arctangent of \a v as an angle in radians.
Arctangent is the inverse operation of tangent.
- \relates <QtCore/qmath.h>
+ \relates <QtMath>
\sa qTan(), qAcos(), qAsin()
*/
@@ -118,7 +123,7 @@
Returns the arctangent of a point specified by the coordinates \a y and \a x.
This function will return the angle (argument) of that point.
- \relates <QtCore/qmath.h>
+ \relates <QtMath>
\sa qAtan()
*/
@@ -127,7 +132,7 @@
Returns the square root of \a v.
This function returns a NaN if \a v is a negative number.
- \relates <QtCore/qmath.h>
+ \relates <QtMath>
\sa qPow()
*/
@@ -135,7 +140,7 @@
\fn qreal qLn(qreal v)
Returns the natural logarithm of \a v. Natural logarithm uses base e.
- \relates <QtCore/qmath.h>
+ \relates <QtMath>
\sa qExp()
*/
@@ -143,7 +148,7 @@
\fn qreal qExp(qreal v)
Returns the exponential function of \c e to the power of \a v.
- \relates <QtCore/qmath.h>
+ \relates <QtMath>
\sa qLn()
*/
@@ -152,6 +157,62 @@
Returns the value of \a x raised to the power of \a y.
That is, \a x is the base and \a y is the exponent.
- \relates <QtCore/qmath.h>
+ \relates <QtMath>
\sa qSqrt()
*/
+
+/*!
+ \fn float qDegreesToRadians(float degrees)
+ \relates <QtMath>
+ \since 5.1
+
+ This function converts the \a degrees in float to radians.
+
+ Example:
+
+ \snippet code/src_corelib_kernel_qmath.cpp 0
+
+ \sa qRadiansToDegrees()
+*/
+
+/*!
+ \fn double qDegreesToRadians(double degrees)
+ \relates <QtMath>
+ \since 5.1
+
+ This function converts the \a degrees in double to radians.
+
+ Example:
+
+ \snippet code/src_corelib_kernel_qmath.cpp 1
+
+ \sa qRadiansToDegrees()
+*/
+
+/*!
+ \fn float qRadiansToDegrees(float radians)
+ \relates <QtMath>
+ \since 5.1
+
+ This function converts the \a radians in float to degrees.
+
+ Example:
+
+ \snippet code/src_corelib_kernel_qmath.cpp 2
+
+ \sa qDegreesToRadians()
+*/
+
+/*!
+ \fn double qRadiansToDegrees(double radians)
+ \relates <QtMath>
+ \since 5.1
+
+ This function converts the \a radians in double to degrees.
+
+ Example:
+
+ \snippet code/src_corelib_kernel_qmath.cpp 3
+
+ \sa qDegreesToRadians()
+*/
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index 0a504657a3..0e9cbfe1c9 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -4436,6 +4436,8 @@ void qDeleteInEventHandler(QObject *o)
\snippet code/src_corelib_kernel_qobject.cpp 46
The connection will automatically disconnect if the sender is destroyed.
+ However, you should take care that any objects used within the functor
+ are still alive when the signal is emitted.
\note If the compiler does not support C++11 variadic templates, the number
of arguments in the signal or slot are limited to 6, and the functor object
@@ -4473,6 +4475,8 @@ void qDeleteInEventHandler(QObject *o)
The connection will automatically disconnect if the sender or the context
is destroyed.
+ However, you should take care that any objects used within the functor
+ are still alive when the signal is emitted.
\note If the compiler does not support C++11 variadic templates, the number
of arguments in the signal or slot are limited to 6, and the functor object
diff --git a/src/corelib/kernel/qsharedmemory.cpp b/src/corelib/kernel/qsharedmemory.cpp
index 407a6a4e02..cde42c4f6e 100644
--- a/src/corelib/kernel/qsharedmemory.cpp
+++ b/src/corelib/kernel/qsharedmemory.cpp
@@ -125,11 +125,9 @@ QSharedMemoryPrivate::makePlatformSafeKey(const QString &key,
or writing to the shared memory, and remember to release the lock
with unlock() after you are done.
- Unlike QtSharedMemory, QSharedMemory automatically destroys the
- shared memory segment when the last instance of QSharedMemory is
- detached from the segment, and no references to the segment
- remain. Do not mix using QtSharedMemory and QSharedMemory. Port
- everything to QSharedMemory.
+ QSharedMemory automatically destroys the shared memory segment when
+ the last instance of QSharedMemory is detached from the segment, and
+ no references to the segment remain.
\warning QSharedMemory changes the key in a Qt-specific way, unless otherwise
specified. Interoperation with non-Qt applications is achieved by first creating
diff --git a/src/corelib/tools/qcollator.cpp b/src/corelib/tools/qcollator.cpp
index 9c97d6b158..f7dfaa7d33 100644
--- a/src/corelib/tools/qcollator.cpp
+++ b/src/corelib/tools/qcollator.cpp
@@ -205,6 +205,11 @@ QLocale QCollator::locale() const
By default this mode is off.
+ \note On Windows, this functionality makes use of the \l{ICU} library. If Qt was
+ compiled without ICU support, it falls back to code using native Windows API,
+ which only works from Windows 7 onwards. On older versions of Windows, it will not work
+ and a warning will be emitted at runtime.
+
\sa numericMode()
*/
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp
index e38a5f569a..801876629c 100644
--- a/src/corelib/tools/qdatetime.cpp
+++ b/src/corelib/tools/qdatetime.cpp
@@ -253,7 +253,7 @@ static QString toOffsetString(Qt::DateFormat format, int offset)
return result.arg(offset >= 0 ? QLatin1Char('+') : QLatin1Char('-'))
.arg(qAbs(offset) / SECS_PER_HOUR, 2, 10, QLatin1Char('0'))
- .arg((offset / 60) % 60, 2, 10, QLatin1Char('0'));
+ .arg((qAbs(offset) / 60) % 60, 2, 10, QLatin1Char('0'));
}
// Parse offset in [+-]HH[:]MM format
@@ -265,17 +265,24 @@ static int fromOffsetString(const QString &offsetString, bool *valid)
if (size < 2 || size > 6)
return 0;
+ // sign will be +1 for a positive and -1 for a negative offset
+ int sign;
+
// First char must be + or -
- const QChar sign = offsetString.at(0);
- if (sign != QLatin1Char('+') && sign != QLatin1Char('-'))
+ const QChar signChar = offsetString.at(0);
+ if (signChar == QLatin1Char('+'))
+ sign = 1;
+ else if (signChar == QLatin1Char('-'))
+ sign = -1;
+ else
return 0;
// Split the hour and minute parts
- QStringList parts = offsetString.split(QLatin1Char(':'));
+ QStringList parts = offsetString.mid(1).split(QLatin1Char(':'));
if (parts.count() == 1) {
// [+-]HHMM format
- parts.append(parts.at(0).mid(3));
- parts[0] = parts.at(0).left(3);
+ parts.append(parts.at(0).mid(2));
+ parts[0] = parts.at(0).left(2);
}
bool ok = false;
@@ -288,7 +295,7 @@ static int fromOffsetString(const QString &offsetString, bool *valid)
return 0;
*valid = true;
- return ((hour * 60) + minute) * 60;
+ return sign * ((hour * 60) + minute) * 60;
}
/*****************************************************************************
diff --git a/src/corelib/tools/qregexp.cpp b/src/corelib/tools/qregexp.cpp
index cadf2da019..fbcd271f1d 100644
--- a/src/corelib/tools/qregexp.cpp
+++ b/src/corelib/tools/qregexp.cpp
@@ -388,7 +388,7 @@ int qFindString(const QChar *haystack, int haystackLen, int from,
Note: Quantifiers are normally "greedy". They always match as much
text as they can. For example, \b{0+} matches the first zero it
finds and all the consecutive zeros after the first zero. Applied
- to '20005', it matches'2\underline{000}5'. Quantifiers can be made
+ to '20005', it matches '2\underline{000}5'. Quantifiers can be made
non-greedy, see setMinimal().
\target capturing parentheses
@@ -678,7 +678,7 @@ int qFindString(const QChar *haystack, int haystackLen, int from,
QRegExp can match case insensitively using setCaseSensitivity(),
and can use non-greedy matching, see setMinimal(). By
default QRegExp uses full regexps but this can be changed with
- setWildcard(). Searching can be forward with indexIn() or backward
+ setPatternSyntax(). Searching can be done forward with indexIn() or backward
with lastIndexIn(). Captured text can be accessed using
capturedTexts() which returns a string list of all captured
strings, or using cap() which returns the captured string for the
diff --git a/src/corelib/tools/qsize.cpp b/src/corelib/tools/qsize.cpp
index b53eced298..c9a6ffa03a 100644
--- a/src/corelib/tools/qsize.cpp
+++ b/src/corelib/tools/qsize.cpp
@@ -61,7 +61,7 @@ QT_BEGIN_NAMESPACE
width and height can be swapped using the transpose() function.
The isValid() function determines if a size is valid (a valid size
- has both width and height greater than zero). The isEmpty()
+ has both width and height greater than or equal to zero). The isEmpty()
function returns \c true if either of the width and height is less
than, or equal to, zero, while the isNull() function returns \c true
only if both the width and the height is zero.
diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri
index 863cf03439..57a9591060 100644
--- a/src/corelib/tools/tools.pri
+++ b/src/corelib/tools/tools.pri
@@ -163,10 +163,10 @@ contains(QT_CONFIG,icu) {
LIBS_PRIVATE += -lsicuin -lsicuuc -lsicudt
}
} else {
- LIBS_PRIVATE += -licuin -licuuc
+ LIBS_PRIVATE += -licuin -licuuc -licudt
}
} else {
- LIBS_PRIVATE += -licui18n -licuuc
+ LIBS_PRIVATE += -licui18n -licuuc -licudata
}
} else: win32 {
SOURCES += tools/qcollator_win.cpp