Merge remote-tracking branch 'origin/5.6' into 5.7

Conflicts:
	mkspecs/features/qml_module.prf
	src/corelib/tools/qdatetimeparser_p.h

Change-Id: I5382cee3ddb33107dc61ee20f7a9188c4a68a882
This commit is contained in:
Liang Qi 2016-11-25 10:32:29 +01:00
commit 50aeedd86c
15 changed files with 102 additions and 77 deletions

View File

@ -6,6 +6,7 @@ QMAKE_COMPILER = gcc clang llvm
CONFIG += android_install unversioned_soname unversioned_libname plugin_with_soname android_deployment_settings CONFIG += android_install unversioned_soname unversioned_libname plugin_with_soname android_deployment_settings
include(../common/linux.conf) include(../common/linux.conf)
include(../common/gcc-base-unix.conf)
include(../common/clang.conf) include(../common/clang.conf)
include(../common/android-base-head.conf) include(../common/android-base-head.conf)

View File

@ -308,7 +308,12 @@ void MingwMakefileGenerator::writeBuildRulesPart(QTextStream &t)
{ {
t << "first: all\n"; t << "first: all\n";
t << "all: " << escapeDependencyPath(fileFixify(Option::output.fileName())) t << "all: " << escapeDependencyPath(fileFixify(Option::output.fileName()))
<< ' ' << depVar("ALL_DEPS") << " $(DESTDIR_TARGET)\n\n"; << ' ' << depVar("ALL_DEPS");
if (project->first("TEMPLATE") == "aux") {
t << "\n\n";
return;
}
t << " $(DESTDIR_TARGET)\n\n";
t << "$(DESTDIR_TARGET): " << depVar("PRE_TARGETDEPS") << " $(OBJECTS) " << depVar("POST_TARGETDEPS"); t << "$(DESTDIR_TARGET): " << depVar("PRE_TARGETDEPS") << " $(OBJECTS) " << depVar("POST_TARGETDEPS");
if(!project->isEmpty("QMAKE_PRE_LINK")) if(!project->isEmpty("QMAKE_PRE_LINK"))
t << "\n\t" <<var("QMAKE_PRE_LINK"); t << "\n\t" <<var("QMAKE_PRE_LINK");
@ -318,7 +323,7 @@ void MingwMakefileGenerator::writeBuildRulesPart(QTextStream &t)
} else { } else {
t << "\n\t" << objectsLinkLine << " " ; t << "\n\t" << objectsLinkLine << " " ;
} }
} else if (project->first("TEMPLATE") != "aux") { } else {
t << "\n\t$(LINKER) $(LFLAGS) " << var("QMAKE_LINK_O_FLAG") << "$(DESTDIR_TARGET) " << objectsLinkLine << " $(LIBS)"; t << "\n\t$(LINKER) $(LFLAGS) " << var("QMAKE_LINK_O_FLAG") << "$(DESTDIR_TARGET) " << objectsLinkLine << " $(LIBS)";
} }
if(!project->isEmpty("QMAKE_POST_LINK")) if(!project->isEmpty("QMAKE_POST_LINK"))

View File

@ -549,7 +549,12 @@ void NmakeMakefileGenerator::writeBuildRulesPart(QTextStream &t)
t << "first: all\n"; t << "first: all\n";
t << "all: " << escapeDependencyPath(fileFixify(Option::output.fileName())) t << "all: " << escapeDependencyPath(fileFixify(Option::output.fileName()))
<< ' ' << depVar("ALL_DEPS") << " $(DESTDIR_TARGET)\n\n"; << ' ' << depVar("ALL_DEPS");
if (templateName == "aux") {
t << "\n\n";
return;
}
t << " $(DESTDIR_TARGET)\n\n";
t << "$(DESTDIR_TARGET): " << depVar("PRE_TARGETDEPS") << " $(OBJECTS) " << depVar("POST_TARGETDEPS"); t << "$(DESTDIR_TARGET): " << depVar("PRE_TARGETDEPS") << " $(OBJECTS) " << depVar("POST_TARGETDEPS");
if(!project->isEmpty("QMAKE_PRE_LINK")) if(!project->isEmpty("QMAKE_PRE_LINK"))
@ -558,7 +563,7 @@ void NmakeMakefileGenerator::writeBuildRulesPart(QTextStream &t)
t << "\n\t$(LIBAPP) $(LIBFLAGS) " << var("QMAKE_LINK_O_FLAG") << "$(DESTDIR_TARGET) @<<\n\t " t << "\n\t$(LIBAPP) $(LIBFLAGS) " << var("QMAKE_LINK_O_FLAG") << "$(DESTDIR_TARGET) @<<\n\t "
<< "$(OBJECTS)" << "$(OBJECTS)"
<< "\n<<"; << "\n<<";
} else if (templateName != "aux") { } else {
const bool embedManifest = ((templateName == "app" && project->isActiveConfig("embed_manifest_exe")) const bool embedManifest = ((templateName == "app" && project->isActiveConfig("embed_manifest_exe"))
|| (templateName == "lib" && project->isActiveConfig("embed_manifest_dll") || (templateName == "lib" && project->isActiveConfig("embed_manifest_dll")
&& !(project->isActiveConfig("plugin") && project->isActiveConfig("no_plugin_manifest")) && !(project->isActiveConfig("plugin") && project->isActiveConfig("no_plugin_manifest"))

View File

@ -572,16 +572,18 @@ void Win32MakefileGenerator::writeStandardParts(QTextStream &t)
t << "####### Build rules\n\n"; t << "####### Build rules\n\n";
writeBuildRulesPart(t); writeBuildRulesPart(t);
if(project->isActiveConfig("shared") && !project->values("DLLDESTDIR").isEmpty()) { if (project->first("TEMPLATE") != "aux") {
const ProStringList &dlldirs = project->values("DLLDESTDIR"); if (project->isActiveConfig("shared") && !project->values("DLLDESTDIR").isEmpty()) {
for (ProStringList::ConstIterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir) { const ProStringList &dlldirs = project->values("DLLDESTDIR");
t << "\t-$(COPY_FILE) $(DESTDIR_TARGET) " for (ProStringList::ConstIterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir) {
<< escapeFilePath(Option::fixPathToTargetOS((*dlldir).toQString(), false)) << endl; t << "\t-$(COPY_FILE) $(DESTDIR_TARGET) "
<< escapeFilePath(Option::fixPathToTargetOS((*dlldir).toQString(), false)) << endl;
}
} }
} t << endl;
t << endl;
writeRcFilePart(t); writeRcFilePart(t);
}
writeMakeQmake(t); writeMakeQmake(t);
@ -605,8 +607,10 @@ void Win32MakefileGenerator::writeStandardParts(QTextStream &t)
const ProStringList &quc = project->values("QMAKE_EXTRA_COMPILERS"); const ProStringList &quc = project->values("QMAKE_EXTRA_COMPILERS");
for (ProStringList::ConstIterator it = quc.begin(); it != quc.end(); ++it) { for (ProStringList::ConstIterator it = quc.begin(); it != quc.end(); ++it) {
const ProStringList &inputs = project->values(ProKey(*it + ".input")); const ProStringList &inputs = project->values(ProKey(*it + ".input"));
for (ProStringList::ConstIterator input = inputs.begin(); input != inputs.end(); ++input) for (ProStringList::ConstIterator input = inputs.begin(); input != inputs.end(); ++input) {
t << escapeFilePath(*input) << ' '; const ProStringList &val = project->values((*input).toKey());
t << escapeFilePaths(val).join(' ') << ' ';
}
} }
} }
t << endl << endl; t << endl << endl;

View File

@ -497,9 +497,10 @@ namespace {
memcpy(newValues, data, size*sizeof(QJsonPrivate::Value)); memcpy(newValues, data, size*sizeof(QJsonPrivate::Value));
data = newValues; data = newValues;
} else { } else {
data = static_cast<QJsonPrivate::Value *>(realloc(data, alloc*sizeof(QJsonPrivate::Value))); void *newValues = realloc(data, alloc * sizeof(QJsonPrivate::Value));
if (!data) if (!newValues)
return false; return false;
data = static_cast<QJsonPrivate::Value *>(newValues);
} }
return true; return true;
} }

View File

@ -107,11 +107,12 @@ private:
inline int reserveSpace(int space) { inline int reserveSpace(int space) {
if (current + space >= dataLength) { if (current + space >= dataLength) {
dataLength = 2*dataLength + space; dataLength = 2*dataLength + space;
data = (char *)realloc(data, dataLength); char *newData = (char *)realloc(data, dataLength);
if (!data) { if (!newData) {
lastError = QJsonParseError::DocumentTooLarge; lastError = QJsonParseError::DocumentTooLarge;
return -1; return -1;
} }
data = newData;
} }
int pos = current; int pos = current;
current += space; current += space;

View File

@ -264,7 +264,7 @@ bool QMimeDatabasePrivate::inherits(const QString &mime, const QString &parent)
\code \code
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info"> <mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
<mime-type type="application/vnd.nokia.qt.qmakeprofile"> <mime-type type="application/vnd.qt.qmakeprofile">
<comment xml:lang="en">Qt qmake Profile</comment> <comment xml:lang="en">Qt qmake Profile</comment>
<glob pattern="*.pro" weight="50"/> <glob pattern="*.pro" weight="50"/>
</mime-type> </mime-type>

View File

@ -3633,7 +3633,7 @@ QString QDateTime::toString(Qt::DateFormat format) const
\li the abbreviated localized day name (e.g. 'Mon' to 'Sun'). \li the abbreviated localized day name (e.g. 'Mon' to 'Sun').
Uses the system locale to localize the name, i.e. QLocale::system(). Uses the system locale to localize the name, i.e. QLocale::system().
\row \li dddd \row \li dddd
\li the long localized day name (e.g. 'Monday' to 'Qt::Sunday'). \li the long localized day name (e.g. 'Monday' to 'Sunday').
Uses the system locale to localize the name, i.e. QLocale::system(). Uses the system locale to localize the name, i.e. QLocale::system().
\row \li M \li the month as number without a leading zero (1-12) \row \li M \li the month as number without a leading zero (1-12)
\row \li MM \li the month as number with a leading zero (01-12) \row \li MM \li the month as number with a leading zero (01-12)

View File

@ -103,14 +103,6 @@ public:
none.zeroesAdded = 0; none.zeroesAdded = 0;
} }
virtual ~QDateTimeParser() {} virtual ~QDateTimeParser() {}
enum AmPmFinder {
Neither = -1,
AM = 0,
PM = 1,
PossibleAM = 2,
PossiblePM = 3,
PossibleBoth = 4
};
enum Section { enum Section {
NoSection = 0x00000, NoSection = 0x00000,
@ -186,50 +178,11 @@ public:
#ifndef QT_NO_DATESTRING #ifndef QT_NO_DATESTRING
StateNode parse(QString &input, int &cursorPosition, const QDateTime &currentValue, bool fixup) const; StateNode parse(QString &input, int &cursorPosition, const QDateTime &currentValue, bool fixup) const;
#endif #endif
int sectionMaxSize(int index) const;
int sectionSize(int index) const;
int sectionMaxSize(Section s, int count) const;
int sectionPos(int index) const;
int sectionPos(const SectionNode &sn) const;
const SectionNode &sectionNode(int index) const;
Section sectionType(int index) const;
QString sectionText(int sectionIndex) const;
QString sectionText(const QString &text, int sectionIndex, int index) const;
int getDigit(const QDateTime &dt, int index) const;
bool setDigit(QDateTime &t, int index, int newval) const;
int parseSection(const QDateTime &currentValue, int sectionIndex, QString &txt, int &cursorPosition,
int index, QDateTimeParser::State &state, int *used = 0) const;
int absoluteMax(int index, const QDateTime &value = QDateTime()) const;
int absoluteMin(int index) const;
bool parseFormat(const QString &format); bool parseFormat(const QString &format);
#ifndef QT_NO_DATESTRING #ifndef QT_NO_DATESTRING
bool fromString(const QString &text, QDate *date, QTime *time) const; bool fromString(const QString &text, QDate *date, QTime *time) const;
#endif #endif
#ifndef QT_NO_TEXTDATE
int findMonth(const QString &str1, int monthstart, int sectionIndex,
QString *monthName = 0, int *used = 0) const;
int findDay(const QString &str1, int intDaystart, int sectionIndex,
QString *dayName = 0, int *used = 0) const;
#endif
AmPmFinder findAmPm(QString &str, int index, int *used = 0) const;
bool potentialValue(const QStringRef &str, int min, int max, int index,
const QDateTime &currentValue, int insert) const;
bool potentialValue(const QString &str, int min, int max, int index,
const QDateTime &currentValue, int insert) const
{
return potentialValue(QStringRef(&str), min, max, index, currentValue, insert);
}
bool skipToNextSection(int section, const QDateTime &current, const QStringRef &sectionText) const;
bool skipToNextSection(int section, const QDateTime &current, const QString &sectionText) const
{
return skipToNextSection(section, current, QStringRef(&sectionText));
}
QString stateName(State s) const;
enum FieldInfoFlag { enum FieldInfoFlag {
Numeric = 0x01, Numeric = 0x01,
FixedWidth = 0x02, FixedWidth = 0x02,
@ -241,17 +194,68 @@ public:
FieldInfo fieldInfo(int index) const; FieldInfo fieldInfo(int index) const;
void setDefaultLocale(const QLocale &loc) { defaultLocale = loc; } void setDefaultLocale(const QLocale &loc) { defaultLocale = loc; }
virtual QString displayText() const { return text; }
private:
int sectionMaxSize(Section s, int count) const;
QString sectionText(const QString &text, int sectionIndex, int index) const;
int parseSection(const QDateTime &currentValue, int sectionIndex, QString &txt, int &cursorPosition,
int index, QDateTimeParser::State &state, int *used = 0) const;
#ifndef QT_NO_TEXTDATE
int findMonth(const QString &str1, int monthstart, int sectionIndex,
QString *monthName = 0, int *used = 0) const;
int findDay(const QString &str1, int intDaystart, int sectionIndex,
QString *dayName = 0, int *used = 0) const;
#endif
enum AmPmFinder {
Neither = -1,
AM = 0,
PM = 1,
PossibleAM = 2,
PossiblePM = 3,
PossibleBoth = 4
};
AmPmFinder findAmPm(QString &str, int index, int *used = 0) const;
bool potentialValue(const QStringRef &str, int min, int max, int index,
const QDateTime &currentValue, int insert) const;
bool potentialValue(const QString &str, int min, int max, int index,
const QDateTime &currentValue, int insert) const
{
return potentialValue(QStringRef(&str), min, max, index, currentValue, insert);
}
protected: // for the benefit of QDateTimeEditPrivate
int sectionSize(int index) const;
int sectionMaxSize(int index) const;
int sectionPos(int index) const;
int sectionPos(const SectionNode &sn) const;
const SectionNode &sectionNode(int index) const;
Section sectionType(int index) const;
QString sectionText(int sectionIndex) const;
int getDigit(const QDateTime &dt, int index) const;
bool setDigit(QDateTime &t, int index, int newval) const;
int absoluteMax(int index, const QDateTime &value = QDateTime()) const;
int absoluteMin(int index) const;
bool skipToNextSection(int section, const QDateTime &current, const QStringRef &sectionText) const;
bool skipToNextSection(int section, const QDateTime &current, const QString &sectionText) const
{
return skipToNextSection(section, current, QStringRef(&sectionText));
}
QString stateName(State s) const;
virtual QDateTime getMinimum() const; virtual QDateTime getMinimum() const;
virtual QDateTime getMaximum() const; virtual QDateTime getMaximum() const;
virtual int cursorPosition() const { return -1; } virtual int cursorPosition() const { return -1; }
virtual QString displayText() const { return text; }
virtual QString getAmPmText(AmPm ap, Case cs) const; virtual QString getAmPmText(AmPm ap, Case cs) const;
virtual QLocale locale() const { return defaultLocale; } virtual QLocale locale() const { return defaultLocale; }
mutable int currentSectionIndex; mutable int currentSectionIndex;
Sections display; Sections display;
/* /*
This stores the stores the most recently selected day. This stores the most recently selected day.
It is useful when considering the following scenario: It is useful when considering the following scenario:
1. Date is: 31/01/2000 1. Date is: 31/01/2000
@ -271,9 +275,7 @@ public:
QString displayFormat; QString displayFormat;
QLocale defaultLocale; QLocale defaultLocale;
QVariant::Type parserType; QVariant::Type parserType;
bool fixday; bool fixday;
Qt::TimeSpec spec; // spec if used by QDateTimeEdit Qt::TimeSpec spec; // spec if used by QDateTimeEdit
Context context; Context context;
}; };

View File

@ -1605,7 +1605,7 @@ void QNetworkAccessManagerPrivate::_q_networkSessionClosed()
QObject::disconnect(networkSession.data(), SIGNAL(closed()), q, SLOT(_q_networkSessionClosed())); QObject::disconnect(networkSession.data(), SIGNAL(closed()), q, SLOT(_q_networkSessionClosed()));
QObject::disconnect(networkSession.data(), SIGNAL(stateChanged(QNetworkSession::State)), QObject::disconnect(networkSession.data(), SIGNAL(stateChanged(QNetworkSession::State)),
q, SLOT(_q_networkSessionStateChanged(QNetworkSession::State))); q, SLOT(_q_networkSessionStateChanged(QNetworkSession::State)));
QObject::disconnect(networkSessionStrongRef.data(), SIGNAL(error(QNetworkSession::SessionError)), QObject::disconnect(networkSession.data(), SIGNAL(error(QNetworkSession::SessionError)),
q, SLOT(_q_networkSessionFailed(QNetworkSession::SessionError))); q, SLOT(_q_networkSessionFailed(QNetworkSession::SessionError)));
networkSessionStrongRef.clear(); networkSessionStrongRef.clear();

View File

@ -71,7 +71,7 @@ inline NSMutableArray *qt_mac_QStringListToNSMutableArray(const QStringList &qst
NSImage *qt_mac_cgimage_to_nsimage(CGImageRef iamge); NSImage *qt_mac_cgimage_to_nsimage(CGImageRef iamge);
NSImage *qt_mac_create_nsimage(const QPixmap &pm); NSImage *qt_mac_create_nsimage(const QPixmap &pm);
NSImage *qt_mac_create_nsimage(const QIcon &icon); NSImage *qt_mac_create_nsimage(const QIcon &icon, int defaultSize = 0);
CGImageRef qt_mac_toCGImage(const QImage &qImage); CGImageRef qt_mac_toCGImage(const QImage &qImage);
CGImageRef qt_mac_toCGImageMask(const QImage &qImage); CGImageRef qt_mac_toCGImageMask(const QImage &qImage);
QImage qt_mac_toQImage(CGImageRef image); QImage qt_mac_toQImage(CGImageRef image);

View File

@ -181,13 +181,16 @@ NSImage *qt_mac_create_nsimage(const QPixmap &pm)
return nsImage; return nsImage;
} }
NSImage *qt_mac_create_nsimage(const QIcon &icon) NSImage *qt_mac_create_nsimage(const QIcon &icon, int defaultSize)
{ {
if (icon.isNull()) if (icon.isNull())
return nil; return nil;
NSImage *nsImage = [[NSImage alloc] init]; NSImage *nsImage = [[NSImage alloc] init];
foreach (QSize size, icon.availableSizes()) { QList<QSize> availableSizes = icon.availableSizes();
if (availableSizes.isEmpty() && defaultSize > 0)
availableSizes << QSize(defaultSize, defaultSize);
foreach (QSize size, availableSizes) {
QPixmap pm = icon.pixmap(size); QPixmap pm = icon.pixmap(size);
QImage image = pm.toImage(); QImage image = pm.toImage();
CGImageRef cgImage = qt_mac_toCGImage(image); CGImageRef cgImage = qt_mac_toCGImage(image);

View File

@ -356,7 +356,7 @@ NSMenuItem *QCocoaMenuItem::sync()
NSImage *img = nil; NSImage *img = nil;
if (!m_icon.isNull()) { if (!m_icon.isNull()) {
img = qt_mac_create_nsimage(m_icon); img = qt_mac_create_nsimage(m_icon, m_iconSize);
[img setSize:NSMakeSize(m_iconSize, m_iconSize)]; [img setSize:NSMakeSize(m_iconSize, m_iconSize)];
} }
[m_native setImage:img]; [m_native setImage:img];

View File

@ -867,6 +867,9 @@ bool QWindowsKeyMapper::translateKeyEvent(QWindow *widget, HWND hwnd,
bool QWindowsKeyMapper::translateMultimediaKeyEventInternal(QWindow *window, const MSG &msg) bool QWindowsKeyMapper::translateMultimediaKeyEventInternal(QWindow *window, const MSG &msg)
{ {
#if defined(WM_APPCOMMAND) #if defined(WM_APPCOMMAND)
// QTBUG-57198, do not send mouse-synthesized commands as key events in addition
if (GET_DEVICE_LPARAM(msg.lParam) == FAPPCOMMAND_MOUSE)
return false;
const int cmd = GET_APPCOMMAND_LPARAM(msg.lParam); const int cmd = GET_APPCOMMAND_LPARAM(msg.lParam);
const int dwKeys = GET_KEYSTATE_LPARAM(msg.lParam); const int dwKeys = GET_KEYSTATE_LPARAM(msg.lParam);
int state = 0; int state = 0;

View File

@ -1619,7 +1619,7 @@ QString QMYSQLDriver::formatValue(const QSqlField &field, bool trimStrings) cons
Q_D(const QMYSQLDriver); Q_D(const QMYSQLDriver);
QString r; QString r;
if (field.isNull()) { if (field.isNull()) {
r = QLatin1String("NULL"); r = QStringLiteral("NULL");
} else { } else {
switch(field.type()) { switch(field.type()) {
case QVariant::Double: case QVariant::Double: