summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2012-04-10 12:48:01 +0200
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2012-04-10 15:31:45 +0200
commit143c4d3e13a430b951f4f4f8c28db14303f80605 (patch)
tree2b89637b93fc7d81c674106008566010f986d67c /src/corelib
parenta7ed81b557d593a8ddb43b71bf4bbf3b44ead070 (diff)
parente5337ad1b1fb02873ce7b5ca8db45f6fd8063352 (diff)
Merge remote-tracking branch 'origin/master' into api_changes
Conflicts: configure src/widgets/styles/qwindowsxpstyle.cpp tests/auto/gui/kernel/qwindow/qwindow.pro tests/auto/gui/kernel/qwindow/tst_qwindow.cpp Change-Id: I624b6d26abce9874c610c04954c1c45bc074bef3
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/Qt5CoreConfigExtras.cmake.in11
-rw-r--r--src/corelib/codecs/codecs.pri2
-rw-r--r--src/corelib/global/qcompilerdetection.h6
-rw-r--r--src/corelib/global/qglobal.cpp199
-rw-r--r--src/corelib/global/qlogging.cpp227
-rw-r--r--src/corelib/global/qlogging.h14
-rw-r--r--src/corelib/global/qsystemdetection.h5
-rw-r--r--src/corelib/io/qdir.cpp9
-rw-r--r--src/corelib/io/qfile.cpp5
-rw-r--r--src/corelib/io/qfilesystemengine_unix.cpp7
-rw-r--r--src/corelib/io/qtemporarydir.cpp4
-rw-r--r--src/corelib/json/qjson_p.h2
-rw-r--r--src/corelib/json/qjsonarray.cpp4
-rw-r--r--src/corelib/json/qjsondocument.cpp13
-rw-r--r--src/corelib/json/qjsondocument.h10
-rw-r--r--src/corelib/json/qjsonobject.cpp6
-rw-r--r--src/corelib/json/qjsonparser.cpp93
-rw-r--r--src/corelib/kernel/qabstracteventdispatcher.cpp31
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp13
-rw-r--r--src/corelib/kernel/qcoreapplication_win.cpp2
-rw-r--r--src/corelib/kernel/qobjectdefs.h9
-rw-r--r--src/corelib/kernel/qvariant.cpp1
-rw-r--r--src/corelib/kernel/qvariant_p.h1
-rw-r--r--src/corelib/kernel/qwineventnotifier.cpp1
-rw-r--r--src/corelib/mimetypes/qmimedatabase.cpp1
-rw-r--r--src/corelib/mimetypes/qmimedatabase.h4
-rw-r--r--src/corelib/mimetypes/qmimedatabase_p.h1
-rw-r--r--src/corelib/mimetypes/qmimemagicrule.cpp2
-rw-r--r--src/corelib/mimetypes/qmimemagicrule_p.h1
-rw-r--r--src/corelib/mimetypes/qmimemagicrulematcher.cpp1
-rw-r--r--src/corelib/mimetypes/qmimemagicrulematcher_p.h1
-rw-r--r--src/corelib/mimetypes/qmimetype.cpp1
-rw-r--r--src/corelib/mimetypes/qmimetype.h1
-rw-r--r--src/corelib/mimetypes/qmimetype_p.h1
-rw-r--r--src/corelib/mimetypes/qmimetypeparser.cpp3
-rw-r--r--src/corelib/plugin/qfactoryloader.cpp3
-rw-r--r--src/corelib/plugin/quuid.h16
-rw-r--r--src/corelib/thread/qthread_unix.cpp7
-rw-r--r--src/corelib/thread/qthread_win.cpp1
-rw-r--r--src/corelib/thread/qwaitcondition.h4
-rw-r--r--src/corelib/thread/qwaitcondition.qdoc28
-rw-r--r--src/corelib/tools/qbitarray.h1
-rw-r--r--src/corelib/tools/qelapsedtimer_generic.cpp6
-rw-r--r--src/corelib/tools/qregularexpression.cpp24
-rw-r--r--src/corelib/tools/qset.qdoc10
-rw-r--r--src/corelib/tools/qstring.cpp2
46 files changed, 476 insertions, 318 deletions
diff --git a/src/corelib/Qt5CoreConfigExtras.cmake.in b/src/corelib/Qt5CoreConfigExtras.cmake.in
index 5acc13c6f3..aa31fbc226 100644
--- a/src/corelib/Qt5CoreConfigExtras.cmake.in
+++ b/src/corelib/Qt5CoreConfigExtras.cmake.in
@@ -30,9 +30,6 @@ list(APPEND Qt5Core_COMPILE_DEFINITIONS QT_NAMESPACE=$$QT_NAMESPACE)
set(QT_LIBINFIX \"$${QT_LIBINFIX}\")
!!ENDIF
-set(QT_CONFIG \"$${CONFIG}\")
-set(QT_QCONFIG \"$${QT_CONFIG}\")
-
!!IF !isEmpty(CMAKE_WINDOWS_BUILD)
set(Qt5Core_QTMAIN_LIBRARIES Qt5::WinMain)
@@ -41,22 +38,22 @@ if (NOT _Qt5WinMain_target)
add_library(Qt5::WinMain STATIC IMPORTED)
endif()
-!!IF !isEmpty(debug_type)
+!!IF !isEmpty(CMAKE_DEBUG_TYPE)
set_property(TARGET Qt5::WinMain APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
set_target_properties(Qt5::WinMain PROPERTIES
!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
- IMPORTED_LOCATION_DEBUG "${_qt5_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_DEBUG}"
+ IMPORTED_LOCATION_DEBUG "${_qt5_corelib_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_DEBUG}"
!!ELSE
IMPORTED_LOCATION_DEBUG "$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_DEBUG}"
!!ENDIF
)
!!ENDIF
-!!IF !isEmpty(release_type)
+!!IF !isEmpty(CMAKE_RELEASE_TYPE)
set_property(TARGET Qt5::WinMain APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Qt5::WinMain PROPERTIES
!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
- IMPORTED_LOCATION_RELEASE \"${_qt5_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_RELEASE}\"
+ IMPORTED_LOCATION_RELEASE \"${_qt5_corelib_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_RELEASE}\"
!!ELSE
IMPORTED_LOCATION_RELEASE \"$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_RELEASE}\"
!!ENDIF
diff --git a/src/corelib/codecs/codecs.pri b/src/corelib/codecs/codecs.pri
index a6f8914516..a8a78cec06 100644
--- a/src/corelib/codecs/codecs.pri
+++ b/src/corelib/codecs/codecs.pri
@@ -38,7 +38,7 @@ unix {
contains(QT_CONFIG,iconv) {
HEADERS += codecs/qiconvcodec_p.h
SOURCES += codecs/qiconvcodec.cpp
- qnx-*-qcc:LIBS_PRIVATE *= -liconv
+ qnx:LIBS_PRIVATE *= -liconv
} else:contains(QT_CONFIG,gnu-libiconv) {
HEADERS += codecs/qiconvcodec_p.h
SOURCES += codecs/qiconvcodec.cpp
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h
index ef3d2816cc..315f53cbb4 100644
--- a/src/corelib/global/qcompilerdetection.h
+++ b/src/corelib/global/qcompilerdetection.h
@@ -90,6 +90,7 @@
# define Q_DECL_ALIGN(n) __declspec(align(n))
# define Q_ASSUME(expr) __assume(expr)
# define Q_UNREACHABLE() __assume(0)
+# define Q_NORETURN __declspec(noreturn)
/* Intel C++ disguising as Visual C++: the `using' keyword avoids warnings */
# if defined(__INTEL_COMPILER)
# define Q_CC_INTEL
@@ -165,6 +166,7 @@
# define Q_DECL_ALIGN(n) __attribute__((__aligned__(n)))
# define Q_LIKELY(expr) __builtin_expect(!!(expr), true)
# define Q_UNLIKELY(expr) __builtin_expect(!!(expr), false)
+# define Q_NORETURN __attribute__((__noreturn__))
# if !defined(QT_MOC_CPP)
# define Q_PACKED __attribute__ ((__packed__))
# define Q_NO_PACKED_REFERENCE
@@ -399,6 +401,10 @@
# error "Qt has not been tested with this compiler - see http://www.qt-project.org/"
#endif
+#ifndef Q_NORETURN
+# define Q_NORETURN
+#endif
+
/*
* C++11 support
*
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index f89b0b3421..8125161897 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -2886,4 +2886,203 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters)
otherwise.
*/
+/*!
+ \macro qDebug(const char *message, ...)
+ \relates <QtGlobal>
+
+ Calls the message handler with the debug message \a message. If no
+ message handler has been installed, the message is printed to
+ stderr. Under Windows, the message is sent to the console, if it is a
+ console application; otherwise, it is sent to the debugger. This
+ function does nothing if \c QT_NO_DEBUG_OUTPUT was defined
+ during compilation.
+
+
+ If you pass the function a format string and a list of arguments,
+ it works in similar way to the C printf() function. The format
+ should be a Latin-1 string.
+
+ Example:
+
+ \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 24
+
+ If you include \c <QtDebug>, a more convenient syntax is also
+ available:
+
+ \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 25
+
+ With this syntax, the function returns a QDebug object that is
+ configured to use the QtDebugMsg message type. It automatically
+ puts a single space between each item, and outputs a newline at
+ the end. It supports many C++ and Qt types.
+
+ To suppress the output at run-time, install your own message handler
+ with qInstallMessageHandler().
+
+ \sa qWarning(), qCritical(), qFatal(), qInstallMessageHandler(),
+ {Debugging Techniques}
+*/
+
+/*!
+ \macro qWarning(const char *message, ...)
+ \relates <QtGlobal>
+
+ Calls the message handler with the warning message \a message. If no
+ message handler has been installed, the message is printed to
+ stderr. Under Windows, the message is sent to the debugger. This
+ function does nothing if \c QT_NO_WARNING_OUTPUT was defined
+ during compilation; it exits if the environment variable \c
+ QT_FATAL_WARNINGS is defined.
+
+ This function takes a format string and a list of arguments,
+ similar to the C printf() function. The format should be a Latin-1
+ string.
+
+ Example:
+ \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 26
+
+ If you include <QtDebug>, a more convenient syntax is
+ also available:
+
+ \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 27
+
+ This syntax inserts a space between each item, and
+ appends a newline at the end.
+
+ To suppress the output at runtime, install your own message handler
+ with qInstallMessageHandler().
+
+ \sa qDebug(), qCritical(), qFatal(), qInstallMessageHandler(),
+ {Debugging Techniques}
+*/
+
+/*!
+ \macro qCritical(const char *message, ...)
+ \relates <QtGlobal>
+
+ Calls the message handler with the critical message \a message. If no
+ message handler has been installed, the message is printed to
+ stderr. Under Windows, the message is sent to the debugger.
+
+ This function takes a format string and a list of arguments,
+ similar to the C printf() function. The format should be a Latin-1
+ string.
+
+ Example:
+ \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 28
+
+ If you include <QtDebug>, a more convenient syntax is
+ also available:
+
+ \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 29
+
+ A space is inserted between the items, and a newline is
+ appended at the end.
+
+ To suppress the output at runtime, install your own message handler
+ with qInstallMessageHandler().
+
+ \sa qDebug(), qWarning(), qFatal(), qInstallMessageHandler(),
+ {Debugging Techniques}
+*/
+
+/*!
+ \macro qFatal(const char *message, ...)
+ \relates <QtGlobal>
+
+ Calls the message handler with the fatal message \a message. If no
+ message handler has been installed, the message is printed to
+ stderr. Under Windows, the message is sent to the debugger.
+
+ If you are using the \b{default message handler} this function will
+ abort on Unix systems to create a core dump. On Windows, for debug builds,
+ this function will report a _CRT_ERROR enabling you to connect a debugger
+ to the application.
+
+ This function takes a format string and a list of arguments,
+ similar to the C printf() function.
+
+ Example:
+ \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 30
+
+ To suppress the output at runtime, install your own message handler
+ with qInstallMessageHandler().
+
+ \sa qDebug(), qCritical(), qWarning(), qInstallMessageHandler(),
+ {Debugging Techniques}
+*/
+
+/*!
+ \typedef QtMsgHandler
+ \relates <QtGlobal>
+ \deprecated
+
+ This is a typedef for a pointer to a function with the following
+ signature:
+
+ \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 7
+
+ This typedef is deprecated, you should use QMessageHandler instead.
+ \sa QtMsgType, QMessageHandler, qInstallMsgHandler(), qInstallMessageHandler()
+*/
+
+/*!
+ \typedef QMessageHandler
+ \relates <QtGlobal>
+ \since 5.0
+
+ This is a typedef for a pointer to a function with the following
+ signature:
+
+ \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 49
+
+ \sa QtMsgType, qInstallMessageHandler()
+*/
+
+/*!
+ \fn QMessageHandler qInstallMessageHandler(QMessageHandler handler)
+ \relates <QtGlobal>
+ \since 5.0
+
+ Installs a Qt message \a handler which has been defined
+ previously. Returns a pointer to the previous message handler
+ (which may be 0).
+
+ The message handler is a function that prints out debug messages,
+ warnings, critical and fatal error messages. The Qt library (debug
+ mode) contains hundreds of warning messages that are printed
+ when internal errors (usually invalid function arguments)
+ occur. Qt built in release mode also contains such warnings unless
+ QT_NO_WARNING_OUTPUT and/or QT_NO_DEBUG_OUTPUT have been set during
+ compilation. If you implement your own message handler, you get total
+ control of these messages.
+
+ The default message handler prints the message to the standard
+ output under X11 or to the debugger under Windows. If it is a
+ fatal message, the application aborts immediately.
+
+ Only one message handler can be defined, since this is usually
+ done on an application-wide basis to control debug output.
+
+ To restore the message handler, call \c qInstallMessageHandler(0).
+
+ Example:
+
+ \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 23
+
+ \sa QMessageHandler, QtMsgType, qDebug(), qWarning(), qCritical(), qFatal(),
+ {Debugging Techniques}
+*/
+
+/*!
+ \fn QtMsgHandler qInstallMsgHandler(QtMsgHandler handler)
+ \relates <QtGlobal>
+ \deprecated
+
+ Installs a Qt message \a handler which has been defined
+ previously. This method is deprecated, use qInstallMessageHandler
+ instead.
+ \sa QtMsgHandler, qInstallMessageHandler
+*/
+
QT_END_NAMESPACE
diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp
index fedc5eb9ec..afefb11aa1 100644
--- a/src/corelib/global/qlogging.cpp
+++ b/src/corelib/global/qlogging.cpp
@@ -75,14 +75,14 @@ QT_BEGIN_NAMESPACE
\brief The QMessageLogger class generates log messages.
\since 5.0
- QMessageLogger is used to generate messages for the Qt logging framework. Most of the time
- is transparently used through the qDebug(), qWarning(), qCritical, or qFatal() functions,
+ QMessageLogger is used to generate messages for the Qt logging framework. Usually one uses
+ it through qDebug(), qWarning(), qCritical, or qFatal() functions,
which are actually macros that expand to QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO).debug()
et al.
One example of direct use is to forward errors that stem from a scripting language, e.g. QML:
- \snippet doc/src/snippets/code/qlogging/qlogging.cpp 1
+ \snippet doc/src/snippets/code/qlogging/qloggingsnippet.cpp 1
\sa QMessageLogContext, qDebug(), qWarning(), qCritical(), qFatal()
*/
@@ -132,41 +132,6 @@ static void qt_message(QtMsgType msgType, const QMessageLogContext &context, con
}
#undef qDebug
-/*!
- \fn qDebug(const char *message, ...)
- \relates <QtGlobal>
-
- Calls the message handler with the debug message \a msg. If no
- message handler has been installed, the message is printed to
- stderr. Under Windows, the message is sent to the console, if it is a
- console application; otherwise, it is sent to the debugger. This
- function does nothing if \c QT_NO_DEBUG_OUTPUT was defined
- during compilation.
-
- If you pass the function a format string and a list of arguments,
- it works in similar way to the C printf() function. The format
- should be a Latin-1 string.
-
- Example:
-
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 24
-
- If you include \c <QtDebug>, a more convenient syntax is also
- available:
-
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 25
-
- With this syntax, the function returns a QDebug object that is
- configured to use the QtDebugMsg message type. It automatically
- puts a single space between each item, and outputs a newline at
- the end. It supports many C++ and Qt types.
-
- To suppress the output at run-time, install your own message handler
- with qInstallMessageHandler().
-
- \sa qWarning(), qCritical(), qFatal(), qInstallMessageHandler(),
- {Debugging Techniques}
-*/
void QMessageLogger::debug(const char *msg, ...)
{
@@ -182,9 +147,7 @@ QDebug QMessageLogger::debug()
{
QDebug dbg = QDebug(QtDebugMsg);
QMessageLogContext &ctxt = dbg.stream->context;
- ctxt.file = context.file;
- ctxt.line = context.line;
- ctxt.function = context.function;
+ ctxt.copy(context);
return dbg;
}
@@ -196,39 +159,6 @@ QNoDebug QMessageLogger::noDebug()
#endif
#undef qWarning
-/*!
- \fn qWarning(const char *message, ...)
- \relates <QtGlobal>
-
- Calls the message handler with the warning message \a msg. If no
- message handler has been installed, the message is printed to
- stderr. Under Windows, the message is sent to the debugger. This
- function does nothing if \c QT_NO_WARNING_OUTPUT was defined
- during compilation; it exits if the environment variable \c
- QT_FATAL_WARNINGS is defined.
-
- This function takes a format string and a list of arguments,
- similar to the C printf() function. The format should be a Latin-1
- string.
-
- Example:
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 26
-
- If you include <QtDebug>, a more convenient syntax is
- also available:
-
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 27
-
- This syntax inserts a space between each item, and
- appends a newline at the end.
-
- To suppress the output at runtime, install your own message handler
- with qInstallMessageHandler().
-
- \sa qDebug(), qCritical(), qFatal(), qInstallMessageHandler(),
- {Debugging Techniques}
-*/
-
void QMessageLogger::warning(const char *msg, ...)
{
va_list ap;
@@ -242,43 +172,12 @@ QDebug QMessageLogger::warning()
{
QDebug dbg = QDebug(QtWarningMsg);
QMessageLogContext &ctxt = dbg.stream->context;
- ctxt.file = context.file;
- ctxt.line = context.line;
- ctxt.function = context.function;
+ ctxt.copy(context);
return dbg;
}
#endif
#undef qCritical
-/*!
- \fn qCritical(const char *message, ...)
- \relates <QtGlobal>
-
- Calls the message handler with the critical message \a msg. If no
- message handler has been installed, the message is printed to
- stderr. Under Windows, the message is sent to the debugger.
-
- This function takes a format string and a list of arguments,
- similar to the C printf() function. The format should be a Latin-1
- string.
-
- Example:
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 28
-
- If you include <QtDebug>, a more convenient syntax is
- also available:
-
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 29
-
- A space is inserted between the items, and a newline is
- appended at the end.
-
- To suppress the output at runtime, install your own message handler
- with qInstallMessageHandler().
-
- \sa qDebug(), qWarning(), qFatal(), qInstallMessageHandler(),
- {Debugging Techniques}
-*/
void QMessageLogger::critical(const char *msg, ...)
{
@@ -293,39 +192,12 @@ QDebug QMessageLogger::critical()
{
QDebug dbg = QDebug(QtCriticalMsg);
QMessageLogContext &ctxt = dbg.stream->context;
- ctxt.file = context.file;
- ctxt.line = context.line;
- ctxt.function = context.function;
+ ctxt.copy(context);
return dbg;
}
#endif
#undef qFatal
-/*!
- \fn qFatal(const char *message, ...)
- \relates <QtGlobal>
-
- Calls the message handler with the fatal message \a msg. If no
- message handler has been installed, the message is printed to
- stderr. Under Windows, the message is sent to the debugger.
-
- If you are using the \b{default message handler} this function will
- abort on Unix systems to create a core dump. On Windows, for debug builds,
- this function will report a _CRT_ERROR enabling you to connect a debugger
- to the application.
-
- This function takes a format string and a list of arguments,
- similar to the C printf() function.
-
- Example:
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 30
-
- To suppress the output at runtime, install your own message handler
- with qInstallMessageHandler().
-
- \sa qDebug(), qCritical(), qWarning(), qInstallMessageHandler(),
- {Debugging Techniques}
-*/
void QMessageLogger::fatal(const char *msg, ...)
{
@@ -491,6 +363,7 @@ Q_AUTOTEST_EXPORT QByteArray qCleanupFuncinfo(QByteArray info)
}
// tokens as recognized in QT_MESSAGE_PATTERN
+static const char categoryTokenC[] = "%{category}";
static const char typeTokenC[] = "%{type}";
static const char messageTokenC[] = "%{message}";
static const char fileTokenC[] = "%{file}";
@@ -560,7 +433,9 @@ QMessagePattern::QMessagePattern()
// placeholder
if (lexeme == QLatin1String(typeTokenC)) {
tokens[i] = typeTokenC;
- } else if (lexeme == QLatin1String(messageTokenC))
+ } else if (lexeme == QLatin1String(categoryTokenC))
+ tokens[i] = categoryTokenC;
+ else if (lexeme == QLatin1String(messageTokenC))
tokens[i] = messageTokenC;
else if (lexeme == QLatin1String(fileTokenC))
tokens[i] = fileTokenC;
@@ -627,6 +502,8 @@ Q_CORE_EXPORT QByteArray qMessageFormatString(QtMsgType type, const QMessageLogC
const char *token = pattern->tokens[i];
if (token == messageTokenC) {
message.append(str);
+ } else if (token == categoryTokenC) {
+ message.append(context.category);
} else if (token == typeTokenC) {
switch (type) {
case QtDebugMsg: message.append("debug"); break;
@@ -775,68 +652,6 @@ extern Q_CORE_EXPORT void qWinMessageHandler(QtMsgType t, const QMessageLogConte
const char *str);
#endif
-/*!
- \typedef QtMsgHandler
- \relates <QtGlobal>
- \deprecated
-
- This is a typedef for a pointer to a function with the following
- signature:
-
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 7
-
- This typedef is deprecated, you should use QMessageHandler instead.
- \sa QtMsgType, QMessageHandler, qInstallMsgHandler(), qInstallMessageHandler()
-*/
-
-/*!
- \typedef QMessageHandler
- \relates <QtGlobal>
- \since 5.0
-
- This is a typedef for a pointer to a function with the following
- signature:
-
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 49
-
- \sa QtMsgType, qInstallMessageHandler()
-*/
-
-/*!
- \fn QMessageHandler qInstallMessageHandler(QMessageHandler handler)
- \relates <QtGlobal>
- \since 5.0
-
- Installs a Qt message \a handler which has been defined
- previously. Returns a pointer to the previous message handler
- (which may be 0).
-
- The message handler is a function that prints out debug messages,
- warnings, critical and fatal error messages. The Qt library (debug
- mode) contains hundreds of warning messages that are printed
- when internal errors (usually invalid function arguments)
- occur. Qt built in release mode also contains such warnings unless
- QT_NO_WARNING_OUTPUT and/or QT_NO_DEBUG_OUTPUT have been set during
- compilation. If you implement your own message handler, you get total
- control of these messages.
-
- The default message handler prints the message to the standard
- output under X11 or to the debugger under Windows. If it is a
- fatal message, the application aborts immediately.
-
- Only one message handler can be defined, since this is usually
- done on an application-wide basis to control debug output.
-
- To restore the message handler, call \c qInstallMessageHandler(0).
-
- Example:
-
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 23
-
- \sa qDebug(), qWarning(), qCritical(), qFatal(), QtMsgType,
- {Debugging Techniques}
-*/
-
QMessageHandler qInstallMessageHandler(QMessageHandler h)
{
if (!messageHandler)
@@ -850,17 +665,6 @@ QMessageHandler qInstallMessageHandler(QMessageHandler h)
return old;
}
-/*!
- \fn QtMsgHandler qInstallMsgHandler(QtMsgHandler handler)
- \relates <QtGlobal>
- \deprecated
-
- Installs a Qt message \a handler which has been defined
- previously. This method is deprecated, use qInstallMessageHandler
- instead.
- \sa QtMsgHandler, qInstallMessageHandler
-*/
-
QtMsgHandler qInstallMsgHandler(QtMsgHandler h)
{
//if handler is 0, set it to the
@@ -876,4 +680,11 @@ QtMsgHandler qInstallMsgHandler(QtMsgHandler h)
return old;
}
+void QMessageLogContext::copy(const QMessageLogContext &logContext)
+{
+ this->category = logContext.category;
+ this->file = logContext.file;
+ this->line = logContext.line;
+ this->function = logContext.function;
+}
QT_END_NAMESPACE
diff --git a/src/corelib/global/qlogging.h b/src/corelib/global/qlogging.h
index 4de04bdc33..29313bd582 100644
--- a/src/corelib/global/qlogging.h
+++ b/src/corelib/global/qlogging.h
@@ -66,15 +66,17 @@ class QMessageLogContext
{
Q_DISABLE_COPY(QMessageLogContext)
public:
- QMessageLogContext() : version(1), line(0), file(0), function(0) {}
- Q_DECL_CONSTEXPR QMessageLogContext(const char *fileName, int lineNumber,
- const char *functionName)
- : version(1), line(lineNumber), file(fileName), function(functionName) {}
+ QMessageLogContext() : version(1), line(0), file(0), function(0), category(0) {}
+ Q_DECL_CONSTEXPR QMessageLogContext(const char *fileName, int lineNumber, const char *functionName, const char *categoryName)
+ : version(1), line(lineNumber), file(fileName), function(functionName), category(categoryName) {}
+
+ void copy(const QMessageLogContext &logContext);
int version;
int line;
const char *file;
const char *function;
+ const char *category;
private:
friend class QMessageLogger;
@@ -87,7 +89,9 @@ class Q_CORE_EXPORT QMessageLogger
public:
QMessageLogger() : context() {}
Q_DECL_CONSTEXPR QMessageLogger(const char *file, int line, const char *function)
- : context(file, line, function) {}
+ : context(file, line, function, "default") {}
+ Q_DECL_CONSTEXPR QMessageLogger(const char *file, int line, const char *function, const char *category)
+ : context(file, line, function, category) {}
void debug(const char *msg, ...)
#if defined(Q_CC_GNU) && !defined(__INSURE__)
diff --git a/src/corelib/global/qsystemdetection.h b/src/corelib/global/qsystemdetection.h
index 0228bc9404..db5775d021 100644
--- a/src/corelib/global/qsystemdetection.h
+++ b/src/corelib/global/qsystemdetection.h
@@ -191,7 +191,10 @@
# if !defined(MAC_OS_X_VERSION_10_7)
# define MAC_OS_X_VERSION_10_7 MAC_OS_X_VERSION_10_6 + 1
# endif
-# if (MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_7)
+# if !defined(MAC_OS_X_VERSION_10_8)
+# define MAC_OS_X_VERSION_10_8 MAC_OS_X_VERSION_10_7 + 1
+# endif
+# if (MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_8)
# warning "This version of Mac OS X is unsupported"
# endif
#endif
diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp
index 1dedc7c5c8..23bf3c5f4b 100644
--- a/src/corelib/io/qdir.cpp
+++ b/src/corelib/io/qdir.cpp
@@ -1741,11 +1741,16 @@ bool QDir::remove(const QString &fileName)
true if successful; otherwise returns false.
On most file systems, rename() fails only if \a oldName does not
- exist, if \a newName and \a oldName are not on the same
- partition or if a file with the new name already exists.
+ exist, or if a file with the new name already exists.
However, there are also other reasons why rename() can
fail. For example, on at least one file system rename() fails if
\a newName points to an open file.
+
+ If \a oldName is a file (not a directory) that can't be renamed
+ right away, Qt will try to copy \a oldName to \a newName and remove
+ \a oldName.
+
+ \sa QFile::rename()
*/
bool QDir::rename(const QString &oldName, const QString &newName)
{
diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp
index 433d4493e5..120c5a8c23 100644
--- a/src/corelib/io/qfile.cpp
+++ b/src/corelib/io/qfile.cpp
@@ -577,6 +577,11 @@ QFile::remove(const QString &fileName)
The file is closed before it is renamed.
+ If the rename operation fails, Qt will attempt to copy this file's
+ contents to \a newName, and then remove this file, keeping only
+ \a newName. If that copy operation fails or this file can't be removed,
+ the destination file \a newName is removed to restore the old state.
+
\sa setFileName()
*/
diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp
index e8ff6107ce..00e116b58f 100644
--- a/src/corelib/io/qfilesystemengine_unix.cpp
+++ b/src/corelib/io/qfilesystemengine_unix.cpp
@@ -612,6 +612,13 @@ QString QFileSystemEngine::tempPath()
{
#ifdef QT_UNIX_TEMP_PATH_OVERRIDE
return QLatin1String(QT_UNIX_TEMP_PATH_OVERRIDE);
+#elif defined(Q_OS_BLACKBERRY)
+ QString temp = QFile::decodeName(qgetenv("TEMP"));
+ if (temp.isEmpty()) {
+ qWarning("TEMP environment variable not set. Cannot determine temporary directory");
+ return QString();
+ }
+ return QDir::cleanPath(temp);
#else
QString temp = QFile::decodeName(qgetenv("TMPDIR"));
if (temp.isEmpty())
diff --git a/src/corelib/io/qtemporarydir.cpp b/src/corelib/io/qtemporarydir.cpp
index f8cd2e780e..579d569a01 100644
--- a/src/corelib/io/qtemporarydir.cpp
+++ b/src/corelib/io/qtemporarydir.cpp
@@ -99,11 +99,11 @@ static char *mkdtemp(char *templateName)
{
static const char letters[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
- const int length = strlen(templateName);
+ const size_t length = strlen(templateName);
char *XXXXXX = templateName + length - 6;
- if ((length < 6) || strncmp(XXXXXX, "XXXXXX", 6))
+ if ((length < 6u) || strncmp(XXXXXX, "XXXXXX", 6))
return 0;
for (int i = 0; i < 256; ++i) {
diff --git a/src/corelib/json/qjson_p.h b/src/corelib/json/qjson_p.h
index f8f41c2e25..831774e456 100644
--- a/src/corelib/json/qjson_p.h
+++ b/src/corelib/json/qjson_p.h
@@ -745,7 +745,7 @@ public:
Data *clone(Base *b, int reserve = 0)
{
int size = sizeof(Header) + b->size;
- if (ref.load() == 1 && alloc >= size + reserve)
+ if (b == header->root() && ref.load() == 1 && alloc >= size + reserve)
return this;
if (reserve) {
diff --git a/src/corelib/json/qjsonarray.cpp b/src/corelib/json/qjsonarray.cpp
index 6bae2001a1..d143215efd 100644
--- a/src/corelib/json/qjsonarray.cpp
+++ b/src/corelib/json/qjsonarray.cpp
@@ -275,7 +275,7 @@ void QJsonArray::removeAt(int i)
detach();
a->removeItems(i, 1);
++d->compactionCounter;
- if (d->compactionCounter > 32 && d->compactionCounter >= (int)a->length/2)
+ if (d->compactionCounter > 32u && d->compactionCounter >= unsigned(a->length) / 2u)
compact();
}
@@ -379,7 +379,7 @@ void QJsonArray::replace(int i, const QJsonValue &value)
QJsonPrivate::Value::copyData(value, (char *)a + valueOffset, compressed);
++d->compactionCounter;
- if (d->compactionCounter > 32 && d->compactionCounter >= (int)a->length/2)
+ if (d->compactionCounter > 32u && d->compactionCounter >= unsigned(a->length) / 2u)
compact();
}
diff --git a/src/corelib/json/qjsondocument.cpp b/src/corelib/json/qjsondocument.cpp
index c2204bf696..be241bc3fc 100644
--- a/src/corelib/json/qjsondocument.cpp
+++ b/src/corelib/json/qjsondocument.cpp
@@ -224,23 +224,26 @@ const char *QJsonDocument::rawData(int *size) const
*/
QJsonDocument QJsonDocument::fromBinaryData(const QByteArray &data, DataValidation validation)
{
+ if (data.size() < (int)(sizeof(QJsonPrivate::Header) + sizeof(QJsonPrivate::Base)))
+ return QJsonDocument();
+
QJsonPrivate::Header h;
memcpy(&h, data.constData(), sizeof(QJsonPrivate::Header));
QJsonPrivate::Base root;
memcpy(&root, data.constData() + sizeof(QJsonPrivate::Header), sizeof(QJsonPrivate::Base));
// do basic checks here, so we don't try to allocate more memory than we can.
- if (data.size() < (int)(sizeof(QJsonPrivate::Header) + sizeof(QJsonPrivate::Base)) ||
- h.tag != QJsonDocument::BinaryFormatTag || h.version != 1u ||
+ if (h.tag != QJsonDocument::BinaryFormatTag || h.version != 1u ||
sizeof(QJsonPrivate::Header) + root.size > (uint)data.size())
return QJsonDocument();
- char *raw = (char *)malloc(data.size());
+ const uint size = sizeof(QJsonPrivate::Header) + root.size;
+ char *raw = (char *)malloc(size);
if (!raw)
return QJsonDocument();
- memcpy(raw, data.constData(), data.size());
- QJsonPrivate::Data *d = new QJsonPrivate::Data(raw, data.size());
+ memcpy(raw, data.constData(), size);
+ QJsonPrivate::Data *d = new QJsonPrivate::Data(raw, size);
if (validation != BypassValidation && !d->valid()) {
delete d;
diff --git a/src/corelib/json/qjsondocument.h b/src/corelib/json/qjsondocument.h
index e39dc6a27c..c67899192c 100644
--- a/src/corelib/json/qjsondocument.h
+++ b/src/corelib/json/qjsondocument.h
@@ -63,14 +63,16 @@ struct Q_CORE_EXPORT QJsonParseError
UnterminatedArray,
MissingValueSeparator,
IllegalValue,
- EndOfNumber,
+ TerminationByNumber,
IllegalNumber,
- StringEscapeSequence,
- StringUTF8Scan,
- EndOfString,
+ IllegalEscapeSequence,
+ IllegalUTF8String,
+ UnterminatedString,
MissingObject
};
+ QString errorString() const;
+
int offset;
ParseError error;
};
diff --git a/src/corelib/json/qjsonobject.cpp b/src/corelib/json/qjsonobject.cpp
index e14000fac3..e880078195 100644
--- a/src/corelib/json/qjsonobject.cpp
+++ b/src/corelib/json/qjsonobject.cpp
@@ -335,7 +335,7 @@ void QJsonObject::remove(const QString &key)
detach();
o->removeItems(index, 1);
++d->compactionCounter;
- if (d->compactionCounter > 32 && d->compactionCounter >= (int)o->length/2)
+ if (d->compactionCounter > 32u && d->compactionCounter >= unsigned(o->length) / 2u)
compact();
}
@@ -361,7 +361,7 @@ QJsonValue QJsonObject::take(const QString &key)
QJsonPrivate::Entry *e = o->entryAt(index);
o->removeItems(index, 1);
++d->compactionCounter;
- if (d->compactionCounter > 32 && d->compactionCounter >= (int)o->length/2)
+ if (d->compactionCounter > 32u && d->compactionCounter >= unsigned(o->length) / 2u)
compact();
return QJsonValue(d, o, e->value);
@@ -432,7 +432,7 @@ QJsonObject::iterator QJsonObject::erase(QJsonObject::iterator it)
o->removeItems(index, 1);
++d->compactionCounter;
- if (d->compactionCounter > 32 && d->compactionCounter >= (int)o->length/2)
+ if (d->compactionCounter > 32u && d->compactionCounter >= unsigned(o->length) / 2u)
compact();
// iterator hasn't changed
diff --git a/src/corelib/json/qjsonparser.cpp b/src/corelib/json/qjsonparser.cpp
index b1e6a5a5c7..9b11c9ac3e 100644
--- a/src/corelib/json/qjsonparser.cpp
+++ b/src/corelib/json/qjsonparser.cpp
@@ -39,6 +39,9 @@
**
****************************************************************************/
+#ifndef QT_BOOTSTRAPPED
+#include <qcoreapplication.h>
+#endif
#include <qdebug.h>
#include "qjsonparser_p.h"
#include "qjson_p.h"
@@ -57,6 +60,80 @@ static int indent = 0;
QT_BEGIN_NAMESPACE
+// error strings for the JSON parser
+#define JSONERR_OK QT_TRANSLATE_NOOP("QJsonParseError", "no error occurred")
+#define JSONERR_UNTERM_OBJ QT_TRANSLATE_NOOP("QJsonParseError", "unterminated object")
+#define JSONERR_MISS_NSEP QT_TRANSLATE_NOOP("QJsonParseError", "missing name separator")
+#define JSONERR_UNTERM_AR QT_TRANSLATE_NOOP("QJsonParseError", "unterminated array")
+#define JSONERR_MISS_VSEP QT_TRANSLATE_NOOP("QJsonParseError", "missing value separator")
+#define JSONERR_ILLEGAL_VAL QT_TRANSLATE_NOOP("QJsonParseError", "illegal value")
+#define JSONERR_END_OF_NUM QT_TRANSLATE_NOOP("QJsonParseError", "invalid termination by number")
+#define JSONERR_ILLEGAL_NUM QT_TRANSLATE_NOOP("QJsonParseError", "illegal number")
+#define JSONERR_STR_ESC_SEQ QT_TRANSLATE_NOOP("QJsonParseError", "invalid escape sequence")
+#define JSONERR_STR_UTF8 QT_TRANSLATE_NOOP("QJsonParseError", "invalid UTF8 string")
+#define JSONERR_UTERM_STR QT_TRANSLATE_NOOP("QJsonParseError", "unterminated string")
+#define JSONERR_MISS_OBJ QT_TRANSLATE_NOOP("QJsonParseError", "object is missing after a comma")
+
+/*!
+ \class QJsonParseError
+ \ingroup json
+ \reentrant
+ \since 5.0
+
+ \brief The QJsonParseError class is used to report errors during JSON parsing.
+*/
+
+/*!
+ Returns the human-readable message appropriate to the reported JSON parsing error.
+ */
+QString QJsonParseError::errorString() const
+{
+ const char *sz = "";
+ switch (error) {
+ case NoError:
+ sz = JSONERR_OK;
+ break;
+ case UnterminatedObject:
+ sz = JSONERR_UNTERM_OBJ;
+ break;
+ case MissingNameSeparator:
+ sz = JSONERR_MISS_NSEP;
+ break;
+ case UnterminatedArray:
+ sz = JSONERR_UNTERM_AR;
+ break;
+ case MissingValueSeparator:
+ sz = JSONERR_MISS_VSEP;
+ break;
+ case IllegalValue:
+ sz = JSONERR_ILLEGAL_VAL;
+ break;
+ case TerminationByNumber:
+ sz = JSONERR_END_OF_NUM;
+ break;
+ case IllegalNumber:
+ sz = JSONERR_ILLEGAL_NUM;
+ break;
+ case IllegalEscapeSequence:
+ sz = JSONERR_STR_ESC_SEQ;
+ break;
+ case IllegalUTF8String:
+ sz = JSONERR_STR_UTF8;
+ break;
+ case UnterminatedString:
+ sz = JSONERR_UTERM_STR;
+ break;
+ case MissingObject:
+ sz = JSONERR_MISS_OBJ;
+ break;
+ }
+#ifndef QT_BOOTSTRAPPED
+ return QCoreApplication::translate("QJsonParseError", sz);
+#else
+ return QLatin1String(sz);
+#endif
+}
+
using namespace QJsonPrivate;
Parser::Parser(const char *json, int length)
@@ -524,7 +601,7 @@ bool Parser::parseNumber(QJsonPrivate::Value *val, int baseOffset)
}
if (json >= end) {
- lastError = QJsonParseError::EndOfNumber;
+ lastError = QJsonParseError::TerminationByNumber;
return false;
}
@@ -717,12 +794,12 @@ bool Parser::parseString(bool *latin1)
break;
else if (*json == '\\') {
if (!scanEscapeSequence(json, end, &ch)) {
- lastError = QJsonParseError::StringEscapeSequence;
+ lastError = QJsonParseError::IllegalEscapeSequence;
return false;
}
} else {
if (!scanUtf8Char(json, end, &ch)) {
- lastError = QJsonParseError::StringUTF8Scan;
+ lastError = QJsonParseError::IllegalUTF8String;
return false;
}
}
@@ -737,14 +814,14 @@ bool Parser::parseString(bool *latin1)
++json;
DEBUG << "end of string";
if (json >= end) {
- lastError = QJsonParseError::EndOfString;
+ lastError = QJsonParseError::UnterminatedString;
return false;
}
// no unicode string, we are done
if (*latin1) {
// write string length
- *(QJsonPrivate::qle_ushort *)(data + stringPos) = current - outStart - sizeof(ushort);
+ *(QJsonPrivate::qle_ushort *)(data + stringPos) = ushort(current - outStart - sizeof(ushort));
int pos = reserveSpace((4 - current) & 3);
while (pos & 3)
data[pos++] = 0;
@@ -764,12 +841,12 @@ bool Parser::parseString(bool *latin1)
break;
else if (*json == '\\') {
if (!scanEscapeSequence(json, end, &ch)) {
- lastError = QJsonParseError::StringEscapeSequence;
+ lastError = QJsonParseError::IllegalEscapeSequence;
return false;
}
} else {
if (!scanUtf8Char(json, end, &ch)) {
- lastError = QJsonParseError::StringUTF8Scan;
+ lastError = QJsonParseError::IllegalUTF8String;
return false;
}
}
@@ -785,7 +862,7 @@ bool Parser::parseString(bool *latin1)
++json;
if (json >= end) {
- lastError = QJsonParseError::EndOfString;
+ lastError = QJsonParseError::UnterminatedString;
return false;
}
diff --git a/src/corelib/kernel/qabstracteventdispatcher.cpp b/src/corelib/kernel/qabstracteventdispatcher.cpp
index 9c025d6d6f..cf9b0cea4f 100644
--- a/src/corelib/kernel/qabstracteventdispatcher.cpp
+++ b/src/corelib/kernel/qabstracteventdispatcher.cpp
@@ -337,14 +337,37 @@ void QAbstractEventDispatcher::closingDown()
{ }
/*!
- \typedef QAbstractEventDispatcher::TimerInfo
+ \class QAbstractEventDispatcher::TimerInfo
- Typedef for QPair<int, int>. The first component of
- the pair is the timer ID; the second component is
- the interval.
+ This struct represents information about a timer:
+ \l{QAbstractEventDispatcher::TimerInfo::timerId}{timerId},
+ \l{QAbstractEventDispatcher::TimerInfo::interval}{interval}, and
+ \l{QAbstractEventDispatcher::TimerInfo::timerType}{timerType}.
\sa registeredTimers()
*/
+/*! \fn QAbstractEventDispatcher::TimerInfo::TimerInfo(int timerId, int interval, Qt::TimerType timerType)
+
+ Constructs a TimerInfo struct with the given \a timerId, \a interval, and
+ \a timerType.
+*/
+/*!
+ \variable QAbstractEventDispatcher::TimerInfo::timerId
+
+ The timer's unique id.
+*/
+/*!
+ \variable QAbstractEventDispatcher::TimerInfo::interval
+
+ The timer's interval.
+*/
+/*!
+ \variable QAbstractEventDispatcher::TimerInfo::timerType
+
+ The timer's type
+
+ \sa Qt::TimerType
+*/
/*!
\typedef QAbstractEventDispatcher::EventFilter
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index c901bc142e..7b26a01cbf 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -1950,7 +1950,9 @@ QString QCoreApplication::organizationDomain()
using the empty constructor. This saves having to repeat this
information each time a QSettings object is created.
- \sa organizationName organizationDomain applicationVersion
+ If not set, the application name defaults to the executable name (since 5.0).
+
+ \sa organizationName organizationDomain applicationVersion applicationFilePath
*/
void QCoreApplication::setApplicationName(const QString &application)
{
@@ -1959,6 +1961,15 @@ void QCoreApplication::setApplicationName(const QString &application)
QString QCoreApplication::applicationName()
{
+ QString appname = coreappdata()->application;
+ if (appname.isEmpty() && QCoreApplication::self)
+ appname = QCoreApplication::self->d_func()->appName();
+ return appname;
+}
+
+// Exported for QDesktopServices (Qt4 behavior compatibility)
+Q_CORE_EXPORT QString qt_applicationName_noFallback()
+{
return coreappdata()->application;
}
diff --git a/src/corelib/kernel/qcoreapplication_win.cpp b/src/corelib/kernel/qcoreapplication_win.cpp
index c1f7c8ab25..7cc1f0e286 100644
--- a/src/corelib/kernel/qcoreapplication_win.cpp
+++ b/src/corelib/kernel/qcoreapplication_win.cpp
@@ -109,7 +109,7 @@ Q_CORE_EXPORT QString qAppFileName() // get application file name
size = MAX_PATH * i;
b = reinterpret_cast<wchar_t *>(realloc(b, (size + 1) * sizeof(wchar_t)));
if (b)
- v = GetModuleFileName(NULL, b, size);
+ v = GetModuleFileName(NULL, b, DWORD(size));
} while (b && v == size);
if (b)
diff --git a/src/corelib/kernel/qobjectdefs.h b/src/corelib/kernel/qobjectdefs.h
index 4c98bad0f9..5ad070d3b1 100644
--- a/src/corelib/kernel/qobjectdefs.h
+++ b/src/corelib/kernel/qobjectdefs.h
@@ -141,6 +141,13 @@ template <typename T1, typename T2>
inline void qYouForgotTheQ_OBJECT_Macro(T1, T2) {}
#endif // QT_NO_QOBJECT_CHECK
+#if defined(Q_CC_INTEL)
+// Cannot redefine the visibility of a method in an exported class
+# define Q_DECL_HIDDEN_STATIC_METACALL
+#else
+# define Q_DECL_HIDDEN_STATIC_METACALL Q_DECL_HIDDEN
+#endif
+
/* tmake ignore Q_OBJECT */
#define Q_OBJECT \
public: \
@@ -152,7 +159,7 @@ public: \
virtual int qt_metacall(QMetaObject::Call, int, void **); \
private: \
Q_DECL_HIDDEN static const QMetaObjectExtraData staticMetaObjectExtraData; \
- Q_DECL_HIDDEN static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **);
+ Q_DECL_HIDDEN_STATIC_METACALL static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **);
/* tmake ignore Q_OBJECT */
#define Q_OBJECT_FAKE Q_OBJECT
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp
index da6017127f..c3f8422b28 100644
--- a/src/corelib/kernel/qvariant.cpp
+++ b/src/corelib/kernel/qvariant.cpp
@@ -1544,7 +1544,6 @@ void QVariant::detach()
\internal
*/
-// ### Qt 5: change typeName()(and froends= to return a QString. Suggestion from Harald.
/*!
Returns the name of the type stored in the variant. The returned
strings describe the C++ datatype used to store the data: for
diff --git a/src/corelib/kernel/qvariant_p.h b/src/corelib/kernel/qvariant_p.h
index 2f5c4f54ee..6b778f3fb2 100644
--- a/src/corelib/kernel/qvariant_p.h
+++ b/src/corelib/kernel/qvariant_p.h
@@ -491,6 +491,7 @@ public:
void delegate(const T*)
{
Filtered<T> streamIt(m_debugStream, m_d);
+ Q_UNUSED(streamIt);
}
void delegate(const QMetaTypeSwitcher::NotBuiltinType*)
diff --git a/src/corelib/kernel/qwineventnotifier.cpp b/src/corelib/kernel/qwineventnotifier.cpp
index 58ca046d9d..8af1ab2161 100644
--- a/src/corelib/kernel/qwineventnotifier.cpp
+++ b/src/corelib/kernel/qwineventnotifier.cpp
@@ -50,6 +50,7 @@ QT_BEGIN_NAMESPACE
/*!
\class QWinEventNotifier
+ \since 5.0
\brief The QWinEventNotifier class provides support for the Windows Wait functions.
The QWinEventNotifier class makes it possible to use the wait
diff --git a/src/corelib/mimetypes/qmimedatabase.cpp b/src/corelib/mimetypes/qmimedatabase.cpp
index a7e14eed24..2c84a937d5 100644
--- a/src/corelib/mimetypes/qmimedatabase.cpp
+++ b/src/corelib/mimetypes/qmimedatabase.cpp
@@ -430,7 +430,6 @@ QMimeType QMimeDatabase::mimeTypeForFile(const QString &fileName, MatchMode mode
}
/*!
- \fn QMimeType QMimeDatabase::findMimeTypesByFileName(const QString &fileName) const;
Returns the MIME types for the file name \a fileName.
If the file name doesn't match any known pattern, an empty list is returned.
diff --git a/src/corelib/mimetypes/qmimedatabase.h b/src/corelib/mimetypes/qmimedatabase.h
index cfd1cfe33d..eff706e1b5 100644
--- a/src/corelib/mimetypes/qmimedatabase.h
+++ b/src/corelib/mimetypes/qmimedatabase.h
@@ -39,12 +39,10 @@
**
****************************************************************************/
-
#ifndef QMIMEDATABASE_H
#define QMIMEDATABASE_H
-#include "qmimetype.h"
-
+#include <QtCore/qmimetype.h>
#include <QtCore/qstringlist.h>
QT_BEGIN_NAMESPACE
diff --git a/src/corelib/mimetypes/qmimedatabase_p.h b/src/corelib/mimetypes/qmimedatabase_p.h
index 7e98548a35..8f2db32513 100644
--- a/src/corelib/mimetypes/qmimedatabase_p.h
+++ b/src/corelib/mimetypes/qmimedatabase_p.h
@@ -39,7 +39,6 @@
**
****************************************************************************/
-
#ifndef QMIMEDATABASE_P_H
#define QMIMEDATABASE_P_H
diff --git a/src/corelib/mimetypes/qmimemagicrule.cpp b/src/corelib/mimetypes/qmimemagicrule.cpp
index 1dee62f6d0..8421516b5c 100644
--- a/src/corelib/mimetypes/qmimemagicrule.cpp
+++ b/src/corelib/mimetypes/qmimemagicrule.cpp
@@ -267,7 +267,7 @@ QMimeMagicRule::QMimeMagicRule(QMimeMagicRule::Type theType,
d->mask = QByteArray::fromHex(QByteArray::fromRawData(d->mask.constData() + 2, d->mask.size() - 2));
Q_ASSERT(d->mask.size() == d->pattern.size());
} else {
- d->mask.fill(static_cast<char>(0xff), d->pattern.size());
+ d->mask.fill(char(-1), d->pattern.size());
}
d->mask.squeeze();
d->matchFunction = matchString;
diff --git a/src/corelib/mimetypes/qmimemagicrule_p.h b/src/corelib/mimetypes/qmimemagicrule_p.h
index e35c1923f9..44f7d8f8f4 100644
--- a/src/corelib/mimetypes/qmimemagicrule_p.h
+++ b/src/corelib/mimetypes/qmimemagicrule_p.h
@@ -39,7 +39,6 @@
**
****************************************************************************/
-
#ifndef QMIMEMAGICRULE_P_H
#define QMIMEMAGICRULE_P_H
diff --git a/src/corelib/mimetypes/qmimemagicrulematcher.cpp b/src/corelib/mimetypes/qmimemagicrulematcher.cpp
index 8579d02b00..255ecba8e8 100644
--- a/src/corelib/mimetypes/qmimemagicrulematcher.cpp
+++ b/src/corelib/mimetypes/qmimemagicrulematcher.cpp
@@ -39,7 +39,6 @@
**
****************************************************************************/
-
#define QT_NO_CAST_FROM_ASCII
#include "qmimemagicrulematcher_p.h"
diff --git a/src/corelib/mimetypes/qmimemagicrulematcher_p.h b/src/corelib/mimetypes/qmimemagicrulematcher_p.h
index 299f447a4c..b2bb287207 100644
--- a/src/corelib/mimetypes/qmimemagicrulematcher_p.h
+++ b/src/corelib/mimetypes/qmimemagicrulematcher_p.h
@@ -39,7 +39,6 @@
**
****************************************************************************/
-
#ifndef QMIMEMAGICRULEMATCHER_P_H
#define QMIMEMAGICRULEMATCHER_P_H
diff --git a/src/corelib/mimetypes/qmimetype.cpp b/src/corelib/mimetypes/qmimetype.cpp
index ea10cbe70a..5ee70e83b1 100644
--- a/src/corelib/mimetypes/qmimetype.cpp
+++ b/src/corelib/mimetypes/qmimetype.cpp
@@ -39,7 +39,6 @@
**
****************************************************************************/
-
#include "qmimetype.h"
#include "qmimetype_p.h"
diff --git a/src/corelib/mimetypes/qmimetype.h b/src/corelib/mimetypes/qmimetype.h
index 172973e77a..0b94977a03 100644
--- a/src/corelib/mimetypes/qmimetype.h
+++ b/src/corelib/mimetypes/qmimetype.h
@@ -39,7 +39,6 @@
**
****************************************************************************/
-
#ifndef QMIMETYPE_H
#define QMIMETYPE_H
diff --git a/src/corelib/mimetypes/qmimetype_p.h b/src/corelib/mimetypes/qmimetype_p.h
index d8aadccf50..f2c7f966ff 100644
--- a/src/corelib/mimetypes/qmimetype_p.h
+++ b/src/corelib/mimetypes/qmimetype_p.h
@@ -39,7 +39,6 @@
**
****************************************************************************/
-
#ifndef QMIMETYPE_P_H
#define QMIMETYPE_P_H
diff --git a/src/corelib/mimetypes/qmimetypeparser.cpp b/src/corelib/mimetypes/qmimetypeparser.cpp
index 4a2ec0a0b2..cc03600cf1 100644
--- a/src/corelib/mimetypes/qmimetypeparser.cpp
+++ b/src/corelib/mimetypes/qmimetypeparser.cpp
@@ -39,7 +39,6 @@
**
****************************************************************************/
-
#define QT_NO_CAST_FROM_ASCII
#include "qmimetypeparser_p.h"
@@ -93,9 +92,9 @@ static const char matchMaskAttributeC[] = "mask";
\sa QMimeTypeParser
*/
-
/*!
\class QMimeTypeParserBase
+ \internal
\brief The QMimeTypeParserBase class parses for a sequence of <mime-type> in a generic way.
Calls abstract handler function process for QMimeType it finds.
diff --git a/src/corelib/plugin/qfactoryloader.cpp b/src/corelib/plugin/qfactoryloader.cpp
index 480bc0da74..3f192ea477 100644
--- a/src/corelib/plugin/qfactoryloader.cpp
+++ b/src/corelib/plugin/qfactoryloader.cpp
@@ -188,7 +188,8 @@ void QFactoryLoader::update()
}
if (!metaDataOk) {
- library->unload();
+ if (library->compatPlugin)
+ library->unload();
library->release();
continue;
}
diff --git a/src/corelib/plugin/quuid.h b/src/corelib/plugin/quuid.h
index 0538b93c36..e595613e8f 100644
--- a/src/corelib/plugin/quuid.h
+++ b/src/corelib/plugin/quuid.h
@@ -84,6 +84,13 @@ public:
Sha1 = 5 // 0 1 0 1
};
+#ifdef Q_COMPILER_INITIALIZER_LISTS // UNIFORM_INITIALIZATION
+ Q_DECL_CONSTEXPR QUuid()
+ : data1(0), data2(0), data3(0), data4{0,0,0,0,0,0,0,0} {}
+
+ Q_DECL_CONSTEXPR QUuid(uint l, ushort w1, ushort w2, uchar b1, uchar b2, uchar b3, uchar b4, uchar b5, uchar b6, uchar b7, uchar b8)
+ : data1(l), data2(w1), data3(w2), data4{b1, b2, b3, b4, b5, b6, b7, b8} {}
+#else
QUuid()
{
data1 = 0;
@@ -106,6 +113,8 @@ public:
data4[6] = b7;
data4[7] = b8;
}
+#endif
+
#ifndef QT_NO_QUUID_STRING
QUuid(const QString &);
QUuid(const char *);
@@ -142,6 +151,12 @@ public:
#if defined(Q_OS_WIN)
// On Windows we have a type GUID that is used by the platform API, so we
// provide convenience operators to cast from and to this type.
+#ifdef Q_COMPILER_INITIALIZER_LISTS // UNIFORM_INITIALIZATION
+ Q_DECL_CONSTEXPR QUuid(const GUID &guid)
+ : data1(guid.Data1), data2(guid.Data2), data3(guid.Data3),
+ data4{guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3],
+ guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]} {}
+#else
QUuid(const GUID &guid)
{
data1 = guid.Data1;
@@ -150,6 +165,7 @@ public:
for(int i = 0; i < 8; i++)
data4[i] = guid.Data4[i];
}
+#endif
QUuid &operator=(const GUID &guid)
{
diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp
index a0913e5dbc..21ed8131df 100644
--- a/src/corelib/thread/qthread_unix.cpp
+++ b/src/corelib/thread/qthread_unix.cpp
@@ -90,7 +90,7 @@
# endif
#endif
-#if defined(Q_OS_LINUX)
+#if defined(Q_OS_LINUX) && !defined(QT_LINUXBASE)
#include <sys/prctl.h>
#endif
@@ -110,7 +110,8 @@ QT_BEGIN_NAMESPACE
enum { ThreadPriorityResetFlag = 0x80000000 };
-#if defined(Q_OS_LINUX) && defined(__GLIBC__) && (defined(Q_CC_GNU) || defined(Q_CC_INTEL))
+#if defined(Q_OS_LINUX) && defined(__GLIBC__) && (defined(Q_CC_GNU) || defined(Q_CC_INTEL)) && !defined(QT_LINUXBASE)
+/* LSB doesn't have __thread, https://lsbbugs.linuxfoundation.org/show_bug.cgi?id=993 */
#define HAVE_TLS
#endif
#if defined(Q_CC_XLC) || defined (Q_CC_SUN)
@@ -294,7 +295,7 @@ void *QThreadPrivate::start(void *arg)
if (objectName.isEmpty())
objectName = thr->metaObject()->className();
-#if defined(Q_OS_LINUX)
+#if defined(Q_OS_LINUX) && !defined(QT_LINUXBASE)
prctl(PR_SET_NAME, (unsigned long)objectName.constData(), 0, 0, 0);
#elif defined(Q_OS_MAC)
pthread_setname_np(objectName.constData());
diff --git a/src/corelib/thread/qthread_win.cpp b/src/corelib/thread/qthread_win.cpp
index 38fb6ef8dd..1cde07e330 100644
--- a/src/corelib/thread/qthread_win.cpp
+++ b/src/corelib/thread/qthread_win.cpp
@@ -238,6 +238,7 @@ DWORD WINAPI qt_adopted_thread_watcher_function(LPVOID)
QThread *thread = data->thread;
Q_ASSERT(thread);
QThreadPrivate *thread_p = static_cast<QThreadPrivate *>(QObjectPrivate::get(thread));
+ Q_UNUSED(thread_p)
Q_ASSERT(!thread_p->finished);
thread_p->finish(thread);
}
diff --git a/src/corelib/thread/qwaitcondition.h b/src/corelib/thread/qwaitcondition.h
index f6e41aef4e..d3a24958f6 100644
--- a/src/corelib/thread/qwaitcondition.h
+++ b/src/corelib/thread/qwaitcondition.h
@@ -63,8 +63,8 @@ public:
QWaitCondition();
~QWaitCondition();
- bool wait(QMutex *mutex, unsigned long time = ULONG_MAX);
- bool wait(QReadWriteLock *readWriteLock, unsigned long time = ULONG_MAX);
+ bool wait(QMutex *lockedMutex, unsigned long time = ULONG_MAX);
+ bool wait(QReadWriteLock *lockedReadWriteLock, unsigned long time = ULONG_MAX);
void wakeOne();
void wakeAll();
diff --git a/src/corelib/thread/qwaitcondition.qdoc b/src/corelib/thread/qwaitcondition.qdoc
index 8c93bd167d..81c095f394 100644
--- a/src/corelib/thread/qwaitcondition.qdoc
+++ b/src/corelib/thread/qwaitcondition.qdoc
@@ -119,13 +119,13 @@
*/
/*!
- \fn bool QWaitCondition::wait(QMutex *mutex, unsigned long time)
+ \fn bool QWaitCondition::wait(QMutex *lockedMutex, unsigned long time)
- Releases the locked \a mutex and waits on the wait condition. The
- \a mutex must be initially locked by the calling thread. If \a
- mutex is not in a locked state, this function returns
- immediately. If \a mutex is a recursive mutex, this function
- returns immediately. The \a mutex will be unlocked, and the
+ Releases the \a lockedMutex and waits on the wait condition. The
+ \a lockedMutex must be initially locked by the calling thread. If \a
+ lockedMutex is not in a locked state, this function returns
+ immediately. If \a lockedMutex is a recursive mutex, this function
+ returns immediately. The \a lockedMutex will be unlocked, and the
calling thread will block until either of these conditions is met:
\list
@@ -137,7 +137,7 @@
wait timed out.
\endlist
- The mutex will be returned to the same locked state. This
+ The \a lockedMutex will be returned to the same locked state. This
function is provided to allow the atomic transition from the
locked state to the wait state.
@@ -145,15 +145,15 @@
*/
/*!
- \fn bool QWaitCondition::wait(QReadWriteLock *readWriteLock, unsigned long time)
+ \fn bool QWaitCondition::wait(QReadWriteLock *lockedReadWriteLock, unsigned long time)
\since 4.4
- Releases the locked \a readWriteLock and waits on the wait
- condition. The \a readWriteLock must be initially locked by the
- calling thread. If \a readWriteLock is not in a locked state, this
- function returns immediately. The \a readWriteLock must not be
+ Releases the \a lockedReadWriteLock and waits on the wait
+ condition. The \a lockedReadWriteLock must be initially locked by the
+ calling thread. If \a lockedReadWriteLock is not in a locked state, this
+ function returns immediately. The \a lockedReadWriteLock must not be
locked recursively, otherwise this function will not release the
- lock properly. The \a readWriteLock will be unlocked, and the
+ lock properly. The \a lockedReadWriteLock will be unlocked, and the
calling thread will block until either of these conditions is met:
\list
@@ -165,7 +165,7 @@
wait timed out.
\endlist
- The \a readWriteLock will be returned to the same locked
+ The \a lcokedReadWriteLock will be returned to the same locked
state. This function is provided to allow the atomic transition
from the locked state to the wait state.
diff --git a/src/corelib/tools/qbitarray.h b/src/corelib/tools/qbitarray.h
index 5486c60dfb..5ccb5c0fd7 100644
--- a/src/corelib/tools/qbitarray.h
+++ b/src/corelib/tools/qbitarray.h
@@ -72,7 +72,6 @@ public:
inline int size() const { return (d.size() << 3) - *d.constData(); }
inline int count() const { return (d.size() << 3) - *d.constData(); }
int count(bool on) const;
- // ### Qt 5: Store the number of set bits separately
inline bool isEmpty() const { return d.isEmpty(); }
inline bool isNull() const { return d.isNull(); }
diff --git a/src/corelib/tools/qelapsedtimer_generic.cpp b/src/corelib/tools/qelapsedtimer_generic.cpp
index 038a15bd37..05214f0698 100644
--- a/src/corelib/tools/qelapsedtimer_generic.cpp
+++ b/src/corelib/tools/qelapsedtimer_generic.cpp
@@ -150,8 +150,8 @@ qint64 QElapsedTimer::msecsSinceReference() const
/*!
Returns the number of milliseconds between this QElapsedTimer and \a
other. If \a other was started before this object, the returned value
- will be positive. If it was started later, the returned value will be
- negative.
+ will be negative. If it was started later, the returned value will be
+ positive.
The return value is undefined if this object or \a other were invalidated.
@@ -166,7 +166,7 @@ qint64 QElapsedTimer::msecsTo(const QElapsedTimer &other) const
/*!
Returns the number of seconds between this QElapsedTimer and \a other. If
\a other was started before this object, the returned value will be
- positive. If it was started later, the returned value will be negative.
+ negative. If it was started later, the returned value will be positive.
The return value is undefined if this object or \a other were invalidated.
diff --git a/src/corelib/tools/qregularexpression.cpp b/src/corelib/tools/qregularexpression.cpp
index eaa20b304a..27264f7e72 100644
--- a/src/corelib/tools/qregularexpression.cpp
+++ b/src/corelib/tools/qregularexpression.cpp
@@ -2153,30 +2153,30 @@ QDebug operator<<(QDebug debug, const QRegularExpression &re)
*/
QDebug operator<<(QDebug debug, QRegularExpression::PatternOptions patternOptions)
{
- QStringList flags;
+ QByteArray flags;
if (patternOptions == QRegularExpression::NoPatternOption) {
- flags << QLatin1String("NoPatternOption");
+ flags = "NoPatternOption";
} else {
+ flags.reserve(200); // worst case...
if (patternOptions & QRegularExpression::CaseInsensitiveOption)
- flags << QLatin1String("CaseInsensitiveOption");
+ flags.append("CaseInsensitiveOption|");
if (patternOptions & QRegularExpression::DotMatchesEverythingOption)
- flags << QLatin1String("DotMatchesEverythingOption");
+ flags.append("DotMatchesEverythingOption|");
if (patternOptions & QRegularExpression::MultilineOption)
- flags << QLatin1String("MultilineOption");
+ flags.append("MultilineOption|");
if (patternOptions & QRegularExpression::ExtendedPatternSyntaxOption)
- flags << QLatin1String("ExtendedPatternSyntaxOption");
+ flags.append("ExtendedPatternSyntaxOption|");
if (patternOptions & QRegularExpression::InvertedGreedinessOption)
- flags << QLatin1String("InvertedGreedinessOption");
+ flags.append("InvertedGreedinessOption|");
if (patternOptions & QRegularExpression::DontCaptureOption)
- flags << QLatin1String("DontCaptureOption");
+ flags.append("DontCaptureOption|");
if (patternOptions & QRegularExpression::UseUnicodePropertiesOption)
- flags << QLatin1String("UseUnicodePropertiesOption");
+ flags.append("UseUnicodePropertiesOption|");
+ flags.chop(1);
}
- debug.nospace() << "QRegularExpression::PatternOptions("
- << qPrintable(flags.join(QLatin1String("|")))
- << ")";
+ debug.nospace() << "QRegularExpression::PatternOptions(" << flags << ")";
return debug.space();
}
diff --git a/src/corelib/tools/qset.qdoc b/src/corelib/tools/qset.qdoc
index 139b017966..b03cce884d 100644
--- a/src/corelib/tools/qset.qdoc
+++ b/src/corelib/tools/qset.qdoc
@@ -589,16 +589,6 @@
*/
/*!
- \fn QSet<T> QSet::operator-(const QSet<T> &other)
- \fn QSet<T> QSet::operator|(const QSet<T> &other)
- \fn QSet<T> QSet::operator+(const QSet<T> &other)
- \fn QSet<T> QSet::operator&(const QSet<T> &other)
- \internal
-
- These will go away in Qt 5.
-*/
-
-/*!
\class QSet::iterator
\since 4.2
\brief The QSet::iterator class provides an STL-style non-const iterator for QSet.
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index c4eef38971..2bb439d703 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -5349,7 +5349,7 @@ QString QString::toUpper() const
return *this;
}
-// ### Qt 5: Consider whether this function shouldn't be removed See task 202871.
+// ### Qt 6: Consider whether this function shouldn't be removed See task 202871.
/*!
Safely builds a formatted string from the format string \a cformat
and an arbitrary list of arguments.