Merge "Merge remote-tracking branch 'origin/stable' into dev" into refs/staging/dev

This commit is contained in:
Sergio Ahumada 2013-10-09 15:50:11 +02:00 committed by The Qt Project
commit da0cb32b8e
151 changed files with 1680 additions and 700 deletions

9
dist/changes-5.2.0 vendored
View File

@ -75,3 +75,12 @@ QtCore
- qUpperBound (std::upper_bound)
- qLess (std::less)
- qGreater (std::greater)
QtGui
-----
- [QTBUG-28228] Session Management:
The new QPlatformSessionManager class brings back the session management
functionality. It allows the implementation of platform specific behavior
related to session management. For platform that don't support this
feature the default behavior has not changed.
Both X11 and Windows session management are supported.

View File

@ -72,6 +72,7 @@ Cpp.ignoretokens += \
Q_TESTLIB_EXPORT \
Q_TYPENAME \
Q_WIDGETS_EXPORT \
Q_WINEXTRAS_EXPORT \
Q_XML_EXPORT \
Q_XMLPATTERNS_EXPORT \
Q_XMLSTREAM_EXPORT \

View File

@ -1,6 +1,15 @@
equals(TEMPLATE, app) {
qt:app_bundle:!macx-xcode {
# If the application uses Qt, it needs to be an application bundle
# to be able to deploy and run on iOS. The only exception to this
# is if you're working with a jailbroken device and can run the
# resulting binary from the console/over SSH, but that's not a
# use-case we care about, so no need to complicate the logic.
qt: CONFIG *= app_bundle
# Application bundles require building through Xcode
app_bundle:!macx-xcode {
# For Qt applications we want Xcode project files as the generated output,
# but since qmake doesn't handle the transition between makefiles and Xcode
# project files (which happens when using subdirs), we create a wrapper

View File

@ -1,5 +1,8 @@
equals(TEMPLATE, app):contains(QT, gui(-private)?) {
!macx-xcode: \
error("Linking the iOS platform plugin requires bulding through Xcode")
LIBS *= -L$$[QT_INSTALL_PLUGINS/get]/platforms
lib_name = qios

View File

@ -912,9 +912,10 @@ static inline QString toString(debugOption option)
{
switch (option) {
case debugUnknown:
case debugDisabled:
case debugLineInfoOnly:
break;
case debugDisabled:
return "None";
case debugOldStyleInfo:
return "OldStyle";
case debugEditAndContinue:

View File

@ -141,26 +141,31 @@ public class QtActivityDelegate
}
}
// case status
private final int ImhNoAutoUppercase = 0x2;
private final int ImhPreferUppercase = 0x8;
@SuppressWarnings("unused")
private final int ImhPreferLowercase = 0x10;
private final int ImhUppercaseOnly = 0x40000;
private final int ImhLowercaseOnly = 0x80000;
// options
private final int ImhNoPredictiveText = 0x20;
// layout
// input method hints - must be kept in sync with QTDIR/src/corelib/global/qnamespace.h
private final int ImhHiddenText = 0x1;
private final int ImhPreferNumbers = 0x4;
private final int ImhSensitiveData = 0x2;
private final int ImhNoAutoUppercase = 0x4;
private final int ImhPreferNumbers = 0x8;
private final int ImhPreferUppercase = 0x10;
private final int ImhPreferLowercase = 0x20;
private final int ImhNoPredictiveText = 0x40;
private final int ImhDate = 0x80;
private final int ImhTime = 0x100;
private final int ImhPreferLatin = 0x200;
private final int ImhMultiLine = 0x400;
private final int ImhDigitsOnly = 0x10000;
private final int ImhFormattedNumbersOnly = 0x20000;
private final int ImhUppercaseOnly = 0x40000;
private final int ImhLowercaseOnly = 0x80000;
private final int ImhDialableCharactersOnly = 0x100000;
private final int ImhEmailCharactersOnly = 0x200000;
private final int ImhUrlCharactersOnly = 0x400000;
private final int ImhLatinOnly = 0x800000;
// application state
private final int ApplicationSuspended = 0x0;

View File

@ -297,8 +297,8 @@ public class QtNative
if (action == MotionEvent.ACTION_MOVE) {
int hsz = event.getHistorySize();
if (hsz > 0) {
if (Math.abs(event.getX(index) - event.getHistoricalX(index, hsz-1)) > 1
|| Math.abs(event.getY(index) - event.getHistoricalY(index, hsz-1)) > 1) {
if (event.getX(index) != event.getHistoricalX(index, hsz-1)
|| event.getY(index) != event.getHistoricalY(index, hsz-1)) {
return 1;
} else {
return 2;

View File

@ -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

View File

@ -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

View File

@ -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: ???

View File

@ -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;

View File

@ -514,6 +514,14 @@ inline void QDirPrivate::initFileEngine()
\sa QFileInfo, QFile, QFileDialog, QCoreApplication::applicationDirPath(), {Find Files Example}
*/
/*!
\fn QDir &QDir::operator=(QDir &&other)
Move-assigns \a other to this QDir instance.
\since 5.2
*/
/*!
\internal
*/

View File

@ -293,6 +293,14 @@ QDateTime &QFileInfoPrivate::getFileTime(QAbstractFileEngine::FileTime request)
\sa QDir, QFile
*/
/*!
\fn QFileInfo &QFileInfo::operator=(QFileInfo &&other)
Move-assigns \a other to this QFileInfo instance.
\since 5.2
*/
/*!
\internal
*/

View File

@ -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

View File

@ -97,6 +97,20 @@ Q_GLOBAL_STATIC_WITH_ARGS(QLoggingCategory, qtDefaultCategory,
configure categories globally.
*/
/*!
\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.
@ -104,7 +118,8 @@ Q_GLOBAL_STATIC_WITH_ARGS(QLoggingCategory, qtDefaultCategory,
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;

View File

@ -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 <>

View File

@ -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

View File

@ -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)

View File

@ -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));

View File

@ -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

View File

@ -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"

View File

@ -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

View File

@ -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()

View File

@ -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>

View File

@ -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

View File

@ -1104,6 +1104,23 @@ Q_CORE_EXPORT void QVariantPrivate::registerHandler(const int /* Modules::Names
\omitvalue LastType
*/
/*!
\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()

View File

@ -108,6 +108,14 @@ void QMimeTypePrivate::addGlobPattern(const QString &pattern)
\sa QMimeDatabase
*/
/*!
\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.

View File

@ -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.

View File

@ -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

View File

@ -87,6 +87,14 @@ public:
\sa QCommandLineParser
*/
/*!
\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.

View File

@ -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

View File

@ -2227,7 +2227,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
@ -2291,7 +2291,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
@ -2484,7 +2487,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)
@ -2617,6 +2620,7 @@ void QDateTimePrivate::setTimeSpec(Qt::TimeSpec spec, int offsetSeconds)
{
clearValidDateTime();
clearTimeZoneCached();
clearSetToDaylightStatus();
#ifndef QT_BOOTSTRAPPED
m_timeZone = QTimeZone();
@ -2691,6 +2695,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()
{
@ -2751,12 +2779,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()
@ -3192,7 +3222,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;
}
}
@ -3221,8 +3252,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);
}
}
@ -3427,8 +3459,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;
}
}

View File

@ -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,

View File

@ -1065,6 +1065,15 @@ static QEasingCurveFunction *curveToFunctionObject(QEasingCurve::Type type)
return curveFunc;
}
/*!
\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.
*/
@ -1097,6 +1106,14 @@ QEasingCurve::~QEasingCurve()
Copy \a other.
*/
/*!
\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

View File

@ -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

View File

@ -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.

View File

@ -479,6 +479,15 @@ void **QListData::erase(void **xi)
\sa QListIterator, QMutableListIterator, QLinkedList, QVector
*/
/*!
\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
@ -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

View File

@ -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

View File

@ -4012,6 +4012,14 @@ QRegExp &QRegExp::operator=(const QRegExp &rx)
return *this;
}
/*!
\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

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -424,6 +424,15 @@ QTimeZone &QTimeZone::operator=(const QTimeZone &other)
return *this;
}
/*!
\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.
*/

View File

@ -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;

View File

@ -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.)

View File

@ -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

View File

@ -103,7 +103,7 @@ static bool parseAnnotation(const QXmlStreamReader &xml, QDBusIntrospection::Ann
annotations.insert(name, value);
if (!interfaceAnnotation)
ifaceData->introspection += QLatin1String(" ");
ifaceData->introspection += QLatin1String(" <annotation value=\"") + value + QLatin1String("\" name=\"") + name + QLatin1String("\"/>\n");
ifaceData->introspection += QLatin1String(" <annotation value=\"") + value.toHtmlEscaped() + QLatin1String("\" name=\"") + name + QLatin1String("\"/>\n");
return true;
}

View File

@ -107,79 +107,20 @@ void updateAllWidgets()
//! [6]
int main(int argc, char *argv[])
{
QApplication::setDesktopSettingsAware(false);
QApplication app(argc, argv);
...
return app.exec();
}
//! [6]
//! [7]
if ((startPos - currentPos).manhattanLength() >=
QApplication::startDragDistance())
startTheDrag();
//! [6]
//! [7]
QWidget *widget = qApp->widgetAt(x, y);
if (widget)
widget = widget->window();
//! [7]
//! [8]
void MyApplication::commitData(QSessionManager& manager)
{
if (manager.allowsInteraction()) {
int ret = QMessageBox::warning(
mainWindow,
tr("My Application"),
tr("Save changes to document?"),
QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
switch (ret) {
case QMessageBox::Save:
manager.release();
if (!saveDocument())
manager.cancel();
break;
case QMessageBox::Discard:
break;
case QMessageBox::Cancel:
default:
manager.cancel();
}
} else {
// we did not get permission to interact, then
// do something reasonable instead
}
}
//! [8]
//! [9]
appname -session id
//! [9]
//! [10]
foreach (const QString &command, mySession.restartCommand())
do_something(command);
//! [10]
//! [11]
foreach (const QString &command, mySession.discardCommand())
do_something(command);
//! [11]
//! [12]
QWidget *widget = qApp->widgetAt(x, y);
if (widget)
widget = widget->window();
//! [12]
//! [13]
QWidget *widget = qApp->widgetAt(point);
if (widget)
widget = widget->window();
//! [13]
//! [8]

View File

@ -0,0 +1,102 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
** of its contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
//! [0]
int main(int argc, char *argv[])
{
QApplication::setDesktopSettingsAware(false);
QApplication app(argc, argv);
...
return app.exec();
}
//! [0]
//! [1]
MyMainWidget::MyMainWidget(QWidget *parent)
:QWidget(parent)
{
connect(qApp, SIGNAL(commitDataRequest(QSessionManager)), SLOT(commitData(QSessionManager)));
}
void MyMainWidget::commitData(QSessionManager& manager)
{
if (manager.allowsInteraction()) {
int ret = QMessageBox::warning(
mainWindow,
tr("My Application"),
tr("Save changes to document?"),
QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
switch (ret) {
case QMessageBox::Save:
manager.release();
if (!saveDocument())
manager.cancel();
break;
case QMessageBox::Discard:
break;
case QMessageBox::Cancel:
default:
manager.cancel();
}
} else {
// we did not get permission to interact, then
// do something reasonable instead
}
}
//! [1]
//! [2]
appname -session id
//! [2]
//! [3]
foreach (const QString &command, mySession.restartCommand())
do_something(command);
//! [3]
//! [4]
foreach (const QString &command, mySession.discardCommand())
do_something(command);
//! [4]

View File

@ -643,6 +643,14 @@ QIcon &QIcon::operator=(const QIcon &other)
return *this;
}
/*!
\fn QIcon &QIcon::operator=(QIcon &&other)
Move-assigns \a other to this QIcon instance.
\since 5.2
*/
/*!
\fn void QIcon::swap(QIcon &other)
\since 4.8

View File

@ -601,6 +601,23 @@ bool QImageData::checkForAlphaPixels() const
{Image Viewer Example}, {Scribble Example}, {Pixelator Example}
*/
/*!
\fn QImage::QImage(QImage &&other)
Move-constructs a QImage instance, making it point at the same
object that \a other was pointing to.
\since 5.2
*/
/*!
\fn QImage &operator=(QImage &&other)
Move-assigns \a other to this QImage instance.
\since 5.2
*/
/*!
\typedef QImageCleanupFunction
\relates QImage

View File

@ -109,6 +109,14 @@ void qt_format_text(const QFont &fnt, const QRectF &_r,
\sa QMovie
*/
/*!
\fn QPicture &QPicture::operator=(QPicture &&other)
Move-assigns \a other to this QPicture instance.
\since 5.2
*/
const char *qt_mfhdr_tag = "QPIC"; // header tag
static const quint16 mfhdr_maj = 11; // major version #
static const quint16 mfhdr_min = 0; // minor version #

View File

@ -391,6 +391,14 @@ QPixmap &QPixmap::operator=(const QPixmap &pixmap)
return *this;
}
/*!
\fn QPixmap &QPixmap::operator=(QPixmap &&other)
Move-assigns \a other to this QPixmap instance.
\since 5.2
*/
/*!
\fn void QPixmap::swap(QPixmap &other)
\since 4.8

View File

@ -153,6 +153,14 @@ QT_BEGIN_NAMESPACE
\sa QWidget, {fowler}{GUI Design Handbook: Cursors}
*/
/*!
\fn QCursor &QCursor::operator=(QCursor &&other)
Move-assigns \a other to this QCursor instance.
\since 5.2
*/
/*!
\fn QPoint QCursor::pos(const QScreen *screen)

View File

@ -1029,27 +1029,23 @@ void QGuiApplicationPrivate::createPlatformIntegration()
}
/*!
Called from QCoreApplication::init()
Responsible for creating an event dispatcher when QCoreApplication
decides that it needs one (because a custom one has not been set).
*/
void QGuiApplicationPrivate::createEventDispatcher()
{
Q_ASSERT(!eventDispatcher);
if (platform_integration == 0)
createPlatformIntegration();
if (!eventDispatcher) {
QAbstractEventDispatcher *eventDispatcher = platform_integration->guiThreadEventDispatcher();
setEventDispatcher(eventDispatcher);
}
}
void QGuiApplicationPrivate::setEventDispatcher(QAbstractEventDispatcher *eventDispatcher)
{
Q_Q(QGuiApplication);
if (!QCoreApplicationPrivate::eventDispatcher) {
QCoreApplicationPrivate::eventDispatcher = eventDispatcher;
QCoreApplicationPrivate::eventDispatcher->setParent(q);
threadData->eventDispatcher = eventDispatcher;
}
// The platform integration should not mess with the event dispatcher
Q_ASSERT(!eventDispatcher);
eventDispatcher = platform_integration->createEventDispatcher();
}
#if defined(QT_DEBUG) && defined(Q_OS_LINUX)
@ -2942,7 +2938,7 @@ static inline void applyWindowCursor(const QList<QWindow *> &l)
restoreOverrideCursor(), otherwise the stack will never be emptied.
Example:
\snippet code/src_gui_kernel_qapplication_x11.cpp 0
\snippet code/src_gui_kernel_qguiapplication_x11.cpp 0
\sa overrideCursor(), restoreOverrideCursor(), changeOverrideCursor(),
QWidget::setCursor()
@ -3002,7 +2998,7 @@ QStyleHints *QGuiApplication::styleHints()
This function must be called before creating the QGuiApplication object, like
this:
\snippet code/src_gui_kernel_qapplication.cpp 6
\snippet code/src_gui_kernel_qguiapplication.cpp 0
\sa desktopSettingsAware()
*/

View File

@ -83,8 +83,7 @@ public:
~QGuiApplicationPrivate();
void createPlatformIntegration();
void createEventDispatcher();
void setEventDispatcher(QAbstractEventDispatcher *eventDispatcher);
void createEventDispatcher() Q_DECL_OVERRIDE;
virtual void notifyLayoutDirectionChange();
virtual void notifyActiveWindowChange(QWindow *previous);

View File

@ -732,6 +732,14 @@ static const struct {
\value FullScreen Toggle the window state to/from full screen.
*/
/*!
\fn QKeySequence &QKeySequence::operator=(QKeySequence &&other)
Move-assigns \a other to this QKeySequence instance.
\since 5.2
*/
/*!
\since 4.2

View File

@ -89,6 +89,14 @@ static void qt_palette_from_color(QPalette &pal, const QColor &button)
whiteBrush, buttonBrush, buttonBrush);
}
/*!
\fn QPalette &QPalette::operator=(QPalette &&other)
Move-assigns \a other to this QPalette instance.
\since 5.2
*/
/*!
\fn const QColor &QPalette::color(ColorRole role) const

View File

@ -231,17 +231,23 @@ QPlatformServices *QPlatformIntegration::services() const
are never repositioned by the window manager. The default implementation returns true.
*/
/*!
\fn QAbstractEventDispatcher *QPlatformIntegration::guiThreadEventDispatcher() const = 0
\fn QAbstractEventDispatcher *QPlatformIntegration::createEventDispatcher() const = 0
Accessor function for the event dispatcher. The platform plugin should create
an instance of the QAbstractEventDispatcher in its constructor and set it
on the application using QGuiApplicationPrivate::instance()->setEventDispatcher().
The event dispatcher is owned by QGuiApplication, the accessor should return
a flat pointer.
\sa QGuiApplicationPrivate
Factory function for the GUI event dispatcher. The platform plugin should create
and return a QAbstractEventDispatcher subclass when this function is called.
If the platform plugin for some reason creates the event dispatcher outside of
this function (for example in the constructor), it needs to handle the case
where this function is never called, ensuring that the event dispatcher is
still deleted at some point (typically in the destructor).
Note that the platform plugin should never explicitly set the event dispatcher
itself, using QCoreApplication::setEventDispatcher(), but let QCoreApplication
decide when and which event dispatcher to create.
\since 5.2
*/
bool QPlatformIntegration::hasCapability(Capability cap) const

View File

@ -111,7 +111,7 @@ public:
virtual QPaintEngine *createImagePaintEngine(QPaintDevice *paintDevice) const;
// Event dispatcher:
virtual QAbstractEventDispatcher *guiThreadEventDispatcher() const = 0;
virtual QAbstractEventDispatcher *createEventDispatcher() const = 0;
//Deeper window system integrations
virtual QPlatformFontDatabase *fontDatabase() const;

View File

@ -74,10 +74,11 @@ QT_BEGIN_NAMESPACE
QSessionManager provides an interface between the application and the
session manager so that the program can work well with the session manager.
In Qt, session management requests for action are handled by the two
virtual functions QApplication::commitData() and QApplication::saveState().
Both provide a reference to a session manager object as argument, to allow
the application to communicate with the session manager. The session
manager can only be accessed through these functions.
signals QGuiApplication::commitDataRequest() and
QGuiApplication::saveStateRequest(). Both provide a reference to a session
manager object as argument, to allow the application to communicate with
the session manager. The session manager can only be accessed through these
functions.
No user interaction is possible \e unless the application gets explicit
permission from the session manager. You ask for permission by calling
@ -94,7 +95,7 @@ QT_BEGIN_NAMESPACE
setRestartHint(), setProperty(), requestPhase2(). See the respective
function descriptions for further details.
\sa QApplication, {Session Management}
\sa QGuiApplication, {Session Management}
*/
@ -151,7 +152,7 @@ QSessionManager::~QSessionManager()
If the application has been restored from an earlier session, this
identifier is the same as it was in the earlier session.
\sa sessionKey(), QApplication::sessionId()
\sa sessionKey(), QGuiApplication::sessionId()
*/
QString QSessionManager::sessionId() const
{
@ -169,7 +170,7 @@ QString QSessionManager::sessionId() const
The session key changes with every call of commitData() or saveState().
\sa sessionId(), QApplication::sessionKey()
\sa sessionId(), QGuiApplication::sessionKey()
*/
QString QSessionManager::sessionKey() const
{
@ -197,15 +198,15 @@ QString QSessionManager::sessionKey() const
phase, you must tell the session manager that this has happened by calling
cancel().
Here's an example of how an application's QApplication::commitData() might
be implemented:
Here's an example of how an application's QGuiApplication::commitDataRequest()
might be implemented:
\snippet code/src_gui_kernel_qapplication.cpp 8
\snippet code/src_gui_kernel_qguiapplication.cpp 8
If an error occurred within the application while saving its data, you may
want to try allowsErrorInteraction() instead.
\sa QApplication::commitData(), release(), cancel()
\sa QGuiApplication::commitDataRequest(), release(), cancel()
*/
bool QSessionManager::allowsInteraction()
{
@ -261,8 +262,9 @@ void QSessionManager::cancel()
\note These flags are only hints, a session manager may or may not respect
them.
We recommend setting the restart hint in QApplication::saveState() because
most session managers perform a checkpoint shortly after an application's
We recommend setting the restart hint in QGuiApplication::saveStateRequest()
because most session managers perform a checkpoint shortly after an
application's
startup.
\sa restartHint()
@ -291,12 +293,13 @@ QSessionManager::RestartHint QSessionManager::restartHint() const
If the session manager is capable of restoring sessions it will execute
\a command in order to restore the application. The command defaults to
\snippet code/src_gui_kernel_qapplication.cpp 9
\snippet code/src_gui_kernel_qguiapplication.cpp 9
The \c -session option is mandatory; otherwise QApplication cannot tell
whether it has been restored or what the current session identifier is.
See QApplication::isSessionRestored() and QApplication::sessionId() for
details.
The \c -session option is mandatory; otherwise QGuiApplication cannot
tell whether it has been restored or what the current session identifier
is.
See QGuiApplication::isSessionRestored() and
QGuiApplication::sessionId() for details.
If your application is very simple, it may be possible to store the entire
application state in additional command line options. This is usually a
@ -318,7 +321,7 @@ void QSessionManager::setRestartCommand(const QStringList &command)
To iterate over the list, you can use the \l foreach pseudo-keyword:
\snippet code/src_gui_kernel_qapplication.cpp 10
\snippet code/src_gui_kernel_qguiapplication.cpp 10
\sa setRestartCommand(), restartHint()
*/
@ -344,7 +347,7 @@ void QSessionManager::setDiscardCommand(const QStringList &command)
To iterate over the list, you can use the \l foreach pseudo-keyword:
\snippet code/src_gui_kernel_qapplication.cpp 11
\snippet code/src_gui_kernel_qguiapplication.cpp 11
\sa setDiscardCommand(), restartCommand(), setRestartCommand()
*/
@ -396,9 +399,10 @@ bool QSessionManager::isPhase2() const
/*!
Requests a second session management phase for the application. The
application may then return immediately from the QApplication::commitData()
or QApplication::saveState() function, and they will be called again once
most or all other applications have finished their session management.
application may then return immediately from the
QGuiApplication::commitDataRequest() or QApplication::saveStateRequest()
function, and they will be called again once most or all other
applications have finished their session management.
The two phases are useful for applications such as the X11 window manager
that need to store information about another application's windows and

View File

@ -106,7 +106,7 @@ int QStyleHints::mouseDoubleClickInterval() const
and the current position (e.g. in the mouse move event) is \c currentPos,
you can find out if a drag should be started with code like this:
\snippet code/src_gui_kernel_qapplication.cpp 7
\snippet code/src_gui_kernel_qguiapplication.cpp 6
\sa startDragTime(), QPoint::manhattanLength(), {Drag and Drop}
*/

View File

@ -46,7 +46,7 @@
#if !defined(QT_NO_OPENGL)
#include <QSharedDataPointer>
#include <QtCore/QSharedDataPointer>
QT_BEGIN_NAMESPACE

View File

@ -175,7 +175,7 @@ bool QOpenGLTexturePrivate::create()
void QOpenGLTexturePrivate::destroy()
{
if (QOpenGLContext::currentContext() == context) {
if (QOpenGLContext::currentContext() != context) {
qWarning("Requires a valid current OpenGL context.\n"
"Texture has not been destroyed");
return;

View File

@ -636,6 +636,13 @@ QBrush &QBrush::operator=(const QBrush &b)
return *this;
}
/*!
\fn QBrush &QBrush::operator=(QBrush &&other)
Move-assigns \a other to this QBrush instance.
\since 5.2
*/
/*!
\fn void QBrush::swap(QBrush &other)

View File

@ -607,6 +607,14 @@ QPainterPath &QPainterPath::operator=(const QPainterPath &other)
return *this;
}
/*!
\fn QPainterPath &QPainterPath::operator=(QPainterPath &&other)
Move-assigns \a other to this QPainterPath instance.
\since 5.2
*/
/*!
\fn void QPainterPath::swap(QPainterPath &other)
\since 4.8

View File

@ -377,6 +377,14 @@ QPen &QPen::operator=(const QPen &p)
return *this;
}
/*!
\fn QPen &QPen::operator=(QPen &&other)
Move-assigns \a other to this QPen instance.
\since 5.2
*/
/*!
\fn void QPen::swap(QPen &other)
\since 4.8

View File

@ -360,6 +360,14 @@ void QRegion::exec(const QByteArray &buffer, int ver, QDataStream::ByteOrder byt
Assigns \a r to this region and returns a reference to the region.
*/
/*!
\fn QRegion &QRegion::operator=(QRegion &&other)
Move-assigns \a other to this QRegion instance.
\since 5.2
*/
/*!
\fn void QRegion::swap(QRegion &other)
\since 4.8

View File

@ -536,6 +536,14 @@ QFontEngineData::~QFontEngineData()
\sa Weight
*/
/*!
\fn QFont &QFont::operator=(QFont &&other)
Move-assigns \a other to this QFont instance.
\since 5.2
*/
/*!
\fn QString QFont::rawName() const

View File

@ -212,6 +212,14 @@ QFontMetrics &QFontMetrics::operator=(const QFontMetrics &fm)
return *this;
}
/*!
\fn QFontMetrics &QFontMetrics::operator=(QFontMetrics &&other)
Move-assigns \a other to this QFontMetrics instance.
\since 5.2
*/
/*!
\fn void QFontMetrics::swap(QFontMetrics &other)
\since 5.0

View File

@ -61,6 +61,7 @@ QTextOption::QTextOption()
wordWrap(QTextOption::WordWrap),
design(false),
unused(0),
unused2(0),
f(0),
tab(-1),
d(0)
@ -78,6 +79,7 @@ QTextOption::QTextOption(Qt::Alignment alignment)
wordWrap(QTextOption::WordWrap),
design(false),
unused(0),
unused2(0),
f(0),
tab(-1),
d(0)
@ -104,6 +106,7 @@ QTextOption::QTextOption(const QTextOption &o)
design(o.design),
direction(o.direction),
unused(o.unused),
unused2(o.unused2),
f(o.f),
tab(o.tab),
d(0)

View File

@ -134,7 +134,8 @@ private:
uint wordWrap : 4;
uint design : 1;
uint direction : 2;
uint unused : 18;
uint unused : 17;
uint unused2; // ### Qt 6: remove unnecessary, extra 32 bits
uint f;
qreal tab;
QTextOptionPrivate *d;

View File

@ -560,7 +560,7 @@ QHttpNetworkReply* QHttpNetworkConnectionPrivate::queueRequest(const QHttpNetwor
// untill we have started the first connection attempt. So no
// request will be started untill we know if IPv4 or IPv6
// should be used.
if (networkLayerState == Unknown) {
if (networkLayerState == Unknown || networkLayerState == InProgress) {
startHostInfoLookup();
} else if ( networkLayerState == IPv4 || networkLayerState == IPv6 ) {
// this used to be called via invokeMethod and a QueuedConnection

View File

@ -114,6 +114,18 @@ QT_BEGIN_NAMESPACE
possibly with a different version of OpenSSL.
*/
namespace {
void qsslSocketUnresolvedSymbolWarning(const char *functionName)
{
qWarning("QSslSocket: cannot call unresolved function %s", functionName);
}
void qsslSocketCannotResolveSymbolWarning(const char *functionName)
{
qWarning("QSslSocket: cannot resolve %s", functionName);
}
}
#ifdef SSLEAY_MACROS
DEFINEFUNC3(void *, ASN1_dup, i2d_of_void *a, a, d2i_of_void *b, b, char *c, c, return 0, return)
#endif
@ -338,7 +350,7 @@ DEFINEFUNC3(SSL_SESSION *, d2i_SSL_SESSION, SSL_SESSION **a, a, const unsigned c
#define RESOLVEFUNC(func) \
if (!(_q_##func = _q_PTR_##func(libs.first->resolve(#func))) \
&& !(_q_##func = _q_PTR_##func(libs.second->resolve(#func)))) \
qWarning("QSslSocket: cannot resolve "#func);
qsslSocketCannotResolveSymbolWarning(#func);
#if !defined QT_LINKED_OPENSSL
@ -516,8 +528,6 @@ static QPair<QSystemLibrary*, QSystemLibrary*> loadOpenSslWin32()
static QPair<QLibrary*, QLibrary*> loadOpenSsl()
{
QPair<QLibrary*,QLibrary*> pair;
pair.first = 0;
pair.second = 0;
# if defined(Q_OS_UNIX)
QLibrary *&libssl = pair.first;

View File

@ -69,6 +69,7 @@
//
#include "qsslsocket_openssl_p.h"
#include <QtCore/qglobal.h>
QT_BEGIN_NAMESPACE
@ -82,8 +83,8 @@ QT_BEGIN_NAMESPACE
typedef ret (*_q_PTR_##func)(arg); \
static _q_PTR_##func _q_##func = 0; \
ret q_##func(arg) { \
if (!_q_##func) { \
qWarning("QSslSocket: cannot call unresolved function "#func); \
if (Q_UNLIKELY(!_q_##func)) { \
qsslSocketUnresolvedSymbolWarning(#func); \
err; \
} \
funcret _q_##func(a); \
@ -94,8 +95,8 @@ QT_BEGIN_NAMESPACE
typedef ret (*_q_PTR_##func)(arg1, arg2); \
static _q_PTR_##func _q_##func = 0; \
ret q_##func(arg1, arg2) { \
if (!_q_##func) { \
qWarning("QSslSocket: cannot call unresolved function "#func);\
if (Q_UNLIKELY(!_q_##func)) { \
qsslSocketUnresolvedSymbolWarning(#func);\
err; \
} \
funcret _q_##func(a, b); \
@ -106,8 +107,8 @@ QT_BEGIN_NAMESPACE
typedef ret (*_q_PTR_##func)(arg1, arg2, arg3); \
static _q_PTR_##func _q_##func = 0; \
ret q_##func(arg1, arg2, arg3) { \
if (!_q_##func) { \
qWarning("QSslSocket: cannot call unresolved function "#func); \
if (Q_UNLIKELY(!_q_##func)) { \
qsslSocketUnresolvedSymbolWarning(#func); \
err; \
} \
funcret _q_##func(a, b, c); \
@ -118,8 +119,8 @@ QT_BEGIN_NAMESPACE
typedef ret (*_q_PTR_##func)(arg1, arg2, arg3, arg4); \
static _q_PTR_##func _q_##func = 0; \
ret q_##func(arg1, arg2, arg3, arg4) { \
if (!_q_##func) { \
qWarning("QSslSocket: cannot call unresolved function "#func); \
if (Q_UNLIKELY(!_q_##func)) { \
qsslSocketUnresolvedSymbolWarning(#func); \
err; \
} \
funcret _q_##func(a, b, c, d); \
@ -130,8 +131,8 @@ QT_BEGIN_NAMESPACE
typedef ret (*_q_PTR_##func)(arg1, arg2, arg3, arg4, arg5); \
static _q_PTR_##func _q_##func = 0; \
ret q_##func(arg1, arg2, arg3, arg4, arg5) { \
if (!_q_##func) { \
qWarning("QSslSocket: cannot call unresolved function "#func); \
if (Q_UNLIKELY(!_q_##func)) { \
qsslSocketUnresolvedSymbolWarning(#func); \
err; \
} \
funcret _q_##func(a, b, c, d, e); \
@ -142,8 +143,8 @@ QT_BEGIN_NAMESPACE
typedef ret (*_q_PTR_##func)(arg1, arg2, arg3, arg4, arg5, arg6); \
static _q_PTR_##func _q_##func = 0; \
ret q_##func(arg1, arg2, arg3, arg4, arg5, arg6) { \
if (!_q_##func) { \
qWarning("QSslSocket: cannot call unresolved function "#func); \
if (Q_UNLIKELY(!_q_##func)) { \
qsslSocketUnresolvedSymbolWarning(#func); \
err; \
} \
funcret _q_##func(a, b, c, d, e, f); \
@ -154,8 +155,8 @@ QT_BEGIN_NAMESPACE
typedef ret (*_q_PTR_##func)(arg1, arg2, arg3, arg4, arg5, arg6, arg7); \
static _q_PTR_##func _q_##func = 0; \
ret q_##func(arg1, arg2, arg3, arg4, arg5, arg6, arg7) { \
if (!_q_##func) { \
qWarning("QSslSocket: cannot call unresolved function "#func); \
if (Q_UNLIKELY(!_q_##func)) { \
qsslSocketUnresolvedSymbolWarning(#func); \
err; \
} \
funcret _q_##func(a, b, c, d, e, f, g); \
@ -166,8 +167,8 @@ QT_BEGIN_NAMESPACE
typedef ret (*_q_PTR_##func)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); \
static _q_PTR_##func _q_##func = 0; \
ret q_##func(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) { \
if (_q_##func) { \
qWarning("QSslSocket: cannot call unresolved function "#func); \
if (Q_UNLIKELY(!_q_##func)) { \
qsslSocketUnresolvedSymbolWarning(#func); \
err; \
} \
funcret _q_##func(a, b, c, d, e, f, g, h, i); \

View File

@ -170,7 +170,7 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &specification,
{
setObjectName(QLatin1String("Evdev Touch Handler"));
QString dev;
bool printDeviceInfo = qgetenv("QT_QPA_EVDEV_DEBUG").toInt();
// only the first device argument is used for now
QString spec = QString::fromLocal8Bit(qgetenv("QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS"));
@ -180,6 +180,7 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &specification,
QStringList args = spec.split(QLatin1Char(':'));
QString dev;
int rotationAngle = 0;
for (int i = 0; i < args.count(); ++i) {
if (args.at(i).startsWith(QLatin1String("/dev/")) && dev.isEmpty()) {
@ -213,17 +214,22 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &specification,
}
}
if (dev.isEmpty())
if (dev.isEmpty()) {
if (printDeviceInfo)
qDebug("evdevtouch: No touch devices found");
return;
}
if (printDeviceInfo)
qDebug("evdevtouch: Using device %s", qPrintable(dev));
qDebug("evdevtouch: Using device %s", qPrintable(dev));
m_fd = QT_OPEN(dev.toLocal8Bit().constData(), O_RDONLY | O_NDELAY, 0);
if (m_fd >= 0) {
m_notify = new QSocketNotifier(m_fd, QSocketNotifier::Read, this);
connect(m_notify, SIGNAL(activated(int)), this, SLOT(readData()));
} else {
qErrnoWarning(errno, "Cannot open input device %s", qPrintable(dev));
qErrnoWarning(errno, "evdevtouch: Cannot open input device %s", qPrintable(dev));
return;
}
@ -231,7 +237,7 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &specification,
m_mtdev = static_cast<mtdev *>(calloc(1, sizeof(mtdev)));
int mtdeverr = mtdev_open(m_mtdev, m_fd);
if (mtdeverr) {
qWarning("mtdev_open failed: %d", mtdeverr);
qWarning("evdevtouch: mtdev_open failed: %d", mtdeverr);
QT_CLOSE(m_fd);
return;
}
@ -250,21 +256,26 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &specification,
d->m_singleTouch = !testBit(ABS_MT_POSITION_X, absbits);
}
#endif
qDebug("Protocol type %c %s (%s)", d->m_typeB ? 'B' : 'A', mtdevStr, d->m_singleTouch ? "single" : "multi");
if (printDeviceInfo)
qDebug("evdevtouch: Protocol type %c %s (%s)", d->m_typeB ? 'B' : 'A',
mtdevStr, d->m_singleTouch ? "single" : "multi");
input_absinfo absInfo;
memset(&absInfo, 0, sizeof(input_absinfo));
bool has_x_range = false, has_y_range = false;
if (ioctl(m_fd, EVIOCGABS((d->m_singleTouch ? ABS_X : ABS_MT_POSITION_X)), &absInfo) >= 0) {
qDebug("min X: %d max X: %d", absInfo.minimum, absInfo.maximum);
if (printDeviceInfo)
qDebug("evdevtouch: min X: %d max X: %d", absInfo.minimum, absInfo.maximum);
d->hw_range_x_min = absInfo.minimum;
d->hw_range_x_max = absInfo.maximum;
has_x_range = true;
}
if (ioctl(m_fd, EVIOCGABS((d->m_singleTouch ? ABS_Y : ABS_MT_POSITION_Y)), &absInfo) >= 0) {
qDebug("min Y: %d max Y: %d", absInfo.minimum, absInfo.maximum);
if (printDeviceInfo)
qDebug("evdevtouch: min Y: %d max Y: %d", absInfo.minimum, absInfo.maximum);
d->hw_range_y_min = absInfo.minimum;
d->hw_range_y_max = absInfo.maximum;
has_y_range = true;
@ -274,7 +285,8 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &specification,
qWarning("evdevtouch: Invalid ABS limits, behavior unspecified");
if (ioctl(m_fd, EVIOCGABS(ABS_PRESSURE), &absInfo) >= 0) {
qDebug("min pressure: %d max pressure: %d", absInfo.minimum, absInfo.maximum);
if (printDeviceInfo)
qDebug("evdevtouch: min pressure: %d max pressure: %d", absInfo.minimum, absInfo.maximum);
if (absInfo.maximum > absInfo.minimum) {
d->hw_pressure_min = absInfo.minimum;
d->hw_pressure_max = absInfo.maximum;
@ -284,14 +296,15 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &specification,
char name[1024];
if (ioctl(m_fd, EVIOCGNAME(sizeof(name) - 1), name) >= 0) {
d->hw_name = QString::fromLocal8Bit(name);
qDebug("device name: %s", name);
if (printDeviceInfo)
qDebug("evdevtouch: device name: %s", name);
}
bool grabSuccess = !ioctl(m_fd, EVIOCGRAB, (void *) 1);
if (grabSuccess)
ioctl(m_fd, EVIOCGRAB, (void *) 0);
else
qWarning("ERROR: The device is grabbed by another process. No events will be read.");
qWarning("evdevtouch: The device is grabbed by another process. No events will be read.");
if (rotationAngle)
d->m_rotate = QTransform::fromTranslate(0.5, 0.5).rotate(rotationAngle).translate(-0.5, -0.5);
@ -327,11 +340,11 @@ void QEvdevTouchScreenHandler::readData()
int result = QT_READ(m_fd, reinterpret_cast<char*>(buffer) + n, sizeof(buffer) - n);
#endif
if (!result) {
qWarning("Got EOF from input device");
qWarning("evdevtouch: Got EOF from input device");
return;
} else if (result < 0) {
if (errno != EINTR && errno != EAGAIN) {
qWarning("Could not read from input device: %s", strerror(errno));
qErrnoWarning(errno, "evdevtouch: Could not read from input device");
if (errno == ENODEV) { // device got disconnected -> stop reading
delete m_notify;
m_notify = 0;

View File

@ -100,10 +100,6 @@ QAndroidPlatformIntegration::QAndroidPlatformIntegration(const QStringList &para
{
Q_UNUSED(paramList);
#ifndef ANDROID_PLUGIN_OPENGL
m_eventDispatcher = createUnixEventDispatcher();
#endif
m_androidPlatformNativeInterface = new QAndroidPlatformNativeInterface();
#ifndef ANDROID_PLUGIN_OPENGL
@ -150,9 +146,9 @@ QPlatformWindow *QAndroidPlatformIntegration::createPlatformWindow(QWindow *wind
return new QAndroidPlatformWindow(window);
}
QAbstractEventDispatcher *QAndroidPlatformIntegration::guiThreadEventDispatcher() const
QAbstractEventDispatcher *QAndroidPlatformIntegration::createEventDispatcher() const
{
return m_eventDispatcher;
return createUnixEventDispatcher();
}
#else // !ANDROID_PLUGIN_OPENGL
QPlatformWindow *QAndroidPlatformIntegration::createPlatformWindow(QWindow *window) const

View File

@ -93,7 +93,7 @@ public:
#ifndef ANDROID_PLUGIN_OPENGL
QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const;
QPlatformWindow *createPlatformWindow(QWindow *window) const;
QAbstractEventDispatcher *guiThreadEventDispatcher() const;
QAbstractEventDispatcher *createEventDispatcher() const;
QAndroidPlatformScreen *screen() { return m_primaryScreen; }
#else
QPlatformWindow *createPlatformWindow(QWindow *window) const;
@ -147,7 +147,6 @@ private:
QTouchDevice *m_touchDevice;
#ifndef ANDROID_PLUGIN_OPENGL
QAbstractEventDispatcher *m_eventDispatcher;
QAndroidPlatformScreen *m_primaryScreen;
#endif

View File

@ -108,7 +108,7 @@ public:
QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const;
QPlatformBackingStore *createPlatformBackingStore(QWindow *widget) const;
QAbstractEventDispatcher *guiThreadEventDispatcher() const;
QAbstractEventDispatcher *createEventDispatcher() const;
QPlatformFontDatabase *fontDatabase() const;
QPlatformNativeInterface *nativeInterface() const;
@ -130,7 +130,6 @@ public:
private:
QScopedPointer<QPlatformFontDatabase> mFontDb;
QAbstractEventDispatcher *mEventDispatcher;
QScopedPointer<QPlatformInputContext> mInputContext;
#ifndef QT_NO_ACCESSIBILITY

View File

@ -216,7 +216,6 @@ QPixmap QCocoaScreen::grabWindow(WId window, int x, int y, int width, int height
QCocoaIntegration::QCocoaIntegration()
: mFontDb(new QCoreTextFontDatabase())
, mEventDispatcher(new QCocoaEventDispatcher())
, mInputContext(new QCocoaInputContext)
#ifndef QT_NO_ACCESSIBILITY
, mAccessibility(new QCocoaAccessibility)
@ -384,9 +383,9 @@ QPlatformBackingStore *QCocoaIntegration::createPlatformBackingStore(QWindow *wi
return new QCocoaBackingStore(window);
}
QAbstractEventDispatcher *QCocoaIntegration::guiThreadEventDispatcher() const
QAbstractEventDispatcher *QCocoaIntegration::createEventDispatcher() const
{
return mEventDispatcher;
return new QCocoaEventDispatcher;
}
QPlatformFontDatabase *QCocoaIntegration::fontDatabase() const

View File

@ -400,15 +400,17 @@ void QCocoaWindow::setVisible(bool visible)
} else {
[m_contentView setHidden:YES];
}
if (parentCocoaWindow && window()->type() == Qt::Popup
&& m_resizableTransientParent
if (parentCocoaWindow && window()->type() == Qt::Popup) {
parentCocoaWindow->m_activePopupWindow = 0;
if (m_resizableTransientParent
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
&& QSysInfo::QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7
&& !([parentCocoaWindow->m_nsWindow styleMask] & NSFullScreenWindowMask)
&& QSysInfo::QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7
&& !([parentCocoaWindow->m_nsWindow styleMask] & NSFullScreenWindowMask)
#endif
)
// QTBUG-30266: a window should not be resizable while a transient popup is open
[parentCocoaWindow->m_nsWindow setStyleMask:[parentCocoaWindow->m_nsWindow styleMask] | NSResizableWindowMask];
)
// QTBUG-30266: a window should not be resizable while a transient popup is open
[parentCocoaWindow->m_nsWindow setStyleMask:[parentCocoaWindow->m_nsWindow styleMask] | NSResizableWindowMask];
}
}
}

View File

@ -1026,20 +1026,21 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
NSTimeInterval timestamp = [theEvent timestamp];
ulong qt_timestamp = timestamp * 1000;
// Set keyboard modifiers depending on event phase. A two-finger trackpad flick
// generates a stream of scroll events. We want the keyboard modifier state to
// be the state at the beginning of the flick in order to avoid changing the
// interpretation of the events mid-stream. One example of this happening would
// be when pressing cmd after scrolling in Qt Creator: not taking the phase into
// account causes the end of the event stream to be interpreted as font size changes.
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
if ([theEvent respondsToSelector:@selector(scrollingDeltaX)]) {
NSEventPhase phase = [theEvent phase];
if (phase == NSEventPhaseBegan || phase == NSEventPhaseNone) {
// Prevent keyboard modifier state from changing during scroll event streams.
// A two-finger trackpad flick generates a stream of scroll events. We want
// the keyboard modifier state to be the state at the beginning of the
// flick in order to avoid changing the interpretation of the events
// mid-stream. One example of this happening would be when pressing cmd
// after scrolling in Qt Creator: not taking the phase into account causes
// the end of the event stream to be interpreted as font size changes.
NSEventPhase momentumPhase = [theEvent momentumPhase];
if (momentumPhase == NSEventPhaseNone) {
currentWheelModifiers = [QNSView convertKeyModifiers:[theEvent modifierFlags]];
}
NSEventPhase phase = [theEvent phase];
Qt::ScrollPhase ph = Qt::ScrollUpdate;
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8
if (QSysInfo::QSysInfo::MacintoshVersion >= QSysInfo::MV_10_8) {
@ -1058,7 +1059,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
QWindowSystemInterface::handleWheelEvent(m_window, qt_timestamp, qt_windowPoint, qt_screenPoint, pixelDelta, angleDelta, currentWheelModifiers, ph);
if (phase == NSEventPhaseEnded || phase == NSEventPhaseCancelled || phase == NSEventPhaseNone) {
if (momentumPhase == NSEventPhaseEnded || momentumPhase == NSEventPhaseCancelled || momentumPhase == NSEventPhaseNone) {
currentWheelModifiers = Qt::NoModifier;
}
} else

View File

@ -61,9 +61,7 @@ QT_BEGIN_NAMESPACE
QDirectFbIntegration::QDirectFbIntegration()
: m_fontDb(new QGenericUnixFontDatabase())
, m_eventDispatcher(createUnixEventDispatcher())
{
QGuiApplicationPrivate::instance()->setEventDispatcher(m_eventDispatcher);
}
void QDirectFbIntegration::initialize()
@ -129,9 +127,9 @@ QPlatformWindow *QDirectFbIntegration::createPlatformWindow(QWindow *window) con
return dfbWindow;
}
QAbstractEventDispatcher *QDirectFbIntegration::guiThreadEventDispatcher() const
QAbstractEventDispatcher *QDirectFbIntegration::createEventDispatcher() const
{
return m_eventDispatcher;
return createUnixEventDispatcher();
}
QPlatformBackingStore *QDirectFbIntegration::createPlatformBackingStore(QWindow *window) const

View File

@ -65,7 +65,7 @@ public:
QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const;
QPlatformWindow *createPlatformWindow(QWindow *window) const;
QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const;
QAbstractEventDispatcher *guiThreadEventDispatcher() const;
QAbstractEventDispatcher *createEventDispatcher() const;
QPlatformFontDatabase *fontDatabase() const;
@ -80,7 +80,6 @@ protected:
QScopedPointer<QDirectFbInput> m_input;
QScopedPointer<QThread> m_inputRunner;
QScopedPointer<QPlatformFontDatabase> m_fontDb;
QAbstractEventDispatcher *m_eventDispatcher;
};
QT_END_NAMESPACE

View File

@ -78,12 +78,9 @@ QT_BEGIN_NAMESPACE
static void *eglContextForContext(QOpenGLContext *context);
QEglFSIntegration::QEglFSIntegration()
: mEventDispatcher(createUnixEventDispatcher()),
mFontDb(new QGenericUnixFontDatabase),
mServices(new QGenericUnixServices)
: mFontDb(new QGenericUnixFontDatabase)
, mServices(new QGenericUnixServices)
{
QGuiApplicationPrivate::instance()->setEventDispatcher(mEventDispatcher);
#if !defined(QT_NO_EVDEV) && (!defined(Q_OS_ANDROID) || defined(Q_OS_ANDROID_NO_SDK))
new QEvdevKeyboardManager(QLatin1String("EvdevKeyboard"), QString() /* spec */, this);
new QEvdevMouseManager(QLatin1String("EvdevMouse"), QString() /* spec */, this);
@ -168,9 +165,9 @@ QPlatformFontDatabase *QEglFSIntegration::fontDatabase() const
return mFontDb.data();
}
QAbstractEventDispatcher *QEglFSIntegration::guiThreadEventDispatcher() const
QAbstractEventDispatcher *QEglFSIntegration::createEventDispatcher() const
{
return mEventDispatcher;
return createUnixEventDispatcher();
}
QVariant QEglFSIntegration::styleHint(QPlatformIntegration::StyleHint hint) const

View File

@ -67,7 +67,7 @@ public:
QPlatformFontDatabase *fontDatabase() const;
QPlatformServices *services() const;
QAbstractEventDispatcher *guiThreadEventDispatcher() const;
QAbstractEventDispatcher *createEventDispatcher() const;
QVariant styleHint(QPlatformIntegration::StyleHint hint) const;
@ -87,7 +87,6 @@ public:
private:
EGLDisplay mDisplay;
QAbstractEventDispatcher *mEventDispatcher;
QScopedPointer<QPlatformFontDatabase> mFontDb;
QScopedPointer<QPlatformServices> mServices;
QEglFSScreen *mScreen;

View File

@ -114,8 +114,9 @@ void QEglFSWindow::create()
}
window()->setSurfaceType(QSurface::OpenGLSurface);
setGeometry(screen()->availableGeometry());
QWindowSystemInterface::handleExposeEvent(window(), QRegion(screen()->availableGeometry()));
m_flags |= HasNativeWindow;
setGeometry(QRect()); // will become fullscreen
QWindowSystemInterface::handleExposeEvent(window(), geometry());
EGLDisplay display = static_cast<QEglFSScreen *>(screen())->display();
QSurfaceFormat platformFormat = QEglFSHooks::hooks()->surfaceFormatFor(window()->requestedFormat());
@ -124,7 +125,6 @@ void QEglFSWindow::create()
resetSurface();
m_flags |= HasNativeWindow;
if (screen()->primarySurface() == EGL_NO_SURFACE) {
screen()->setPrimarySurface(m_surface);
m_flags |= IsRasterRoot;
@ -212,6 +212,17 @@ void QEglFSWindow::setGeometry(const QRect &r)
QWindowSystemInterface::handleGeometryChange(window(), rect);
}
QRect QEglFSWindow::geometry() const
{
// For yet-to-become-fullscreen windows report the geometry covering the entire
// screen. This is particularly important for Quick where the root object may get
// sized to some geometry queried before calling create().
if (!m_flags.testFlag(Created) && screen()->primarySurface() == EGL_NO_SURFACE)
return screen()->availableGeometry();
return QPlatformWindow::geometry();
}
WId QEglFSWindow::winId() const
{
return m_wid;

View File

@ -58,6 +58,7 @@ public:
~QEglFSWindow();
void setGeometry(const QRect &);
QRect geometry() const;
WId winId() const;
void setVisible(bool visible);
void requestActivateWindow();

View File

@ -20,7 +20,8 @@ OBJECTIVE_SOURCES = \
qioscontext.mm \
qiosinputcontext.mm \
qiostheme.mm \
qiosglobal.mm
qiosglobal.mm \
qiosservices.mm
HEADERS = \
qiosintegration.h \
@ -34,6 +35,7 @@ HEADERS = \
qioscontext.h \
qiosinputcontext.h \
qiostheme.h \
qiosglobal.h
qiosglobal.h \
qiosservices.h
#HEADERS = qiossoftwareinputhandler.h

View File

@ -148,8 +148,10 @@ namespace
// Add memory guard at the end of the reserved stack, so that any stack
// overflow during the user's main will trigger an exception at that point,
// and not when we return and find that the current stack has been smashed.
// We allow read though, so that garbage-collection can pass through our
// stack in its mark phase without triggering access violations.
uintptr_t memoryGuardStart = qAlignUp(memoryStart, kPageSize);
if (mprotect((void*)memoryGuardStart, kPageSize, PROT_NONE))
if (mprotect((void*)memoryGuardStart, kPageSize, PROT_READ))
qWarning() << "Failed to add memory guard:" << strerror(errno);
// We don't consider the memory guard part of the usable stack space

View File

@ -50,10 +50,13 @@
QT_BEGIN_NAMESPACE
class QIOSServices;
class QIOSIntegration : public QPlatformIntegration, public QPlatformNativeInterface
{
public:
QIOSIntegration();
~QIOSIntegration();
bool hasCapability(Capability cap) const;
@ -64,13 +67,14 @@ public:
QPlatformFontDatabase *fontDatabase() const;
QPlatformInputContext *inputContext() const;
QPlatformServices *services() const Q_DECL_OVERRIDE;
QVariant styleHint(StyleHint hint) const;
QStringList themeNames() const;
QPlatformTheme *createPlatformTheme(const QString &name) const;
QAbstractEventDispatcher *guiThreadEventDispatcher() const;
QAbstractEventDispatcher *createEventDispatcher() const;
QPlatformNativeInterface *nativeInterface() const;
void *nativeResourceForWindow(const QByteArray &resource, QWindow *window);
@ -82,6 +86,7 @@ private:
QPlatformScreen *m_screen;
QTouchDevice *m_touchDevice;
QIOSApplicationState m_applicationState;
QIOSServices *m_platformServices;
};
QT_END_NAMESPACE

View File

@ -48,6 +48,7 @@
#include "qioscontext.h"
#include "qiosinputcontext.h"
#include "qiostheme.h"
#include "qiosservices.h"
#include <QtPlatformSupport/private/qcoretextfontdatabase_p.h>
#include <QDir>
@ -60,6 +61,7 @@ QIOSIntegration::QIOSIntegration()
: m_fontDatabase(new QCoreTextFontDatabase)
, m_inputContext(new QIOSInputContext)
, m_screen(new QIOSScreen(QIOSScreen::MainScreen))
, m_platformServices(new QIOSServices)
{
if (![UIApplication sharedApplication]) {
qWarning()
@ -81,6 +83,21 @@ QIOSIntegration::QIOSIntegration()
QWindowSystemInterface::registerTouchDevice(m_touchDevice);
}
QIOSIntegration::~QIOSIntegration()
{
delete m_fontDatabase;
m_fontDatabase = 0;
delete m_inputContext;
m_inputContext = 0;
delete m_screen;
m_screen = 0;
delete m_platformServices;
m_platformServices = 0;
}
bool QIOSIntegration::hasCapability(Capability cap) const
{
switch (cap) {
@ -113,7 +130,7 @@ QPlatformOpenGLContext *QIOSIntegration::createPlatformOpenGLContext(QOpenGLCont
return new QIOSContext(context);
}
QAbstractEventDispatcher *QIOSIntegration::guiThreadEventDispatcher() const
QAbstractEventDispatcher *QIOSIntegration::createEventDispatcher() const
{
if (isQtApplication())
return new QIOSEventDispatcher;
@ -131,6 +148,11 @@ QPlatformInputContext *QIOSIntegration::inputContext() const
return m_inputContext;
}
QPlatformServices *QIOSIntegration::services() const
{
return m_platformServices;
}
QVariant QIOSIntegration::styleHint(StyleHint hint) const
{
switch (hint) {

View File

@ -0,0 +1,57 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QIOSSERVICES_H
#define QIOSSERVICES_H
#include <qpa/qplatformservices.h>
QT_BEGIN_NAMESPACE
class QIOSServices : public QPlatformServices
{
public:
bool openUrl(const QUrl &url);
bool openDocument(const QUrl &url);
};
QT_END_NAMESPACE
#endif // QIOSSERVICES_H

View File

@ -0,0 +1,69 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qiosservices.h"
#include <QtCore/qurl.h>
#import <UIKit/UIApplication.h>
QT_BEGIN_NAMESPACE
bool QIOSServices::openUrl(const QUrl &url)
{
if (url.scheme().isEmpty())
return openDocument(url);
NSURL *nsUrl = url.toNSURL();
if (![[UIApplication sharedApplication] canOpenURL:nsUrl])
return false;
return [[UIApplication sharedApplication] openURL:nsUrl];
}
bool QIOSServices::openDocument(const QUrl &url)
{
// FIXME: Implement using UIDocumentInteractionController
return QPlatformServices::openDocument(url);
}
QT_END_NAMESPACE

View File

@ -65,10 +65,8 @@ QT_BEGIN_NAMESPACE
QKmsIntegration::QKmsIntegration()
: QPlatformIntegration(),
m_fontDatabase(new QGenericUnixFontDatabase()),
m_eventDispatcher(createUnixEventDispatcher()),
m_nativeInterface(new QKmsNativeInterface)
{
QGuiApplicationPrivate::instance()->setEventDispatcher(m_eventDispatcher);
setenv("EGL_PLATFORM", "drm",1);
m_vtHandler = new QKmsVTHandler;
@ -152,9 +150,9 @@ void QKmsIntegration::addScreen(QKmsScreen *screen)
screenAdded(screen);
}
QAbstractEventDispatcher *QKmsIntegration::guiThreadEventDispatcher() const
QAbstractEventDispatcher *QKmsIntegration::createEventDispatcher() const
{
return m_eventDispatcher;
return createUnixEventDispatcher();
}
QPlatformNativeInterface *QKmsIntegration::nativeInterface() const

View File

@ -67,7 +67,7 @@ public:
QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const;
QPlatformFontDatabase *fontDatabase() const;
QAbstractEventDispatcher *guiThreadEventDispatcher() const;
QAbstractEventDispatcher *createEventDispatcher() const;
QPlatformNativeInterface *nativeInterface() const;
@ -84,7 +84,6 @@ private:
QList<QPlatformScreen *> m_screens;
QList<QKmsDevice *> m_devices;
QPlatformFontDatabase *m_fontDatabase;
QAbstractEventDispatcher *m_eventDispatcher;
QPlatformNativeInterface *m_nativeInterface;
QKmsVTHandler *m_vtHandler;
QDeviceDiscovery *m_deviceDiscovery;

View File

@ -54,11 +54,8 @@
QT_BEGIN_NAMESPACE
QLinuxFbIntegration::QLinuxFbIntegration(const QStringList &paramList)
: m_fontDb(new QGenericUnixFontDatabase()),
m_eventDispatcher(createUnixEventDispatcher())
: m_fontDb(new QGenericUnixFontDatabase())
{
QGuiApplicationPrivate::instance()->setEventDispatcher(m_eventDispatcher);
m_primaryScreen = new QLinuxFbScreen;
if (m_primaryScreen->initialize(paramList))
screenAdded(m_primaryScreen);
@ -92,9 +89,9 @@ QPlatformWindow *QLinuxFbIntegration::createPlatformWindow(QWindow *window) cons
return new QFbWindow(window);
}
QAbstractEventDispatcher *QLinuxFbIntegration::guiThreadEventDispatcher() const
QAbstractEventDispatcher *QLinuxFbIntegration::createEventDispatcher() const
{
return m_eventDispatcher;
return createUnixEventDispatcher();
}
QList<QPlatformScreen *> QLinuxFbIntegration::screens() const

Some files were not shown because too many files have changed in this diff Show More