diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-10-04 00:42:24 +0200 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-10-04 00:44:18 +0200 |
commit | d8fc0da235b2bd566b2b6f1e21218afdf2f34eb3 (patch) | |
tree | c0ca819521ed6901a83ab476fa822a886691d806 /src/corelib | |
parent | 3649a6e61d823289d18be19387d7e3923dd90bd0 (diff) | |
parent | cdf0c5905b3477c6cd01c519f883b7bb55447120 (diff) |
Merge remote-tracking branch 'origin/stable' into dev
Conflicts:
src/plugins/platforms/minimal/qminimalintegration.cpp
src/plugins/platforms/offscreen/qoffscreenintegration.cpp
Change-Id: Ica85deeab5c5038ac004718e25194b1157343480
Diffstat (limited to 'src/corelib')
39 files changed, 423 insertions, 77 deletions
diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro index 65bffd87bd..1ed55bb0c8 100644 --- a/src/corelib/corelib.pro +++ b/src/corelib/corelib.pro @@ -47,9 +47,9 @@ mac|darwin { !ios { LIBS_PRIVATE += -framework ApplicationServices LIBS_PRIVATE += -framework CoreServices - LIBS_PRIVATE += -framework Foundation } LIBS_PRIVATE += -framework CoreFoundation + LIBS += -framework Foundation } win32:DEFINES-=QT_NO_CAST_TO_ASCII DEFINES += $$MODULE_DEFINES diff --git a/src/corelib/global/qfeatures.h b/src/corelib/global/qfeatures.h index ba84dd109e..17dd600265 100644 --- a/src/corelib/global/qfeatures.h +++ b/src/corelib/global/qfeatures.h @@ -279,11 +279,6 @@ #define QT_NO_DRAGANDDROP #endif -// QFileSystemModel -#if !defined(QT_NO_FILESYSTEMMODEL) && (defined(QT_NO_FILESYSTEMWATCHER)) -#define QT_NO_FILESYSTEMMODEL -#endif - // File Transfer Protocol #if !defined(QT_NO_FTP) && (defined(QT_NO_TEXTDATE)) #define QT_NO_FTP diff --git a/src/corelib/global/qfeatures.txt b/src/corelib/global/qfeatures.txt index 814e95c256..ec54c7bdbf 100644 --- a/src/corelib/global/qfeatures.txt +++ b/src/corelib/global/qfeatures.txt @@ -202,7 +202,7 @@ SeeAlso: ??? Feature: FILESYSTEMMODEL Description: Provides a data model for the local filesystem. Section: File I/O -Requires: FILESYSTEMWATCHER +Requires: Name: QFileSystemModel SeeAlso: ??? diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index c0709ce258..694935b326 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -869,6 +869,7 @@ static void android_default_message_handler(QtMsgType type, { android_LogPriority priority; switch (type) { + case QtTraceMsg: case QtDebugMsg: priority = ANDROID_LOG_DEBUG; break; case QtWarningMsg: priority = ANDROID_LOG_WARN; break; case QtCriticalMsg: priority = ANDROID_LOG_ERROR; break; diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index cd30533ff8..5af398c360 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -515,6 +515,14 @@ inline void QDirPrivate::initFileEngine() */ /*! + \fn QDir &QDir::operator=(QDir &&other) + + Move-assigns \a other to this QDir instance. + + \since 5.2 +*/ + +/*! \internal */ QDir::QDir(QDirPrivate &p) : d_ptr(&p) diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp index 1d5f16c9d9..d1b7ebac65 100644 --- a/src/corelib/io/qfileinfo.cpp +++ b/src/corelib/io/qfileinfo.cpp @@ -294,6 +294,14 @@ QDateTime &QFileInfoPrivate::getFileTime(QAbstractFileEngine::FileTime request) */ /*! + \fn QFileInfo &QFileInfo::operator=(QFileInfo &&other) + + Move-assigns \a other to this QFileInfo instance. + + \since 5.2 +*/ + +/*! \internal */ QFileInfo::QFileInfo(QFileInfoPrivate *p) : d_ptr(p) diff --git a/src/corelib/io/qfilesystemwatcher_win_p.h b/src/corelib/io/qfilesystemwatcher_win_p.h index 790fb954d9..20dfe433ec 100644 --- a/src/corelib/io/qfilesystemwatcher_win_p.h +++ b/src/corelib/io/qfilesystemwatcher_win_p.h @@ -168,8 +168,8 @@ Q_SIGNALS: void directoryChanged(const QString &path, bool removed); }; -#endif // QT_NO_FILESYSTEMWATCHER - QT_END_NAMESPACE +#endif // QT_NO_FILESYSTEMWATCHER + #endif // QFILESYSTEMWATCHER_WIN_P_H diff --git a/src/corelib/io/qloggingcategory.cpp b/src/corelib/io/qloggingcategory.cpp index 80acee6ad1..24eeb1584c 100644 --- a/src/corelib/io/qloggingcategory.cpp +++ b/src/corelib/io/qloggingcategory.cpp @@ -98,13 +98,28 @@ Q_GLOBAL_STATIC_WITH_ARGS(QLoggingCategory, qtDefaultCategory, */ /*! + \internal +*/ +typedef QVector<QTracer *> Tracers; + +/*! + \internal +*/ +class QLoggingCategoryPrivate +{ +public: + Tracers tracers; +}; + +/*! Constructs a QLoggingCategory object with the provided \a category name. The object becomes the local identifier for the category. If \a category is \c{0}, the category name is changed to \c{"default"}. */ QLoggingCategory::QLoggingCategory(const char *category) - : name(0), + : d(new QLoggingCategoryPrivate), + name(0), enabledDebug(false), enabledWarning(true), enabledCritical(true), @@ -133,6 +148,7 @@ QLoggingCategory::~QLoggingCategory() { if (QLoggingRegistry *reg = QLoggingRegistry::instance()) reg->unregisterCategory(this); + delete d; } /*! @@ -459,7 +475,7 @@ void QLoggingCategory::setFilterRules(const QString &rules) void QTracer::addToCategory(QLoggingCategory &category) { - category.tracers.append(this); + category.d->tracers.append(this); } /*! @@ -571,7 +587,7 @@ void QTracer::addToCategory(QLoggingCategory &category) void QTraceGuard::start() { - QLoggingCategory::Tracers &tracers = target->tracers; + const Tracers &tracers = target->d->tracers; for (int i = tracers.size(); --i >= 0; ) tracers.at(i)->start(); } @@ -584,7 +600,7 @@ void QTraceGuard::start() void QTraceGuard::end() { - QLoggingCategory::Tracers &tracers = target->tracers; + const Tracers &tracers = target->d->tracers; for (int i = tracers.size(); --i >= 0; ) tracers.at(i)->end(); } @@ -599,7 +615,7 @@ void QTraceGuard::end() QTraceGuard &QTraceGuard::operator<<(int msg) { - QLoggingCategory::Tracers &tracers = target->tracers; + const Tracers &tracers = target->d->tracers; for (int i = tracers.size(); --i >= 0; ) tracers.at(i)->record(msg); return *this; @@ -614,7 +630,7 @@ QTraceGuard &QTraceGuard::operator<<(int msg) QTraceGuard &QTraceGuard::operator<<(const char *msg) { - QLoggingCategory::Tracers &tracers = target->tracers; + const Tracers &tracers = target->d->tracers; for (int i = tracers.size(); --i >= 0; ) tracers.at(i)->record(msg); return *this; @@ -630,7 +646,7 @@ QTraceGuard &QTraceGuard::operator<<(const char *msg) QTraceGuard &QTraceGuard::operator<<(const QVariant &msg) { - QLoggingCategory::Tracers &tracers = target->tracers; + const Tracers &tracers = target->d->tracers; for (int i = tracers.size(); --i >= 0; ) tracers.at(i)->record(msg); return *this; diff --git a/src/corelib/io/qloggingcategory.h b/src/corelib/io/qloggingcategory.h index 23b25b5e3f..70192fef13 100644 --- a/src/corelib/io/qloggingcategory.h +++ b/src/corelib/io/qloggingcategory.h @@ -50,6 +50,7 @@ QT_BEGIN_NAMESPACE class QTracer; class QTraceGuard; +class QLoggingCategoryPrivate; class Q_CORE_EXPORT QLoggingCategory { @@ -80,18 +81,18 @@ public: static void setFilterRules(const QString &rules); private: + friend class QLoggingCategoryPrivate; friend class QLoggingRegistry; friend class QTraceGuard; friend class QTracer; + QLoggingCategoryPrivate *d; const char *name; bool enabledDebug; bool enabledWarning; bool enabledCritical; bool enabledTrace; - typedef QVector<QTracer *> Tracers; - Tracers tracers; }; template <> diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index 7f4d7f0313..fb86b053e9 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -854,8 +854,7 @@ void QProcessPrivate::cleanup() pid = 0; } if (processFinishedNotifier) { - processFinishedNotifier->setEnabled(false); - qDeleteInEventHandler(processFinishedNotifier); + delete processFinishedNotifier; processFinishedNotifier = 0; } @@ -865,33 +864,28 @@ void QProcessPrivate::cleanup() dying = false; if (stdoutChannel.notifier) { - stdoutChannel.notifier->setEnabled(false); - qDeleteInEventHandler(stdoutChannel.notifier); + delete stdoutChannel.notifier; stdoutChannel.notifier = 0; } if (stderrChannel.notifier) { - stderrChannel.notifier->setEnabled(false); - qDeleteInEventHandler(stderrChannel.notifier); + delete stderrChannel.notifier; stderrChannel.notifier = 0; } if (stdinChannel.notifier) { - stdinChannel.notifier->setEnabled(false); - qDeleteInEventHandler(stdinChannel.notifier); + delete stdinChannel.notifier; stdinChannel.notifier = 0; } if (startupSocketNotifier) { - startupSocketNotifier->setEnabled(false); - qDeleteInEventHandler(startupSocketNotifier); + delete startupSocketNotifier; startupSocketNotifier = 0; } if (deathNotifier) { - deathNotifier->setEnabled(false); - qDeleteInEventHandler(deathNotifier); + delete deathNotifier; deathNotifier = 0; } #ifdef Q_OS_WIN if (notifier) { - qDeleteInEventHandler(notifier); + delete notifier; notifier = 0; } #endif @@ -1161,12 +1155,8 @@ void QProcessPrivate::closeWriteChannel() qDebug("QProcessPrivate::closeWriteChannel()"); #endif if (stdinChannel.notifier) { - extern void qDeleteInEventHandler(QObject *o); - stdinChannel.notifier->setEnabled(false); - if (stdinChannel.notifier) { - qDeleteInEventHandler(stdinChannel.notifier); - stdinChannel.notifier = 0; - } + delete stdinChannel.notifier; + stdinChannel.notifier = 0; } #ifdef Q_OS_WIN // ### Find a better fix, feeding the process little by little diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp index 291ea319ec..dba9f62b98 100644 --- a/src/corelib/io/qprocess_win.cpp +++ b/src/corelib/io/qprocess_win.cpp @@ -654,11 +654,11 @@ bool QProcessPrivate::drainOutputPipes() bool readOperationActive = false; if (stdoutReader) { readyReadEmitted |= stdoutReader->waitForReadyRead(0); - readOperationActive = stdoutReader->isReadOperationActive(); + readOperationActive = stdoutReader && stdoutReader->isReadOperationActive(); } if (stderrReader) { readyReadEmitted |= stderrReader->waitForReadyRead(0); - readOperationActive |= stderrReader->isReadOperationActive(); + readOperationActive |= stderrReader && stderrReader->isReadOperationActive(); } someReadyReadEmitted |= readyReadEmitted; if (!readOperationActive || !readyReadEmitted) diff --git a/src/corelib/io/qsettings_win.cpp b/src/corelib/io/qsettings_win.cpp index 9ce14f1851..1d410862f0 100644 --- a/src/corelib/io/qsettings_win.cpp +++ b/src/corelib/io/qsettings_win.cpp @@ -450,7 +450,7 @@ QWinSettingsPrivate::QWinSettingsPrivate(QString rPath) regList.append(RegistryKey(HKEY_CLASSES_ROOT, QString(), false)); else if (rPath.startsWith(QLatin1String("HKEY_USERS\\"))) regList.append(RegistryKey(HKEY_USERS, rPath.mid(11), false)); - else if (rPath == QLatin1String(QLatin1String("HKEY_USERS"))) + else if (rPath == QLatin1String("HKEY_USERS")) regList.append(RegistryKey(HKEY_USERS, QString(), false)); else regList.append(RegistryKey(HKEY_LOCAL_MACHINE, rPath, false)); diff --git a/src/corelib/io/qtemporarydir.cpp b/src/corelib/io/qtemporarydir.cpp index 755c31f371..f21403d7f1 100644 --- a/src/corelib/io/qtemporarydir.cpp +++ b/src/corelib/io/qtemporarydir.cpp @@ -299,7 +299,13 @@ bool QTemporaryDir::remove() Q_ASSERT(!path().isEmpty()); Q_ASSERT(path() != QLatin1String(".")); - return QDir(path()).removeRecursively(); + const bool result = QDir(path()).removeRecursively(); + if (!result) { + qWarning() << "QTemporaryDir: Unable to remove" + << QDir::toNativeSeparators(path()) + << "most likely due to the presence of read-only files."; + } + return result; } QT_END_NAMESPACE diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index 5535ae126a..d14add36a5 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -363,6 +363,23 @@ \sa QUrl::FormattingOptions */ +/*! + \fn QUrl::QUrl(QUrl &&other) + + Move-constructs a QUrl instance, making it point at the same + object that \a other was pointing to. + + \since 5.2 +*/ + +/*! + \fn QUrl &QUrl::operator=(QUrl &&other) + + Move-assigns \a other to this QUrl instance. + + \since 5.2 +*/ + #include "qurl.h" #include "qurl_p.h" #include "qplatformdefs.h" diff --git a/src/corelib/io/qurlquery.cpp b/src/corelib/io/qurlquery.cpp index f6b5cd44bd..f773af1433 100644 --- a/src/corelib/io/qurlquery.cpp +++ b/src/corelib/io/qurlquery.cpp @@ -139,6 +139,14 @@ QT_BEGIN_NAMESPACE \sa QUrl */ +/*! + \fn QUrlQuery &QUrlQuery::operator=(QUrlQuery &&other) + + Move-assigns \a other to this QUrlQuery instance. + + \since 5.2 +*/ + typedef QList<QPair<QString, QString> > Map; class QUrlQueryPrivate : public QSharedData diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp index 2ea560e611..2238902abc 100644 --- a/src/corelib/itemmodels/qabstractitemmodel.cpp +++ b/src/corelib/itemmodels/qabstractitemmodel.cpp @@ -107,6 +107,23 @@ void QPersistentModelIndexData::destroy(QPersistentModelIndexData *data) \sa {Model/View Programming}, QModelIndex, QAbstractItemModel */ +/*! + \fn QPersistentModelIndex::QPersistentModelIndex(QPersistentModelIndex &&other) + + Move-constructs a QPersistentModelIndex instance, making it point at the same + object that \a other was pointing to. + + \since 5.2 +*/ + +/*! + \fn QPersistentModelIndex &QPersistentModelIndex::operator=(QPersistentModelIndex &&other) + + Move-assigns \a other to this QPersistentModelIndex instance. + + \since 5.2 +*/ + /*! \fn QPersistentModelIndex::QPersistentModelIndex() diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 8617b17419..8ae3057f3e 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -54,6 +54,7 @@ #include <qfile.h> #include <qfileinfo.h> #include <qhash.h> +#include <qmutex.h> #include <private/qprocess_p.h> #include <qstandardpaths.h> #include <qtextcodec.h> diff --git a/src/corelib/kernel/qtimer.cpp b/src/corelib/kernel/qtimer.cpp index 667c490d31..71d8d99a91 100644 --- a/src/corelib/kernel/qtimer.cpp +++ b/src/corelib/kernel/qtimer.cpp @@ -103,18 +103,23 @@ QT_BEGIN_NAMESPACE \section1 Accuracy and Timer Resolution - Timers will never time out earlier than the specified timeout value - and they are not guaranteed to time out at the exact value specified. - In many situations, they may time out late by a period of time that - depends on the accuracy of the system timers. - The accuracy of timers depends on the underlying operating system and hardware. Most platforms support a resolution of 1 millisecond, though the accuracy of the timer will not equal this resolution in many real-world situations. - If Qt is unable to deliver the requested number of timer clicks, - it will silently discard some. + The accuracy also depends on the \l{Qt::TimerType}{timer type}. For + Qt::PreciseTimer, QTimer will try to keep the accurance at 1 millisecond. + Precise timers will also never time out earlier than expected. + + For Qt::CoarseTimer and Qt::VeryCoarseTimer types, QTimer may wake up + earlier than expected, within the margins for those types: 5% of the + interval for Qt::CoarseTimer and 500 ms for Qt::VeryCoarseTimer. + + All timer types may time out later than expected if the system is busy or + unable to provide the requested accuracy. In such a case of timeout + overrun, Qt will emit activated() only once, even if multiple timeouts have + expired, and then will resume the original interval. \section1 Alternatives to QTimer diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index 75e945a0cc..a7c0bd2321 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -1105,6 +1105,23 @@ Q_CORE_EXPORT void QVariantPrivate::registerHandler(const int /* Modules::Names */ /*! + \fn QVariant::QVariant(QVariant &&other) + + Move-constructs a QVariant instance, making it point at the same + object that \a other was pointing to. + + \since 5.2 +*/ + +/*! + \fn QVariant &QVariant::operator=(QVariant &&other) + + Move-assigns \a other to this QVariant instance. + + \since 5.2 +*/ + +/*! \fn QVariant::QVariant() Constructs an invalid variant. diff --git a/src/corelib/mimetypes/qmimetype.cpp b/src/corelib/mimetypes/qmimetype.cpp index 4dec1ab696..31237797df 100644 --- a/src/corelib/mimetypes/qmimetype.cpp +++ b/src/corelib/mimetypes/qmimetype.cpp @@ -109,6 +109,14 @@ void QMimeTypePrivate::addGlobPattern(const QString &pattern) */ /*! + \fn QMimeType &QMimeType::operator=(QMimeType &&other) + + Move-assigns \a other to this QMimeType instance. + + \since 5.2 +*/ + +/*! \fn QMimeType::QMimeType(); Constructs this QMimeType object initialized with default property values that indicate an invalid MIME type. */ diff --git a/src/corelib/tools/qbitarray.cpp b/src/corelib/tools/qbitarray.cpp index da2f48c071..4f1fce3077 100644 --- a/src/corelib/tools/qbitarray.cpp +++ b/src/corelib/tools/qbitarray.cpp @@ -110,6 +110,23 @@ QT_BEGIN_NAMESPACE \sa QByteArray, QVector */ +/*! + \fn QBitArray::QBitArray(QBitArray &&other) + + Move-constructs a QBitArray instance, making it point at the same + object that \a other was pointing to. + + \since 5.2 +*/ + +/*! + \fn QBitArray &QBitArray::operator=(QBitArray &&other) + + Move-assigns \a other to this QBitArray instance. + + \since 5.2 +*/ + /*! \fn QBitArray::QBitArray() Constructs an empty bit array. diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index 975894a516..92d0d30f54 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -910,6 +910,15 @@ static inline char qToLower(char c) \sa operator=() */ +/*! + \fn QByteArray::QByteArray(QByteArray &&other) + + Move-constructs a QByteArray instance, making it point at the same + object that \a other was pointing to. + + \since 5.2 +*/ + /*! \fn QByteArray::QByteArray(QByteArrayDataPtr dd) \internal @@ -965,6 +974,14 @@ QByteArray &QByteArray::operator=(const char *str) return *this; } +/*! + \fn QByteArray &QByteArray::operator=(QByteArray &&other) + + Move-assigns \a other to this QByteArray instance. + + \since 5.2 +*/ + /*! \fn void QByteArray::swap(QByteArray &other) \since 4.8 diff --git a/src/corelib/tools/qcommandlineoption.cpp b/src/corelib/tools/qcommandlineoption.cpp index b30f7d25b4..9827547c56 100644 --- a/src/corelib/tools/qcommandlineoption.cpp +++ b/src/corelib/tools/qcommandlineoption.cpp @@ -88,6 +88,14 @@ public: */ /*! + \fn QCommandLineOption &QCommandLineOption::operator=(QCommandLineOption &&other) + + Move-assigns \a other to this QCommandLineOption instance. + + \since 5.2 +*/ + +/*! Constructs a command line option object with the given arguments. The name of the option is set to \a name. diff --git a/src/corelib/tools/qcontiguouscache.cpp b/src/corelib/tools/qcontiguouscache.cpp index b92c4d3fe9..6ccdb7b771 100644 --- a/src/corelib/tools/qcontiguouscache.cpp +++ b/src/corelib/tools/qcontiguouscache.cpp @@ -202,6 +202,14 @@ MyRecord record(int row) const Assigns \a other to this cache and returns a reference to this cache. */ +/*! + \fn QContiguousCache<T> &QContiguousCache::operator=(QContiguousCache<T> &&other) + + Move-assigns \a other to this QContiguousCache instance. + + \since 5.2 +*/ + /*! \fn void QContiguousCache::swap(QContiguousCache<T> &other) \since 4.8 diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index d64d929d5a..4839560c51 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -2224,7 +2224,7 @@ static QString qt_tzname(QDateTimePrivate::DaylightStatus daylightStatus) #endif // Q_OS_WINCE } -// Calls the platform variant of mktime for the given date and time, +// Calls the platform variant of mktime for the given date, time and daylightStatus, // and updates the date, time, daylightStatus and abbreviation with the returned values // If the date falls outside the 1970 to 2037 range supported by mktime / time_t // then null date/time will be returned, you should adjust the date first if @@ -2288,7 +2288,10 @@ static qint64 qt_mktime(QDate *date, QTime *time, QDateTimePrivate::DaylightStat local.tm_year = yy - 1900; local.tm_wday = 0; local.tm_yday = 0; - local.tm_isdst = -1; + if (daylightStatus) + local.tm_isdst = int(*daylightStatus); + else + local.tm_isdst = -1; #if defined(Q_OS_WIN) int hh = local.tm_hour; #endif // Q_OS_WIN @@ -2481,7 +2484,7 @@ static bool epochMSecsToLocalTime(qint64 msecs, QDate *localDate, QTime *localTi // Convert a LocalTime expressed in local msecs encoding into a UTC epoch msecs // Optionally populate the returned values from mktime for the adjusted local -// date and time and daylight status +// date and time and daylight status. Uses daylightStatus in calculation if populated. static qint64 localMSecsToEpochMSecs(qint64 localMsecs, QDate *localDate = 0, QTime *localTime = 0, QDateTimePrivate::DaylightStatus *daylightStatus = 0, QString *abbreviation = 0, bool *ok = 0) @@ -2614,6 +2617,7 @@ void QDateTimePrivate::setTimeSpec(Qt::TimeSpec spec, int offsetSeconds) { clearValidDateTime(); clearTimeZoneCached(); + clearSetToDaylightStatus(); #ifndef QT_BOOTSTRAPPED m_timeZone = QTimeZone(); @@ -2688,6 +2692,30 @@ void QDateTimePrivate::getDateTime(QDate *date, QTime *time) const *time = QTime(); } +// Set the Daylight Status if LocalTime set via msecs +void QDateTimePrivate::setDaylightStatus(QDateTimePrivate::DaylightStatus status) +{ + if (status == DaylightTime) { + m_status = m_status & ~SetToStandardTime; + m_status = m_status | SetToDaylightTime; + } else if (status == StandardTime) { + m_status = m_status & ~SetToDaylightTime; + m_status = m_status | SetToStandardTime; + } else { + clearSetToDaylightStatus(); + } +} + +// Get the Daylight Status if LocalTime set via msecs +QDateTimePrivate::DaylightStatus QDateTimePrivate::daylightStatus() const +{ + if ((m_status & SetToDaylightTime) == SetToDaylightTime) + return DaylightTime; + if ((m_status & SetToStandardTime) == SetToStandardTime) + return StandardTime; + return UnknownDaylightTime; +} + // Check the UTC / offsetFromUTC validity void QDateTimePrivate::checkValidDateTime() { @@ -2748,12 +2776,14 @@ void QDateTimePrivate::refreshDateTime() QDate testDate; QTime testTime; qint64 epochMSecs = 0; + if (m_spec == Qt::LocalTime) { + DaylightStatus status = daylightStatus(); + epochMSecs = localMSecsToEpochMSecs(m_msecs, &testDate, &testTime, &status); #ifndef QT_BOOTSTRAPPED - if (m_spec == Qt::TimeZone) + } else { epochMSecs = zoneMSecsToEpochMSecs(m_msecs, m_timeZone, &testDate, &testTime); - else #endif // QT_BOOTSTRAPPED - epochMSecs = localMSecsToEpochMSecs(m_msecs, &testDate, &testTime); + } if (testDate == date && testTime == time) { setValidDateTime(); // Cache the offset to use in toMSecsSinceEpoch() @@ -3189,7 +3219,8 @@ QString QDateTime::timeZoneAbbreviation() const #endif // QT_BOOTSTRAPPED case Qt::LocalTime: { QString abbrev; - localMSecsToEpochMSecs(d->m_msecs, 0, 0, 0, &abbrev); + QDateTimePrivate::DaylightStatus status = d->daylightStatus(); + localMSecsToEpochMSecs(d->m_msecs, 0, 0, &status, &abbrev); return abbrev; } } @@ -3218,8 +3249,9 @@ bool QDateTime::isDaylightTime() const return d->m_timeZone.d->isDaylightTime(toMSecsSinceEpoch()); #endif // QT_BOOTSTRAPPED case Qt::LocalTime: { - QDateTimePrivate::DaylightStatus status; - localMSecsToEpochMSecs(d->m_msecs, 0, 0, &status, 0); + QDateTimePrivate::DaylightStatus status = d->daylightStatus(); + if (status == QDateTimePrivate::UnknownDaylightTime) + localMSecsToEpochMSecs(d->m_msecs, 0, 0, &status, 0); return (status == QDateTimePrivate::DaylightTime); } } @@ -3424,8 +3456,10 @@ void QDateTime::setMSecsSinceEpoch(qint64 msecs) case Qt::LocalTime: { QDate dt; QTime tm; - epochMSecsToLocalTime(msecs, &dt, &tm); + QDateTimePrivate::DaylightStatus status; + epochMSecsToLocalTime(msecs, &dt, &tm, &status); d->setDateTime(dt, tm); + d->setDaylightStatus(status); break; } } diff --git a/src/corelib/tools/qdatetime_p.h b/src/corelib/tools/qdatetime_p.h index f52108d764..70771844d6 100644 --- a/src/corelib/tools/qdatetime_p.h +++ b/src/corelib/tools/qdatetime_p.h @@ -77,10 +77,10 @@ public: // Daylight Time Status enum DaylightStatus { - NoDaylightTime, - UnknownDaylightTime, - StandardTime, - DaylightTime + NoDaylightTime = -2, + UnknownDaylightTime = -1, + StandardTime = 0, + DaylightTime = 1 }; // Status of date/time @@ -90,7 +90,9 @@ public: ValidDate = 0x04, ValidTime = 0x08, ValidDateTime = 0x10, - TimeZoneCached = 0x20 + TimeZoneCached = 0x20, + SetToStandardTime = 0x40, + SetToDaylightTime = 0x80 }; Q_DECLARE_FLAGS(StatusFlags, StatusFlag) @@ -129,6 +131,9 @@ public: void setDateTime(const QDate &date, const QTime &time); void getDateTime(QDate *date, QTime *time) const; + void setDaylightStatus(DaylightStatus status); + DaylightStatus daylightStatus() const; + // Returns msecs since epoch, assumes offset value is current inline qint64 toMSecsSinceEpoch() const { return (m_msecs - (m_offsetFromUtc * 1000)); } @@ -146,6 +151,7 @@ public: inline bool isTimeZoneCached() const { return (m_status & TimeZoneCached) == TimeZoneCached; } inline void setTimeZoneCached() { m_status = m_status | TimeZoneCached; } inline void clearTimeZoneCached() { m_status = m_status & ~TimeZoneCached; } + inline void clearSetToDaylightStatus() { m_status = m_status & ~SetToStandardTime & ~SetToDaylightTime; } #ifndef QT_BOOTSTRAPPED static qint64 zoneMSecsToEpochMSecs(qint64 msecs, const QTimeZone &zone, diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp index 23451f095c..fc9a1ca867 100644 --- a/src/corelib/tools/qeasingcurve.cpp +++ b/src/corelib/tools/qeasingcurve.cpp @@ -1066,6 +1066,15 @@ static QEasingCurveFunction *curveToFunctionObject(QEasingCurve::Type type) } /*! + \fn QEasingCurve::QEasingCurve(QEasingCurve &&other) + + Move-constructs a QEasingCurve instance, making it point at the same + object that \a other was pointing to. + + \since 5.2 +*/ + +/*! Constructs an easing curve of the given \a type. */ QEasingCurve::QEasingCurve(Type type) @@ -1098,6 +1107,14 @@ QEasingCurve::~QEasingCurve() */ /*! + \fn QEasingCurve &QEasingCurve::operator=(QEasingCurve &&other) + + Move-assigns \a other to this QEasingCurve instance. + + \since 5.2 +*/ + +/*! \fn void QEasingCurve::swap(QEasingCurve &other) \since 5.0 diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp index 4b9d120bb3..b6257c8907 100644 --- a/src/corelib/tools/qhash.cpp +++ b/src/corelib/tools/qhash.cpp @@ -941,6 +941,15 @@ void QHashData::checkSanity() \sa clear() */ +/*! + \fn QHash::QHash(QHash<Key, T> &&other) + + Move-constructs a QHash instance, making it point at the same + object that \a other was pointing to. + + \since 5.2 +*/ + /*! \fn QHash::QHash(std::initializer_list<std::pair<Key,T> > list) \since 5.1 @@ -974,6 +983,14 @@ void QHashData::checkSanity() Assigns \a other to this hash and returns a reference to this hash. */ +/*! + \fn QHash<Key, T> &QHash::operator=(QHash<Key, T> &&other) + + Move-assigns \a other to this QHash instance. + + \since 5.2 +*/ + /*! \fn void QHash::swap(QHash<Key, T> &other) \since 4.8 diff --git a/src/corelib/tools/qlinkedlist.cpp b/src/corelib/tools/qlinkedlist.cpp index 6e7a7a2635..c6e79c02a3 100644 --- a/src/corelib/tools/qlinkedlist.cpp +++ b/src/corelib/tools/qlinkedlist.cpp @@ -125,6 +125,15 @@ const QLinkedListData QLinkedListData::shared_null = { Constructs an empty list. */ +/*! + \fn QLinkedList::QLinkedList(QLinkedList<T> &&other) + + Move-constructs a QLinkedList instance, making it point at the same + object that \a other was pointing to. + + \since 5.2 +*/ + /*! \fn QLinkedList::QLinkedList(const QLinkedList<T> &other) Constructs a copy of \a other. @@ -740,6 +749,14 @@ const QLinkedListData QLinkedListData::shared_null = { Assigns \a other to this iterator. */ +/*! + \fn QLinkedList<T> &QLinkedList::operator=(QLinkedList<T> &&other) + + Move-assigns \a other to this QLinkedList instance. + + \since 5.2 +*/ + /*! \fn T &QLinkedList::iterator::operator*() const Returns a modifiable reference to the current item. diff --git a/src/corelib/tools/qlist.cpp b/src/corelib/tools/qlist.cpp index 760c944c29..4770054d79 100644 --- a/src/corelib/tools/qlist.cpp +++ b/src/corelib/tools/qlist.cpp @@ -480,6 +480,15 @@ void **QListData::erase(void **xi) */ /*! + \fn QList::QList(QList<T> &&other) + + Move-constructs a QList instance, making it point at the same + object that \a other was pointing to. + + \since 5.2 +*/ + +/*! \fn QList<T> QList<T>::mid(int pos, int length) const Returns a list whose elements are copied from this list, @@ -527,6 +536,14 @@ void **QListData::erase(void **xi) list. */ +/*! + \fn QList &QList::operator=(QList<T> &&other) + + Move-assigns \a other to this QList instance. + + \since 5.2 +*/ + /*! \fn void QList::swap(QList<T> &other) \since 4.8 diff --git a/src/corelib/tools/qmap.cpp b/src/corelib/tools/qmap.cpp index 71b90bcada..01a6a22631 100644 --- a/src/corelib/tools/qmap.cpp +++ b/src/corelib/tools/qmap.cpp @@ -516,6 +516,15 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa clear() */ +/*! + \fn QMap::QMap(QMap<Key, T> &&other) + + Move-constructs a QMap instance, making it point at the same + object that \a other was pointing to. + + \since 5.2 +*/ + /*! \fn QMap::QMap(const QMap<Key, T> &other) Constructs a copy of \a other. @@ -567,6 +576,14 @@ void QMapDataBase::freeData(QMapDataBase *d) Assigns \a other to this map and returns a reference to this map. */ +/*! + \fn QMap<Key, T> &QMap::operator=(QMap<Key, T> &&other) + + Move-assigns \a other to this QMap instance. + + \since 5.2 +*/ + /*! \fn void QMap::swap(QMap<Key, T> &other) \since 4.8 diff --git a/src/corelib/tools/qregexp.cpp b/src/corelib/tools/qregexp.cpp index ef2dba5700..5debb1a238 100644 --- a/src/corelib/tools/qregexp.cpp +++ b/src/corelib/tools/qregexp.cpp @@ -4013,6 +4013,14 @@ QRegExp &QRegExp::operator=(const QRegExp &rx) } /*! + \fn QRegExp &QRegExp::operator=(QRegExp &&other) + + Move-assigns \a other to this QRegExp instance. + + \since 5.2 +*/ + +/*! \fn void QRegExp::swap(QRegExp &other) \since 4.8 diff --git a/src/corelib/tools/qscopedpointer.cpp b/src/corelib/tools/qscopedpointer.cpp index fb0025c1ff..e0c369ecad 100644 --- a/src/corelib/tools/qscopedpointer.cpp +++ b/src/corelib/tools/qscopedpointer.cpp @@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE QScopedPointer guarantees that the object pointed to will get deleted when the current scope disappears. - Consider this function which does heap allocations, and have various exit points: + Consider this function which does heap allocations, and has various exit points: \snippet code/src_corelib_tools_qscopedpointer.cpp 0 diff --git a/src/corelib/tools/qshareddata.cpp b/src/corelib/tools/qshareddata.cpp index cee0c1d450..0afda357a6 100644 --- a/src/corelib/tools/qshareddata.cpp +++ b/src/corelib/tools/qshareddata.cpp @@ -306,6 +306,14 @@ QT_BEGIN_NAMESPACE data pointer in \a other. */ +/*! + \fn QSharedDataPointer<T> &QSharedDataPointer::operator=(QSharedDataPointer<T> &&other) + + Move-assigns \a other to this QSharedDataPointer instance. + + \since 5.2 +*/ + /*! \fn bool QSharedDataPointer::operator==(const QSharedDataPointer<T>& other) const Returns true if \a other and \e this have the same \e{d pointer}. This function does \e not call detach(). @@ -320,6 +328,15 @@ QT_BEGIN_NAMESPACE Constructs a QSharedDataPointer initialized with a null \e{d pointer}. */ +/*! + \fn QSharedDataPointer::QSharedDataPointer(QSharedDataPointer &&o) + + Move-constructs a QSharedDataPointer instance, making it point at the same + object that \a o was pointing to. + + \since 5.2 +*/ + /*! \fn QSharedDataPointer::~QSharedDataPointer() Decrements the reference count of the shared data object. If the reference count becomes 0, the shared data object @@ -465,6 +482,14 @@ QT_BEGIN_NAMESPACE Returns true if \a other and \e this have the same \e{d pointer}. */ +/*! + \fn QExplicitlySharedDataPointer<T> &QExplicitlySharedDataPointer::operator=(QExplicitlySharedDataPointer<T> &&other) + + Move-assigns \a other to this QExplicitlySharedDataPointer instance. + + \since 5.2 +*/ + /*! \fn bool QExplicitlySharedDataPointer::operator==(const T* ptr) const Returns true if the \e{d pointer} of \e this is \a ptr. */ @@ -489,6 +514,15 @@ QT_BEGIN_NAMESPACE is deleted. \e This is then destroyed. */ +/*! + \fn QExplicitlySharedDataPointer::QExplicitlySharedDataPointer(QExplicitlySharedDataPointer &&o) + + Move-constructs a QExplicitlySharedDataPointer instance, making it point at the same + object that \a o was pointing to. + + \since 5.2 +*/ + /*! \fn QExplicitlySharedDataPointer::QExplicitlySharedDataPointer(T* sharedData) Constructs a QExplicitlySharedDataPointer with \e{d pointer} set to \a sharedData and increments \a{sharedData}'s reference diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 239cf0446a..1ba9e81b59 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -929,6 +929,15 @@ const QString::Null QString::null = { }; \sa isEmpty() */ +/*! + \fn QString::QString(QString &&other) + + Move-constructs a QString instance, making it point at the same + object that \a other was pointing to. + + \since 5.2 +*/ + /*! \fn QString::QString(const char *str) Constructs a string initialized with the 8-bit string \a str. The @@ -1349,6 +1358,13 @@ QString &QString::operator=(const QString &other) return *this; } +/*! + \fn QString &QString::operator=(QString &&other) + + Move-assigns \a other to this QString instance. + + \since 5.2 +*/ /*! \fn QString &QString::operator=(QLatin1String str) diff --git a/src/corelib/tools/qtimezone.cpp b/src/corelib/tools/qtimezone.cpp index 890798b421..860ad180f1 100644 --- a/src/corelib/tools/qtimezone.cpp +++ b/src/corelib/tools/qtimezone.cpp @@ -425,6 +425,15 @@ QTimeZone &QTimeZone::operator=(const QTimeZone &other) } /*! + \fn QTimeZone &QTimeZone::operator=(QTimeZone &&other) + + Move-assigns \a other to this QTimeZone instance, transferring the + ownership of the managed pointer to this instance. + + \since 5.2 +*/ + +/*! Returns true if this time zone is equal to the \a other time zone. */ diff --git a/src/corelib/tools/qtimezoneprivate_win.cpp b/src/corelib/tools/qtimezoneprivate_win.cpp index 51300c0cad..c219a49e1e 100644 --- a/src/corelib/tools/qtimezoneprivate_win.cpp +++ b/src/corelib/tools/qtimezoneprivate_win.cpp @@ -106,17 +106,6 @@ static QDate msecsToDate(qint64 msecs) return QDate::fromJulianDay(jd); } -static SYSTEMTIME msecsToSystemtime(qint64 forMSecsSinceEpoch) -{ - FILETIME utcFileTime; - ULONGLONG nsecs = (forMSecsSinceEpoch * 10000 ) + FILETIME_UNIX_EPOCH; - utcFileTime.dwLowDateTime = (DWORD) (nsecs & 0xFFFFFFFF); - utcFileTime.dwHighDateTime = (DWORD) (nsecs >> 32); - SYSTEMTIME utcTime; - FileTimeToSystemTime(&utcFileTime, &utcTime); - return utcTime; -} - static qint64 systemtimeToMsecs(const SYSTEMTIME &systemtime) { FILETIME utcFileTime; diff --git a/src/corelib/tools/qvarlengtharray.qdoc b/src/corelib/tools/qvarlengtharray.qdoc index 93aa5e993e..4452bcf1cd 100644 --- a/src/corelib/tools/qvarlengtharray.qdoc +++ b/src/corelib/tools/qvarlengtharray.qdoc @@ -70,8 +70,8 @@ structure. The main differences between the two classes are: \list - \li QVarLengthArray's API is much more low-level. It provides no - iterators and lacks much of QVector's functionality. + \li QVarLengthArray's API is much more low-level and it lacks + some of QVector's functionality. \li QVarLengthArray doesn't initialize the memory if the value is a basic type. (QVector always does.) diff --git a/src/corelib/tools/qvector.cpp b/src/corelib/tools/qvector.cpp index a443a6b4e8..8982e797d9 100644 --- a/src/corelib/tools/qvector.cpp +++ b/src/corelib/tools/qvector.cpp @@ -195,6 +195,15 @@ \sa resize() */ +/*! + \fn QVector::QVector(QVector<T> &&other) + + Move-constructs a QVector instance, making it point at the same + object that \a other was pointing to. + + \since 5.2 +*/ + /*! \fn QVector::QVector(int size) Constructs a vector with an initial size of \a size elements. @@ -246,6 +255,14 @@ vector. */ +/*! + \fn QVector<T> &QVector::operator=(QVector<T> &&other) + + Move-assigns \a other to this QVector instance. + + \since 5.2 +*/ + /*! \fn void QVector::swap(QVector<T> &other) \since 4.8 |