Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/5.8' into 5.9
Browse files Browse the repository at this point in the history
Conflicts:
	src/corelib/plugin/qlibrary_unix.cpp
	src/plugins/platforms/xcb/qxcbconnection.cpp
	tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp

Change-Id: I632c400d909f8c204f55743aadc7886af2f15dfb
  • Loading branch information
liangqi committed Feb 16, 2017
2 parents 99ce1d3 + de225cc commit c577f6e
Show file tree
Hide file tree
Showing 48 changed files with 97,004 additions and 279 deletions.
6 changes: 3 additions & 3 deletions examples/embedded/flightinfo/flightinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,9 @@ public slots:
int i = data.indexOf("a href=\"?view=detail");
if (i > 0) {
QString href = data.mid(i, data.indexOf('\"', i + 8) - i + 1);
QRegExp regex("dpap=([A-Za-z0-9]+)");
regex.indexIn(href);
QString airport = regex.cap(1);
QRegularExpression regex("dpap=([A-Za-z0-9]+)");
QRegularExpressionMatch match = regex.match(href);
QString airport = match.captured(1);
QUrlQuery query(m_url);
query.addQueryItem("dpap", airport);
m_url.setQuery(query);
Expand Down
9 changes: 5 additions & 4 deletions examples/opengl/legacy/grabber/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,11 @@ QSize MainWindow::getSize()
if (!ok)
return QSize();

QRegExp regExp(tr("([0-9]+) *x *([0-9]+)"));
if (regExp.exactMatch(text)) {
int width = regExp.cap(1).toInt();
int height = regExp.cap(2).toInt();
QRegularExpression regExp(tr("^([0-9]+) *x *([0-9]+)$"));
QRegularExpressionMatch match = regExp.match(text);
if (match.hasMatch()) {
int width = match.captured(1).toInt();
int height = match.captured(2).toInt();
if (width > 0 && width < 2048 && height > 0 && height < 2048)
return QSize(width, height);
}
Expand Down
9 changes: 4 additions & 5 deletions examples/widgets/painting/shared/arthurwidgets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
#include <QFile>
#include <QTextBrowser>
#include <QBoxLayout>
#include <QRegularExpression>

extern QPixmap cached(const QString &img);

Expand Down Expand Up @@ -339,14 +340,12 @@ void ArthurFrame::showSource()
foreach (QString keyword, ppKeywords)
contents.replace(keyword, QLatin1String("<font color=navy>") + keyword + QLatin1String("</font>"));

contents.replace(QRegExp("(\\d\\d?)"), QLatin1String("<font color=navy>\\1</font>"));
contents.replace(QRegularExpression("(\\d\\d?)"), QLatin1String("<font color=navy>\\1</font>"));

QRegExp commentRe("(//.+)\\n");
commentRe.setMinimal(true);
QRegularExpression commentRe("(//.+?)\\n");
contents.replace(commentRe, QLatin1String("<font color=red>\\1</font>\n"));

QRegExp stringLiteralRe("(\".+\")");
stringLiteralRe.setMinimal(true);
QRegularExpression stringLiteralRe("(\".+?\")");
contents.replace(stringLiteralRe, QLatin1String("<font color=green>\\1</font>"));

QString html = contents;
Expand Down
7 changes: 4 additions & 3 deletions examples/widgets/tools/codecs/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ void MainWindow::aboutToShowSaveAsMenu()
void MainWindow::findCodecs()
{
QMap<QString, QTextCodec *> codecMap;
QRegExp iso8859RegExp("ISO[- ]8859-([0-9]+).*");
QRegularExpression iso8859RegExp("^ISO[- ]8859-([0-9]+).*$");
QRegularExpressionMatch match;

foreach (int mib, QTextCodec::availableMibs()) {
QTextCodec *codec = QTextCodec::codecForMib(mib);
Expand All @@ -150,8 +151,8 @@ void MainWindow::findCodecs()
rank = 1;
} else if (sortKey.startsWith(QLatin1String("UTF-16"))) {
rank = 2;
} else if (iso8859RegExp.exactMatch(sortKey)) {
if (iso8859RegExp.cap(1).size() == 1)
} else if ((match = iso8859RegExp.match(sortKey)).hasMatch()) {
if (match.captured(1).size() == 1)
rank = 3;
else
rank = 4;
Expand Down
39 changes: 20 additions & 19 deletions examples/widgets/tools/settingseditor/variantdelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ VariantDelegate::VariantDelegate(QObject *parent)
: QItemDelegate(parent)
{
boolExp.setPattern("true|false");
boolExp.setCaseSensitivity(Qt::CaseInsensitive);
boolExp.setPatternOptions(QRegularExpression::CaseInsensitiveOption);

byteArrayExp.setPattern("[\\x00-\\xff]*");
charExp.setPattern(".");
colorExp.setPattern("\\(([0-9]*),([0-9]*),([0-9]*),([0-9]*)\\)");
colorExp.setPattern("^\\(([0-9]*),([0-9]*),([0-9]*),([0-9]*)\\)$");
doubleExp.setPattern("");
pointExp.setPattern("\\((-?[0-9]*),(-?[0-9]*)\\)");
rectExp.setPattern("\\((-?[0-9]*),(-?[0-9]*),(-?[0-9]*),(-?[0-9]*)\\)");
pointExp.setPattern("^\\((-?[0-9]*),(-?[0-9]*)\\)$");
rectExp.setPattern("^\\((-?[0-9]*),(-?[0-9]*),(-?[0-9]*),(-?[0-9]*)\\)$");
signedIntegerExp.setPattern("-?[0-9]*");
sizeExp = pointExp;
unsignedIntegerExp.setPattern("[0-9]*");
Expand Down Expand Up @@ -104,7 +104,7 @@ QWidget *VariantDelegate::createEditor(QWidget *parent,
QLineEdit *lineEdit = new QLineEdit(parent);
lineEdit->setFrame(false);

QRegExp regExp;
QRegularExpression regExp;

switch (originalValue.type()) {
case QVariant::Bool:
Expand Down Expand Up @@ -152,8 +152,8 @@ QWidget *VariantDelegate::createEditor(QWidget *parent,
;
}

if (!regExp.isEmpty()) {
QValidator *validator = new QRegExpValidator(regExp, lineEdit);
if (regExp.isValid()) {
QValidator *validator = new QRegularExpressionValidator(regExp, lineEdit);
lineEdit->setValidator(validator);
}

Expand Down Expand Up @@ -185,17 +185,18 @@ void VariantDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,

QVariant originalValue = index.model()->data(index, Qt::UserRole);
QVariant value;
QRegularExpressionMatch match;

switch (originalValue.type()) {
case QVariant::Char:
value = text.at(0);
break;
case QVariant::Color:
colorExp.exactMatch(text);
value = QColor(qMin(colorExp.cap(1).toInt(), 255),
qMin(colorExp.cap(2).toInt(), 255),
qMin(colorExp.cap(3).toInt(), 255),
qMin(colorExp.cap(4).toInt(), 255));
match = colorExp.match(text);
value = QColor(qMin(match.captured(1).toInt(), 255),
qMin(match.captured(2).toInt(), 255),
qMin(match.captured(3).toInt(), 255),
qMin(match.captured(4).toInt(), 255));
break;
case QVariant::Date:
{
Expand All @@ -214,17 +215,17 @@ void VariantDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
}
break;
case QVariant::Point:
pointExp.exactMatch(text);
value = QPoint(pointExp.cap(1).toInt(), pointExp.cap(2).toInt());
match = pointExp.match(text);
value = QPoint(match.captured(1).toInt(), match.captured(2).toInt());
break;
case QVariant::Rect:
rectExp.exactMatch(text);
value = QRect(rectExp.cap(1).toInt(), rectExp.cap(2).toInt(),
rectExp.cap(3).toInt(), rectExp.cap(4).toInt());
match = rectExp.match(text);
value = QRect(match.captured(1).toInt(), match.captured(2).toInt(),
match.captured(3).toInt(), match.captured(4).toInt());
break;
case QVariant::Size:
sizeExp.exactMatch(text);
value = QSize(sizeExp.cap(1).toInt(), sizeExp.cap(2).toInt());
match = sizeExp.match(text);
value = QSize(match.captured(1).toInt(), match.captured(2).toInt());
break;
case QVariant::StringList:
value = text.split(',');
Expand Down
28 changes: 14 additions & 14 deletions examples/widgets/tools/settingseditor/variantdelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
#define VARIANTDELEGATE_H

#include <QItemDelegate>
#include <QRegExp>
#include <QRegularExpression>

class VariantDelegate : public QItemDelegate
{
Expand All @@ -73,19 +73,19 @@ class VariantDelegate : public QItemDelegate
static QString displayText(const QVariant &value);

private:
mutable QRegExp boolExp;
mutable QRegExp byteArrayExp;
mutable QRegExp charExp;
mutable QRegExp colorExp;
mutable QRegExp dateExp;
mutable QRegExp dateTimeExp;
mutable QRegExp doubleExp;
mutable QRegExp pointExp;
mutable QRegExp rectExp;
mutable QRegExp signedIntegerExp;
mutable QRegExp sizeExp;
mutable QRegExp timeExp;
mutable QRegExp unsignedIntegerExp;
mutable QRegularExpression boolExp;
mutable QRegularExpression byteArrayExp;
mutable QRegularExpression charExp;
mutable QRegularExpression colorExp;
mutable QRegularExpression dateExp;
mutable QRegularExpression dateTimeExp;
mutable QRegularExpression doubleExp;
mutable QRegularExpression pointExp;
mutable QRegularExpression rectExp;
mutable QRegularExpression signedIntegerExp;
mutable QRegularExpression sizeExp;
mutable QRegularExpression timeExp;
mutable QRegularExpression unsignedIntegerExp;
};

#endif
7 changes: 4 additions & 3 deletions examples/widgets/widgets/stylesheet/stylesheeteditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,12 @@ StyleSheetEditor::StyleSheetEditor(QWidget *parent)
{
ui.setupUi(this);

QRegExp regExp(".(.*)\\+?Style");
QRegularExpression regExp("^.(.*)\\+?Style$");
QString defaultStyle = QApplication::style()->metaObject()->className();
QRegularExpressionMatch match = regExp.match(defaultStyle);

if (regExp.exactMatch(defaultStyle))
defaultStyle = regExp.cap(1);
if (match.hasMatch())
defaultStyle = match.captured(1);

ui.styleCombo->addItems(QStyleFactory::keys());
ui.styleCombo->setCurrentIndex(ui.styleCombo->findText(defaultStyle, Qt::MatchContains));
Expand Down
18 changes: 2 additions & 16 deletions qmake/doc/src/qmake-manual.qdoc
Original file line number Diff line number Diff line change
Expand Up @@ -1230,10 +1230,6 @@
This variable is also used to specify which additional files will be
deployed to embedded devices.

For Windows CE, the default deployment target path is
\c{%CSIDL_PROGRAM_FILES%\target}, which usually gets expanded to
\c{\Program Files\target}.

\target LEXIMPLS
\section1 LEXIMPLS

Expand Down Expand Up @@ -2354,16 +2350,6 @@
qmake or \l{#QMAKESPEC}{qmake.conf} and rarely
needs to be modified.

\target SIGNATURE_FILE
\section1 SIGNATURE_FILE

\note This variable is only used on Windows CE.

Specifies which signature file should be used to sign the project target.

\note This variable will overwrite the setting you have specified in configure,
with the \c -signature option.

\target SOURCES
\section1 SOURCES

Expand Down Expand Up @@ -4483,8 +4469,8 @@
include the precompiled header file in \c HEADERS, as
qmake will do this if the configuration supports precompiled headers.

The MSVC and g++ specs targeting Windows (and Windows CE) enable
\c precompile_header by default.
The MSVC and g++ specs targeting Windows enable \c precompile_header
by default.

Using this option, you may trigger
conditional blocks in your project file to add settings when using
Expand Down
21 changes: 16 additions & 5 deletions src/android/jar/src/org/qtproject/qt5/android/QtNative.java
Original file line number Diff line number Diff line change
Expand Up @@ -243,13 +243,24 @@ private static void runAction(Runnable action)
}
}

private static void runPendingCppRunnablesOnUiThread()
private static void runPendingCppRunnablesOnAndroidThread()
{
synchronized (m_mainActivityMutex) {
if (!m_activityPaused && m_activity != null)
m_activity.runOnUiThread(runPendingCppRunnablesRunnable);
else
runAction(runPendingCppRunnablesRunnable);
if (m_activity != null) {
if (!m_activityPaused)
m_activity.runOnUiThread(runPendingCppRunnablesRunnable);
else
runAction(runPendingCppRunnablesRunnable);
} else {
final Looper mainLooper = Looper.getMainLooper();
final Thread looperThread = mainLooper.getThread();
if (looperThread.equals(Thread.currentThread())) {
runPendingCppRunnablesRunnable.run();
} else {
final Handler handler = new Handler(mainLooper);
handler.post(runPendingCppRunnablesRunnable);
}
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/corelib/configure.json
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,7 @@
},
"dlopen": {
"label": "dlopen()",
"condition": "tests.dlopen || libs.libdl",
"output": [ { "type": "define", "negative": true, "name": "QT_NO_DYNAMIC_LIBRARY" } ]
"condition": "tests.dlopen || libs.libdl"
},
"libdl": {
"label": "dlopen() in libdl",
Expand Down Expand Up @@ -463,6 +462,7 @@
"label": "QLibrary",
"purpose": "Provides a wrapper for dynamically loaded libraries.",
"section": "File I/O",
"condition": "config.win32 || config.hpux || (!config.nacl && features.dlopen)",
"output": [ "publicFeature", "feature" ]
},
"settings": {
Expand Down
16 changes: 8 additions & 8 deletions src/corelib/doc/snippets/events/events.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,15 @@ class MyCustomEvent : public QEvent
bool MyWidget::event(QEvent *event)
{
if (event->type() == QEvent::KeyPress) {
QKeyEvent *ke = static_cast<QKeyEvent *>(event);
if (ke->key() == Qt::Key_Tab) {
// special tab handling here
return true;
}
QKeyEvent *ke = static_cast<QKeyEvent *>(event);
if (ke->key() == Qt::Key_Tab) {
// special tab handling here
return true;
}
} else if (event->type() == MyCustomEventType) {
MyCustomEvent *myEvent = static_cast<MyCustomEvent *>(event);
// custom event handling here
return true;
MyCustomEvent *myEvent = static_cast<MyCustomEvent *>(event);
// custom event handling here
return true;
}

return QWidget::event(event);
Expand Down
2 changes: 1 addition & 1 deletion src/corelib/global/qnamespace.qdoc
Original file line number Diff line number Diff line change
Expand Up @@ -2105,7 +2105,7 @@
On \macos, tool windows correspond to the
\l{http://developer.apple.com/documentation/Carbon/Conceptual/HandlingWindowsControls/hitb-wind_cont_concept/chapter_2_section_2.html}{Floating}
class of windows. This means that the window lives on a
level above normal windows; it impossible to put a normal
level above normal windows making it impossible to put a normal
window on top of it. By default, tool windows will disappear
when the application is inactive. This can be controlled by
the Qt::WA_MacAlwaysShowToolWindow attribute.
Expand Down
Loading

0 comments on commit c577f6e

Please sign in to comment.