summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@theqtcompany.com>2015-07-17 15:06:22 +0200
committerSimon Hausmann <simon.hausmann@theqtcompany.com>2015-07-17 16:35:42 +0200
commitb2603b76655ac819e43c063bb6f16bc95f358083 (patch)
tree0fbe2c367ebfffdb70e9e3f21a7cf408bafd9626 /src/corelib
parent99b94aadf875c822afb6c2580e43355ac392ac92 (diff)
parent756266d01560157b7274e466b9ffc1b0e2ef9a1f (diff)
Merge remote-tracking branch 'origin/5.5' into HEAD
Conflicts: src/plugins/platforms/windows/qwindowsopengltester.cpp Change-Id: Ia7abeba9395ccf84e2fa81b91a5725a86dedb9fe
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/arch/qatomic_armv6.h5
-rw-r--r--src/corelib/doc/src/containers.qdoc7
-rw-r--r--src/corelib/global/global.pri2
-rw-r--r--src/corelib/global/qcompilerdetection.h15
-rw-r--r--src/corelib/global/qglobal.cpp3
-rw-r--r--src/corelib/global/qlibraryinfo.cpp2
-rw-r--r--src/corelib/global/qlogging.cpp11
-rw-r--r--src/corelib/io/io.pri1
-rw-r--r--src/corelib/io/qdir.cpp16
-rw-r--r--src/corelib/io/qloggingregistry.cpp29
-rw-r--r--src/corelib/io/qprocess_unix.cpp15
-rw-r--r--src/corelib/io/qsavefile.cpp3
-rw-r--r--src/corelib/io/qtemporaryfile.cpp25
-rw-r--r--src/corelib/io/qtemporaryfile_p.h14
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp2
-rw-r--r--src/corelib/kernel/qeventdispatcher_win.cpp21
-rw-r--r--src/corelib/kernel/qeventdispatcher_win_p.h2
-rw-r--r--src/corelib/kernel/qeventdispatcher_winrt_p.h2
-rw-r--r--src/corelib/kernel/qmetaobject.cpp20
-rw-r--r--src/corelib/kernel/qobject.cpp9
-rw-r--r--src/corelib/tools/qelapsedtimer_win.cpp2
-rw-r--r--src/corelib/tools/qstring.cpp4
22 files changed, 132 insertions, 78 deletions
diff --git a/src/corelib/arch/qatomic_armv6.h b/src/corelib/arch/qatomic_armv6.h
index b14ab3d636..b2ea85ada2 100644
--- a/src/corelib/arch/qatomic_armv6.h
+++ b/src/corelib/arch/qatomic_armv6.h
@@ -90,7 +90,10 @@ private:
template <typename T> struct QAtomicOps : QBasicAtomicOps<sizeof(T)>
{
- typedef T Type;
+ // this is GCC or GCC-like, so we can use extensions:
+ // force the alignment to be the size of the type, as on some ABIs the alignment
+ // of 64-bit types is 32-bit. We need proper alignment for LDREX / STREX.
+ typedef __attribute__((__aligned__(sizeof(T)))) T Type;
};
#ifndef Q_CC_RVCT
diff --git a/src/corelib/doc/src/containers.qdoc b/src/corelib/doc/src/containers.qdoc
index 1979c45e17..f8d0d3eb05 100644
--- a/src/corelib/doc/src/containers.qdoc
+++ b/src/corelib/doc/src/containers.qdoc
@@ -601,6 +601,13 @@
container. It only affects the copy, which is probably not what you
want.
+ An alternative to Qt's \c foreach loop is the range-based \c for that is
+ part of C++ 11 and newer. However, keep in mind that the range-based
+ \c for might force a Qt container to \l{Implicit Sharing}{detach}, whereas
+ \c foreach would not. But using \c foreach always copies the container,
+ which is usually not cheap for STL containers. If in doubt, prefer
+ \c foreach for Qt containers, and range based \c for for STL ones.
+
In addition to \c foreach, Qt also provides a \c forever
pseudo-keyword for infinite loops:
diff --git a/src/corelib/global/global.pri b/src/corelib/global/global.pri
index bc11c77d88..6a8104bee2 100644
--- a/src/corelib/global/global.pri
+++ b/src/corelib/global/global.pri
@@ -41,7 +41,7 @@ LIBS_PRIVATE += $$QMAKE_LIBS_EXECINFO
if(linux*|hurd*):!cross_compile:!static:!*-armcc* {
QMAKE_LFLAGS += -Wl,-e,qt_core_boilerplate
prog=$$quote(if (/program interpreter: (.*)]/) { print $1; })
- DEFINES += ELF_INTERPRETER=\\\"$$system(readelf -l /bin/ls | perl -n -e \'$$prog\')\\\"
+ DEFINES += ELF_INTERPRETER=\\\"$$system(LC_ALL=C readelf -l /bin/ls | perl -n -e \'$$prog\')\\\"
}
slog2 {
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h
index 060af29b03..c582b1f238 100644
--- a/src/corelib/global/qcompilerdetection.h
+++ b/src/corelib/global/qcompilerdetection.h
@@ -97,7 +97,7 @@
/* Intel C++ disguising as Visual C++: the `using' keyword avoids warnings */
# if defined(__INTEL_COMPILER)
# define Q_DECL_VARIABLE_DEPRECATED
-# define Q_CC_INTEL
+# define Q_CC_INTEL __INTEL_COMPILER
# endif
/* only defined for MSVC since that's the only compiler that actually optimizes for this */
@@ -564,6 +564,16 @@
# endif
# define Q_COMPILER_UDL
# endif
+# ifdef _MSC_VER
+# if _MSC_VER == 1700
+// <initializer_list> is missing with MSVC 2012 (it's present in 2010, 2013 and up)
+# undef Q_COMPILER_INITIALIZER_LISTS
+# endif
+# if _MSC_VER < 1900
+// ICC disables unicode string support when compatibility mode with MSVC 2013 or lower is active
+# undef Q_COMPILER_UNICODE_STRINGS
+# endif
+# endif
# endif
#endif
@@ -890,7 +900,8 @@
# define Q_COMPILER_RANGE_FOR
# define Q_COMPILER_REF_QUALIFIERS
# define Q_COMPILER_THREAD_LOCAL
-# define Q_COMPILER_THREADSAFE_STATICS
+// Broken, see QTBUG-47224 and https://connect.microsoft.com/VisualStudio/feedback/details/1549785
+//# define Q_COMPILER_THREADSAFE_STATICS
# define Q_COMPILER_UDL
# define Q_COMPILER_UNICODE_STRINGS
// Uniform initialization is not working yet -- build errors with QUuid
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index 85d97c7b06..f335794fed 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -2262,7 +2262,8 @@ static bool readEtcRedHatRelease(QUnixOSVersion &v)
int releaseIndex = line.indexOf(keyword);
v.productType = QString::fromLatin1(line.mid(0, releaseIndex)).remove(QLatin1Char(' '));
int spaceIndex = line.indexOf(' ', releaseIndex + strlen(keyword));
- v.productVersion = QString::fromLatin1(line.mid(releaseIndex + strlen(keyword), spaceIndex > -1 ? spaceIndex - releaseIndex - strlen(keyword) : -1));
+ v.productVersion = QString::fromLatin1(line.mid(releaseIndex + strlen(keyword),
+ spaceIndex > -1 ? spaceIndex - releaseIndex - int(strlen(keyword)) : -1));
return true;
}
diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp
index 2912e68580..0cfcc4e659 100644
--- a/src/corelib/global/qlibraryinfo.cpp
+++ b/src/corelib/global/qlibraryinfo.cpp
@@ -650,11 +650,9 @@ void qt_core_boilerplate()
"Copyright (C) 2015 The Qt Company Ltd.\n"
"Contact: http://www.qt.io/licensing/\n"
"\n"
- "Build date: %s\n"
"Installation prefix: %s\n"
"Library path: %s\n"
"Include path: %s\n",
- qt_configure_installation + 12,
qt_configure_prefix_path_str + 12,
qt_configure_strs + qt_configure_str_offsets[QT_PREPEND_NAMESPACE(QLibraryInfo)::LibrariesPath - 1],
qt_configure_strs + qt_configure_str_offsets[QT_PREPEND_NAMESPACE(QLibraryInfo)::HeadersPath - 1]);
diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp
index 88882bbe8f..fca8656f9b 100644
--- a/src/corelib/global/qlogging.cpp
+++ b/src/corelib/global/qlogging.cpp
@@ -87,6 +87,10 @@
# endif
#endif
+#if defined(QT_USE_SLOG2)
+extern char *__progname;
+#endif
+
#if defined(Q_OS_LINUX) && (defined(__GLIBC__) || __has_include(<sys/syscall.h>))
# include <sys/syscall.h>
static long qt_gettid()
@@ -1173,8 +1177,6 @@ void QMessagePattern::setPattern(const QString &pattern)
#define QT_LOG_CODE 9000
#endif
-extern char *__progname;
-
static void slog2_default_handler(QtMsgType msgType, const char *message)
{
if (slog2_set_default_buffer((slog2_buffer_t)-1) == 0) {
@@ -1357,8 +1359,9 @@ QString qFormatLogMessage(QtMsgType type, const QMessageLogContext &context, con
} else if (pattern->timeFormat == QLatin1String("boot")) {
// just print the milliseconds since the elapsed timer reference
// like the Linux kernel does
- pattern->timer.elapsed();
- uint ms = pattern->timer.msecsSinceReference();
+ QElapsedTimer now;
+ now.start();
+ uint ms = now.msecsSinceReference();
message.append(QString::asprintf("%6d.%03d", uint(ms / 1000), uint(ms % 1000)));
} else if (pattern->timeFormat.isEmpty()) {
message.append(QDateTime::currentDateTime().toString(Qt::ISODate));
diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri
index 207de2a85b..f496d037d8 100644
--- a/src/corelib/io/io.pri
+++ b/src/corelib/io/io.pri
@@ -147,6 +147,7 @@ win32 {
SOURCES += io/qsettings_mac.cpp
OBJECTIVE_SOURCES += io/qurl_mac.mm
}
+ freebsd: LIBS_PRIVATE += -lutil # qlockfile_unix.cpp requires this
mac {
osx {
OBJECTIVE_SOURCES += io/qfilesystemwatcher_fsevents.mm
diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp
index 2ae865a534..e1d9858a66 100644
--- a/src/corelib/io/qdir.cpp
+++ b/src/corelib/io/qdir.cpp
@@ -1503,11 +1503,19 @@ bool QDir::removeRecursively()
while (di.hasNext()) {
di.next();
const QFileInfo& fi = di.fileInfo();
+ const QString &filePath = di.filePath();
bool ok;
- if (fi.isDir() && !fi.isSymLink())
- ok = QDir(di.filePath()).removeRecursively(); // recursive
- else
- ok = QFile::remove(di.filePath());
+ if (fi.isDir() && !fi.isSymLink()) {
+ ok = QDir(filePath).removeRecursively(); // recursive
+ } else {
+ ok = QFile::remove(filePath);
+ if (!ok) { // Read-only files prevent directory deletion on Windows, retry with Write permission.
+ const QFile::Permissions permissions = QFile::permissions(filePath);
+ if (!(permissions & QFile::WriteUser))
+ ok = QFile::setPermissions(filePath, permissions | QFile::WriteUser)
+ && QFile::remove(filePath);
+ }
+ }
if (!ok)
success = false;
}
diff --git a/src/corelib/io/qloggingregistry.cpp b/src/corelib/io/qloggingregistry.cpp
index 85e73db652..ed775d62e0 100644
--- a/src/corelib/io/qloggingregistry.cpp
+++ b/src/corelib/io/qloggingregistry.cpp
@@ -210,20 +210,23 @@ void QLoggingSettingsParser::setContent(QTextStream &stream)
if (_section == QLatin1String("Rules")) {
int equalPos = line.indexOf(QLatin1Char('='));
- if ((equalPos != -1)
- && (line.lastIndexOf(QLatin1Char('=')) == equalPos)) {
- const QStringRef pattern = line.leftRef(equalPos);
- const QStringRef valueStr = line.midRef(equalPos + 1);
- int value = -1;
- if (valueStr == QLatin1String("true"))
- value = 1;
- else if (valueStr == QLatin1String("false"))
- value = 0;
- QLoggingRule rule(pattern, (value == 1));
- if (rule.flags != 0 && (value != -1))
- _rules.append(rule);
- else
+ if (equalPos != -1) {
+ if (line.lastIndexOf(QLatin1Char('=')) == equalPos) {
+ const QStringRef pattern = line.leftRef(equalPos);
+ const QStringRef valueStr = line.midRef(equalPos + 1);
+ int value = -1;
+ if (valueStr == QLatin1String("true"))
+ value = 1;
+ else if (valueStr == QLatin1String("false"))
+ value = 0;
+ QLoggingRule rule(pattern, (value == 1));
+ if (rule.flags != 0 && (value != -1))
+ _rules.append(rule);
+ else
+ warnMsg("Ignoring malformed logging rule: '%s'", line.toUtf8().constData());
+ } else {
warnMsg("Ignoring malformed logging rule: '%s'", line.toUtf8().constData());
+ }
}
}
}
diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp
index 0d6ef9e60f..4c3432d6b6 100644
--- a/src/corelib/io/qprocess_unix.cpp
+++ b/src/corelib/io/qprocess_unix.cpp
@@ -1075,20 +1075,17 @@ bool QProcessPrivate::waitForDeadChild()
return true; // child has already exited
// read the process information from our fd
- siginfo_t info;
- qint64 ret = qt_safe_read(forkfd, &info, sizeof info);
- Q_ASSERT(ret == sizeof info);
- Q_UNUSED(ret);
+ forkfd_info info;
+ int ret;
+ EINTR_LOOP(ret, forkfd_wait(forkfd, &info, Q_NULLPTR));
- Q_ASSERT(info.si_pid == pid_t(pid));
-
- exitCode = info.si_status;
- crashed = info.si_code != CLD_EXITED;
+ exitCode = info.status;
+ crashed = info.code != CLD_EXITED;
delete deathNotifier;
deathNotifier = 0;
- qt_safe_close(forkfd);
+ EINTR_LOOP(ret, forkfd_close(forkfd));
forkfd = -1; // Child is dead, don't try to kill it anymore
#if defined QPROCESS_DEBUG
diff --git a/src/corelib/io/qsavefile.cpp b/src/corelib/io/qsavefile.cpp
index ffa6ad1c55..5a325f8e2c 100644
--- a/src/corelib/io/qsavefile.cpp
+++ b/src/corelib/io/qsavefile.cpp
@@ -215,7 +215,8 @@ bool QSaveFile::open(OpenMode mode)
d->finalFileName = existingFile.filePath();
}
- d->fileEngine = new QTemporaryFileEngine(d->finalFileName, 0666);
+ d->fileEngine = new QTemporaryFileEngine;
+ static_cast<QTemporaryFileEngine *>(d->fileEngine)->initialize(d->finalFileName, 0666);
// Same as in QFile: QIODevice provides the buffering, so there's no need to request it from the file engine.
if (!d->fileEngine->open(mode | QIODevice::Unbuffered)) {
QFileDevice::FileError err = d->fileEngine->error();
diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp
index bdf4392275..e8e8d8c878 100644
--- a/src/corelib/io/qtemporaryfile.cpp
+++ b/src/corelib/io/qtemporaryfile.cpp
@@ -409,14 +409,24 @@ QTemporaryFilePrivate::~QTemporaryFilePrivate()
QAbstractFileEngine *QTemporaryFilePrivate::engine() const
{
if (!fileEngine) {
- if (fileName.isEmpty())
- fileEngine = new QTemporaryFileEngine(templateName, 0600);
- else
- fileEngine = new QTemporaryFileEngine(fileName, 0600, false);
+ fileEngine = new QTemporaryFileEngine;
+ resetFileEngine();
}
return fileEngine;
}
+void QTemporaryFilePrivate::resetFileEngine() const
+{
+ if (!fileEngine)
+ return;
+
+ QTemporaryFileEngine *tef = static_cast<QTemporaryFileEngine *>(fileEngine);
+ if (fileName.isEmpty())
+ tef->initialize(templateName, 0600);
+ else
+ tef->initialize(fileName, 0600, false);
+}
+
QString QTemporaryFilePrivate::defaultTemplateName()
{
QString baseName;
@@ -769,6 +779,13 @@ bool QTemporaryFile::open(OpenMode flags)
}
}
+ // reset the engine state so it creates a new, unique file name from the template;
+ // equivalent to:
+ // delete d->fileEngine;
+ // d->fileEngine = 0;
+ // d->engine();
+ d->resetFileEngine();
+
if (QFile::open(flags)) {
d->fileName = d->fileEngine->fileName(QAbstractFileEngine::DefaultName);
return true;
diff --git a/src/corelib/io/qtemporaryfile_p.h b/src/corelib/io/qtemporaryfile_p.h
index 341ae9bd3f..8002990270 100644
--- a/src/corelib/io/qtemporaryfile_p.h
+++ b/src/corelib/io/qtemporaryfile_p.h
@@ -64,6 +64,7 @@ protected:
~QTemporaryFilePrivate();
QAbstractFileEngine *engine() const;
+ void resetFileEngine() const;
bool autoRemove;
QString templateName;
@@ -77,22 +78,17 @@ class QTemporaryFileEngine : public QFSFileEngine
{
Q_DECLARE_PRIVATE(QFSFileEngine)
public:
-
- QTemporaryFileEngine(const QString &file,
- quint32 fileMode,
- bool fileIsTemplate = true) :
- QFSFileEngine(),
- fileMode(fileMode),
- filePathIsTemplate(fileIsTemplate),
- filePathWasTemplate(fileIsTemplate)
+ void initialize(const QString &file, quint32 mode, bool nameIsTemplate = true)
{
Q_D(QFSFileEngine);
+ Q_ASSERT(!isReallyOpen());
+ fileMode = mode;
+ filePathIsTemplate = filePathWasTemplate = nameIsTemplate;
d->fileEntry = QFileSystemEntry(file);
if (!filePathIsTemplate)
QFSFileEngine::setFileName(file);
}
-
~QTemporaryFileEngine();
bool isReallyOpen() const;
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index 66481d4c87..08c0473cf0 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -392,7 +392,7 @@ static bool quitLockRefEnabled = true;
// GUI apps or when using MinGW due to its globbing.
static inline bool isArgvModified(int argc, char **argv)
{
- if (__argc != argc)
+ if (__argc != argc || !__argv /* wmain() */)
return true;
if (__argv == argv)
return false;
diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp
index ccb8341d0a..e8ff8a7936 100644
--- a/src/corelib/kernel/qeventdispatcher_win.cpp
+++ b/src/corelib/kernel/qeventdispatcher_win.cpp
@@ -560,6 +560,17 @@ static HWND qt_create_internal_window(const QEventDispatcherWin32 *eventDispatch
return wnd;
}
+static void calculateNextTimeout(WinTimerInfo *t, quint64 currentTime)
+{
+ uint interval = t->interval;
+ if ((interval >= 20000u && t->timerType != Qt::PreciseTimer) || t->timerType == Qt::VeryCoarseTimer) {
+ // round the interval, VeryCoarseTimers only have full second accuracy
+ interval = ((interval + 500)) / 1000 * 1000;
+ }
+ t->interval = interval;
+ t->timeout = currentTime + interval;
+}
+
void QEventDispatcherWin32Private::registerTimer(WinTimerInfo *t)
{
Q_ASSERT(internalHwnd);
@@ -567,6 +578,7 @@ void QEventDispatcherWin32Private::registerTimer(WinTimerInfo *t)
Q_Q(QEventDispatcherWin32);
int ok = 0;
+ calculateNextTimeout(t, qt_msectime());
uint interval = t->interval;
if (interval == 0u) {
// optimization for single-shot-zero-timer
@@ -575,17 +587,13 @@ void QEventDispatcherWin32Private::registerTimer(WinTimerInfo *t)
} else if ((interval < 20u || t->timerType == Qt::PreciseTimer) && qtimeSetEvent) {
ok = t->fastTimerId = qtimeSetEvent(interval, 1, qt_fast_timer_proc, (DWORD_PTR)t,
TIME_CALLBACK_FUNCTION | TIME_PERIODIC | TIME_KILL_SYNCHRONOUS);
- } else if (interval >= 20000u || t->timerType == Qt::VeryCoarseTimer) {
- // round the interval, VeryCoarseTimers only have full second accuracy
- interval = ((interval + 500)) / 1000 * 1000;
}
+
if (ok == 0) {
// user normal timers for (Very)CoarseTimers, or if no more multimedia timers available
ok = SetTimer(internalHwnd, t->timerId, interval, 0);
}
- t->timeout = qt_msectime() + interval;
-
if (ok == 0)
qErrnoWarning("QEventDispatcherWin32::registerTimer: Failed to create a timer");
}
@@ -610,6 +618,9 @@ void QEventDispatcherWin32Private::sendTimerEvent(int timerId)
// send event, but don't allow it to recurse
t->inTimerEvent = true;
+ // recalculate next emission
+ calculateNextTimeout(t, qt_msectime());
+
QTimerEvent e(t->timerId);
QCoreApplication::sendEvent(t->obj, &e);
diff --git a/src/corelib/kernel/qeventdispatcher_win_p.h b/src/corelib/kernel/qeventdispatcher_win_p.h
index 6b4fb18f46..e59e29f1ff 100644
--- a/src/corelib/kernel/qeventdispatcher_win_p.h
+++ b/src/corelib/kernel/qeventdispatcher_win_p.h
@@ -58,7 +58,7 @@ class QEventDispatcherWin32Private;
// forward declaration
LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp);
-int qt_msectime();
+quint64 qt_msectime();
class Q_CORE_EXPORT QEventDispatcherWin32 : public QAbstractEventDispatcher
{
diff --git a/src/corelib/kernel/qeventdispatcher_winrt_p.h b/src/corelib/kernel/qeventdispatcher_winrt_p.h
index e39746aeef..fd3d259c96 100644
--- a/src/corelib/kernel/qeventdispatcher_winrt_p.h
+++ b/src/corelib/kernel/qeventdispatcher_winrt_p.h
@@ -52,7 +52,7 @@
QT_BEGIN_NAMESPACE
-int qt_msectime();
+quint64 qt_msectime();
class QEventDispatcherWinRTPrivate;
diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp
index 60cd3ab94a..90ee7d8f95 100644
--- a/src/corelib/kernel/qmetaobject.cpp
+++ b/src/corelib/kernel/qmetaobject.cpp
@@ -1879,13 +1879,14 @@ const char *QMetaMethod::typeName() const
way in the function declaration:
\code
+ // In the class MainWindow declaration
#ifndef Q_MOC_RUN
- // define the tag text
- # define THISISTESTTAG
+ // define the tag text as empty, so the compiler doesn't see it
+ # define MY_CUSTOM_TAG
#endif
...
private slots:
- THISISTESTTAG void testFunc();
+ MY_CUSTOM_TAG void testFunc();
\endcode
and the information can be accessed by using:
@@ -1895,12 +1896,14 @@ const char *QMetaMethod::typeName() const
win.show();
int functionIndex = win.metaObject()->indexOfSlot("testFunc()");
- QMetaMethod mm = metaObject()->method(functionIndex);
- qDebug() << mm.tag(); // prints THISISTESTTAG
+ QMetaMethod mm = win.metaObject()->method(functionIndex);
+ qDebug() << mm.tag(); // prints MY_CUSTOM_TAG
\endcode
For the moment, \c moc will extract and record all tags, but it will not
- handle any of them specially.
+ handle any of them specially. You can use the tags to annotate your methods
+ differently, and treat them according to the specific needs of your
+ application.
\note Since Qt 5.0, \c moc expands preprocessor macros, so it is necessary
to surround the definition with \c #ifndef \c Q_MOC_RUN, as shown in the
@@ -1960,8 +1963,9 @@ int QMetaMethod::revision() const
Returns the access specification of this method (private,
protected, or public).
- Signals are always protected, meaning that you can only emit them
- from the class or from a subclass.
+ \note Signals are always public, but you should regard that as an
+ implementation detail. It is almost always a bad idea to emit a signal from
+ outside its class.
\sa methodType()
*/
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index c63dd79f02..e6458382f2 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -909,14 +909,7 @@ QObject::~QObject()
}
if (!d->isWidget && d->isSignalConnected(0)) {
- QT_TRY {
- emit destroyed(this);
- } QT_CATCH(...) {
- // all the signal/slots connections are still in place - if we don't
- // quit now, we will crash pretty soon.
- qWarning("Detected an unexpected exception in ~QObject while emitting destroyed().");
- QT_RETHROW;
- }
+ emit destroyed(this);
}
if (d->declarativeData) {
diff --git a/src/corelib/tools/qelapsedtimer_win.cpp b/src/corelib/tools/qelapsedtimer_win.cpp
index eab2f8ef6c..b80c23cf8f 100644
--- a/src/corelib/tools/qelapsedtimer_win.cpp
+++ b/src/corelib/tools/qelapsedtimer_win.cpp
@@ -117,7 +117,7 @@ static quint64 getTickCount()
#endif // Q_OS_WINRT
}
-int qt_msectime()
+quint64 qt_msectime()
{
return ticksToNanoseconds(getTickCount()) / 1000000;
}
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index 26ec81c103..ef87a8e3a5 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -273,9 +273,9 @@ static inline __m128i mergeQuestionMarks(__m128i chunk)
// that they are doing the right thing. Inverting the arguments in the
// instruction does cause a bunch of test failures.
- const int mode = _SIDD_UWORD_OPS | _SIDD_CMP_RANGES | _SIDD_UNIT_MASK;
const __m128i rangeMatch = _mm_cvtsi32_si128(0xffff0100);
- const __m128i offLimitMask = _mm_cmpestrm(rangeMatch, 2, chunk, 8, mode);
+ const __m128i offLimitMask = _mm_cmpestrm(rangeMatch, 2, chunk, 8,
+ _SIDD_UWORD_OPS | _SIDD_CMP_RANGES | _SIDD_UNIT_MASK);
// replace the non-Latin 1 characters in the chunk with question marks
chunk = _mm_blendv_epi8(chunk, questionMark, offLimitMask);