summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config_help.txt3
-rw-r--r--configure.json1
-rw-r--r--examples/widgets/itemviews/addressbook/tablemodel.cpp2
-rw-r--r--examples/widgets/itemviews/chart/mainwindow.cpp18
-rw-r--r--examples/widgets/itemviews/chart/mainwindow.h8
-rw-r--r--examples/widgets/itemviews/chart/pieview.cpp56
-rw-r--r--examples/widgets/itemviews/chart/pieview.h14
-rw-r--r--examples/widgets/itemviews/editabletreemodel/treemodel.cpp2
-rw-r--r--examples/widgets/tutorials/modelview/1_readonly/main.cpp8
-rw-r--r--examples/widgets/tutorials/modelview/1_readonly/mymodel.cpp5
-rw-r--r--examples/widgets/tutorials/modelview/1_readonly/mymodel.h4
-rw-r--r--examples/widgets/tutorials/modelview/2_formatting/main.cpp8
-rw-r--r--examples/widgets/tutorials/modelview/2_formatting/mymodel.cpp24
-rw-r--r--examples/widgets/tutorials/modelview/2_formatting/mymodel.h4
-rw-r--r--examples/widgets/tutorials/modelview/3_changingmodel/main.cpp6
-rw-r--r--examples/widgets/tutorials/modelview/3_changingmodel/mymodel.cpp23
-rw-r--r--examples/widgets/tutorials/modelview/3_changingmodel/mymodel.h7
-rw-r--r--examples/widgets/tutorials/modelview/4_headers/main.cpp10
-rw-r--r--examples/widgets/tutorials/modelview/4_headers/mymodel.cpp25
-rw-r--r--examples/widgets/tutorials/modelview/4_headers/mymodel.h4
-rw-r--r--examples/widgets/tutorials/modelview/5_edit/main.cpp2
-rw-r--r--examples/widgets/tutorials/modelview/5_edit/mainwindow.cpp14
-rw-r--r--examples/widgets/tutorials/modelview/5_edit/mainwindow.h8
-rw-r--r--examples/widgets/tutorials/modelview/5_edit/mymodel.cpp30
-rw-r--r--examples/widgets/tutorials/modelview/5_edit/mymodel.h8
-rw-r--r--examples/widgets/tutorials/modelview/6_treeview/main.cpp2
-rw-r--r--examples/widgets/tutorials/modelview/6_treeview/mainwindow.cpp23
-rw-r--r--examples/widgets/tutorials/modelview/6_treeview/mainwindow.h12
-rw-r--r--examples/widgets/tutorials/modelview/7_selections/main.cpp2
-rw-r--r--examples/widgets/tutorials/modelview/7_selections/mainwindow.cpp18
-rw-r--r--examples/widgets/tutorials/modelview/7_selections/mainwindow.h6
-rw-r--r--mkspecs/macx-xcode/default.xcscheme1
-rw-r--r--mkspecs/win32-arm64-msvc2017/qmake.conf15
-rw-r--r--mkspecs/win32-arm64-msvc2017/qplatformdefs.h40
-rw-r--r--qmake/generators/win32/msvc_nmake.cpp46
-rw-r--r--src/3rdparty/angle/src/common/mathutil.h8
-rw-r--r--src/3rdparty/angle/src/common/platform.h2
-rw-r--r--src/3rdparty/sha3/qt_attribution.json2
-rw-r--r--src/angle/patches/0011-ANGLE-Fix-build-for-ARM64.patch63
-rw-r--r--src/corelib/global/qprocessordetection.h9
-rw-r--r--src/corelib/io/qfilesystemengine_unix.cpp2
-rw-r--r--src/corelib/io/qfilesystemwatcher_inotify.cpp21
-rw-r--r--src/corelib/thread/qthreadpool.cpp79
-rw-r--r--src/corelib/thread/qthreadpool_p.h6
-rw-r--r--src/corelib/tools/qline.cpp7
-rw-r--r--src/corelib/tools/qt_attribution.json4
-rw-r--r--src/gui/doc/snippets/qimagewriter/main.cpp71
-rw-r--r--src/gui/image/qimagewriter.cpp10
-rw-r--r--src/gui/kernel/qscreen.cpp7
-rw-r--r--src/gui/text/qtextdocument.cpp2
-rw-r--r--src/network/socket/qnativesocketengine_unix.cpp14
-rw-r--r--src/plugins/platforms/cocoa/qcocoascreen.mm5
-rw-r--r--src/plugins/platforms/windows/qwindowsdialoghelpers.cpp7
-rw-r--r--src/plugins/platforms/windows/qwindowskeymapper.cpp7
-rw-r--r--src/plugins/platforms/xcb/qxcbbackingstore.cpp3
-rw-r--r--src/plugins/styles/mac/qmacstyle_mac.mm2
-rw-r--r--src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp5
-rw-r--r--src/widgets/dialogs/qmessagebox.cpp6
-rw-r--r--src/widgets/kernel/qwidgetbackingstore.cpp7
-rw-r--r--src/widgets/kernel/qwidgetwindow.cpp3
-rw-r--r--tests/auto/corelib/io/qsettings/BLACKLIST2
-rw-r--r--tests/auto/gui/kernel/qwindow/BLACKLIST1
-rw-r--r--tests/auto/other/macnativeevents/BLACKLIST1
-rw-r--r--tests/auto/testlib/selftests/test/BLACKLIST3
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsscene/BLACKLIST4
-rw-r--r--tests/auto/widgets/kernel/qwidget/BLACKLIST1
-rw-r--r--tests/auto/widgets/widgets/qmenu/BLACKLIST1
-rw-r--r--tests/manual/dialogs/main.cpp11
-rw-r--r--util/unicode/README31
-rw-r--r--util/unicode/main.cpp11
70 files changed, 572 insertions, 305 deletions
diff --git a/config_help.txt b/config_help.txt
index f8da33d4ec..4778ddb336 100644
--- a/config_help.txt
+++ b/config_help.txt
@@ -216,7 +216,8 @@ Component selection:
[libs and examples, also tools if not cross-building,
also tests if -developer-build]
-nomake <part> ....... Exclude <part> from the list of parts to be built.
- -compile-examples .... When unset, install only the sources of examples [yes]
+ -compile-examples .... When unset, install only the sources of examples
+ [no on WebAssembly, otherwise yes]
-gui ................. Build the Qt GUI module and dependencies [yes]
-widgets ............. Build the Qt Widgets module and dependencies [yes]
-no-dbus ............. Do not build the Qt D-Bus module
diff --git a/configure.json b/configure.json
index d6568b9a7f..8cffe9fb01 100644
--- a/configure.json
+++ b/configure.json
@@ -1214,6 +1214,7 @@
},
"compile_examples": {
"label": "Compile examples",
+ "autoDetect": "!config.wasm",
"output": [ "privateConfig" ]
},
"incredibuild_xge": {
diff --git a/examples/widgets/itemviews/addressbook/tablemodel.cpp b/examples/widgets/itemviews/addressbook/tablemodel.cpp
index 674e312753..b3704f857e 100644
--- a/examples/widgets/itemviews/addressbook/tablemodel.cpp
+++ b/examples/widgets/itemviews/addressbook/tablemodel.cpp
@@ -164,7 +164,7 @@ bool TableModel::setData(const QModelIndex &index, const QVariant &value, int ro
return false;
contacts.replace(row, contact);
- emit(dataChanged(index, index));
+ emit dataChanged(index, index, {role});
return true;
}
diff --git a/examples/widgets/itemviews/chart/mainwindow.cpp b/examples/widgets/itemviews/chart/mainwindow.cpp
index 91e535a006..53f57fbb49 100644
--- a/examples/widgets/itemviews/chart/mainwindow.cpp
+++ b/examples/widgets/itemviews/chart/mainwindow.cpp
@@ -48,12 +48,13 @@
**
****************************************************************************/
-#include <QtWidgets>
-
#include "pieview.h"
#include "mainwindow.h"
-MainWindow::MainWindow()
+#include <QtWidgets>
+
+MainWindow::MainWindow(QWidget *parent)
+ : QMainWindow(parent)
{
QMenu *fileMenu = new QMenu(tr("&File"), this);
QAction *openAction = fileMenu->addAction(tr("&Open..."));
@@ -124,17 +125,18 @@ void MainWindow::loadFile(const QString &fileName)
return;
QTextStream stream(&file);
- QString line;
model->removeRows(0, model->rowCount(QModelIndex()), QModelIndex());
int row = 0;
- do {
- line = stream.readLine();
+ while (!stream.atEnd()) {
+ const QString line = stream.readLine();
if (!line.isEmpty()) {
model->insertRows(row, 1, QModelIndex());
- QStringList pieces = line.split(',', QString::SkipEmptyParts);
+ const QStringList pieces = line.split(',', QString::SkipEmptyParts);
+ if (pieces.size() < 3)
+ continue;
model->setData(model->index(row, 0, QModelIndex()),
pieces.value(0));
model->setData(model->index(row, 1, QModelIndex()),
@@ -143,7 +145,7 @@ void MainWindow::loadFile(const QString &fileName)
QColor(pieces.value(2)), Qt::DecorationRole);
row++;
}
- } while (!line.isEmpty());
+ };
file.close();
statusBar()->showMessage(tr("Loaded %1").arg(fileName), 2000);
diff --git a/examples/widgets/itemviews/chart/mainwindow.h b/examples/widgets/itemviews/chart/mainwindow.h
index 058f5c7e90..51176d261b 100644
--- a/examples/widgets/itemviews/chart/mainwindow.h
+++ b/examples/widgets/itemviews/chart/mainwindow.h
@@ -56,7 +56,6 @@
QT_BEGIN_NAMESPACE
class QAbstractItemModel;
class QAbstractItemView;
-class QItemSelectionModel;
QT_END_NAMESPACE
class MainWindow : public QMainWindow
@@ -64,7 +63,7 @@ class MainWindow : public QMainWindow
Q_OBJECT
public:
- MainWindow();
+ MainWindow(QWidget *parent = nullptr);
private slots:
void openFile();
@@ -75,9 +74,8 @@ private:
void setupViews();
void loadFile(const QString &path);
- QAbstractItemModel *model;
- QAbstractItemView *pieChart;
- QItemSelectionModel *selectionModel;
+ QAbstractItemModel *model = nullptr;
+ QAbstractItemView *pieChart = nullptr;
};
#endif // MAINWINDOW_H
diff --git a/examples/widgets/itemviews/chart/pieview.cpp b/examples/widgets/itemviews/chart/pieview.cpp
index 3f85e397ee..457ed8b4ec 100644
--- a/examples/widgets/itemviews/chart/pieview.cpp
+++ b/examples/widgets/itemviews/chart/pieview.cpp
@@ -48,30 +48,25 @@
**
****************************************************************************/
-#include <QtWidgets>
-#include <qmath.h>
-#include <cmath>
#include "pieview.h"
+#include <QtWidgets>
+
PieView::PieView(QWidget *parent)
: QAbstractItemView(parent)
{
horizontalScrollBar()->setRange(0, 0);
verticalScrollBar()->setRange(0, 0);
-
- margin = 8;
- totalSize = 300;
- pieSize = totalSize - 2 * margin;
- validItems = 0;
- totalValue = 0.0;
- rubberBand = 0;
}
void PieView::dataChanged(const QModelIndex &topLeft,
const QModelIndex &bottomRight,
- const QVector<int> &)
+ const QVector<int> &roles)
{
- QAbstractItemView::dataChanged(topLeft, bottomRight);
+ QAbstractItemView::dataChanged(topLeft, bottomRight, roles);
+
+ if (!roles.contains(Qt::DisplayRole))
+ return;
validItems = 0;
totalValue = 0.0;
@@ -79,7 +74,7 @@ void PieView::dataChanged(const QModelIndex &topLeft,
for (int row = 0; row < model()->rowCount(rootIndex()); ++row) {
QModelIndex index = model()->index(row, 1, rootIndex());
- double value = model()->data(index).toDouble();
+ double value = model()->data(index, Qt::DisplayRole).toDouble();
if (value > 0.0) {
totalValue += value;
@@ -197,15 +192,14 @@ QRect PieView::itemRect(const QModelIndex &index) const
listItem++;
}
- double itemHeight;
-
switch (index.column()) {
- case 0:
- itemHeight = QFontMetrics(viewOptions().font).height();
+ case 0: {
+ const qreal itemHeight = QFontMetricsF(viewOptions().font).height();
return QRect(totalSize,
- int(margin + listItem*itemHeight),
- totalSize - margin, int(itemHeight));
+ qRound(margin + listItem * itemHeight),
+ totalSize - margin, qRound(itemHeight));
+ }
case 1:
return viewport()->rect();
}
@@ -235,7 +229,7 @@ QRegion PieView::itemRegion(const QModelIndex &index) const
if (sliceIndex == index) {
QPainterPath slicePath;
slicePath.moveTo(totalSize / 2, totalSize / 2);
- slicePath.arcTo(margin, margin, margin+pieSize, margin+pieSize,
+ slicePath.arcTo(margin, margin, margin + pieSize, margin + pieSize,
startAngle, angle);
slicePath.closeSubpath();
@@ -342,7 +336,7 @@ void PieView::paintEvent(QPaintEvent *event)
double value = model()->data(index).toDouble();
if (value > 0.0) {
- double angle = 360*value/totalValue;
+ double angle = 360 * value / totalValue;
QModelIndex colorIndex = model()->index(row, 0, rootIndex());
QColor color = QColor(model()->data(colorIndex, Qt::DecorationRole).toString());
@@ -480,16 +474,16 @@ void PieView::setSelection(const QRect &rect, QItemSelectionModel::SelectionFlag
}
if (indexes.size() > 0) {
- int firstRow = indexes[0].row();
- int lastRow = indexes[0].row();
- int firstColumn = indexes[0].column();
- int lastColumn = indexes[0].column();
+ int firstRow = indexes.at(0).row();
+ int lastRow = firstRow;
+ int firstColumn = indexes.at(0).column();
+ int lastColumn = firstColumn;
for (int i = 1; i < indexes.size(); ++i) {
- firstRow = qMin(firstRow, indexes[i].row());
- lastRow = qMax(lastRow, indexes[i].row());
- firstColumn = qMin(firstColumn, indexes[i].column());
- lastColumn = qMax(lastColumn, indexes[i].column());
+ firstRow = qMin(firstRow, indexes.at(i).row());
+ lastRow = qMax(lastRow, indexes.at(i).row());
+ firstColumn = qMin(firstColumn, indexes.at(i).column());
+ lastColumn = qMax(lastColumn, indexes.at(i).column());
}
QItemSelection selection(
@@ -508,7 +502,7 @@ void PieView::setSelection(const QRect &rect, QItemSelectionModel::SelectionFlag
void PieView::updateGeometries()
{
horizontalScrollBar()->setPageStep(viewport()->width());
- horizontalScrollBar()->setRange(0, qMax(0, 2*totalSize - viewport()->width()));
+ horizontalScrollBar()->setRange(0, qMax(0, 2 * totalSize - viewport()->width()));
verticalScrollBar()->setPageStep(viewport()->height());
verticalScrollBar()->setRange(0, qMax(0, totalSize - viewport()->height()));
}
@@ -546,7 +540,7 @@ QRegion PieView::visualRegionForSelection(const QItemSelection &selection) const
QRegion region;
for (int i = 0; i < ranges; ++i) {
- QItemSelectionRange range = selection.at(i);
+ const QItemSelectionRange &range = selection.at(i);
for (int row = range.top(); row <= range.bottom(); ++row) {
for (int col = range.left(); col <= range.right(); ++col) {
QModelIndex index = model()->index(row, col, rootIndex());
diff --git a/examples/widgets/itemviews/chart/pieview.h b/examples/widgets/itemviews/chart/pieview.h
index aa397e6d55..22c74dde81 100644
--- a/examples/widgets/itemviews/chart/pieview.h
+++ b/examples/widgets/itemviews/chart/pieview.h
@@ -59,7 +59,7 @@ class PieView : public QAbstractItemView
Q_OBJECT
public:
- PieView(QWidget *parent = 0);
+ PieView(QWidget *parent = nullptr);
QRect visualRect(const QModelIndex &index) const override;
void scrollTo(const QModelIndex &index, ScrollHint hint = EnsureVisible) override;
@@ -100,13 +100,13 @@ private:
int rows(const QModelIndex &index = QModelIndex()) const;
void updateGeometries() override;
- int margin;
- int totalSize;
- int pieSize;
- int validItems;
- double totalValue;
+ int margin = 0;
+ int totalSize = 300;
+ int pieSize = totalSize - 2 * margin;
+ int validItems = 0;
+ double totalValue = 0.0;
+ QRubberBand *rubberBand = nullptr;
QPoint origin;
- QRubberBand *rubberBand;
};
//! [0]
diff --git a/examples/widgets/itemviews/editabletreemodel/treemodel.cpp b/examples/widgets/itemviews/editabletreemodel/treemodel.cpp
index dbd53df1e6..72818372d7 100644
--- a/examples/widgets/itemviews/editabletreemodel/treemodel.cpp
+++ b/examples/widgets/itemviews/editabletreemodel/treemodel.cpp
@@ -225,7 +225,7 @@ bool TreeModel::setData(const QModelIndex &index, const QVariant &value, int rol
bool result = item->setData(index.column(), value);
if (result)
- emit dataChanged(index, index);
+ emit dataChanged(index, index, {role});
return result;
}
diff --git a/examples/widgets/tutorials/modelview/1_readonly/main.cpp b/examples/widgets/tutorials/modelview/1_readonly/main.cpp
index 80383f8c94..ea571d3699 100644
--- a/examples/widgets/tutorials/modelview/1_readonly/main.cpp
+++ b/examples/widgets/tutorials/modelview/1_readonly/main.cpp
@@ -50,16 +50,16 @@
//! [Quoting ModelView Tutorial]
// main.cpp
-#include <QtWidgets/QApplication>
-#include <QtWidgets/QTableView>
+#include <QApplication>
+#include <QTableView>
#include "mymodel.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QTableView tableView;
- MyModel myModel(0);
- tableView.setModel( &myModel );
+ MyModel myModel;
+ tableView.setModel(&myModel);
tableView.show();
return a.exec();
}
diff --git a/examples/widgets/tutorials/modelview/1_readonly/mymodel.cpp b/examples/widgets/tutorials/modelview/1_readonly/mymodel.cpp
index 82ec53c665..2b36565bc6 100644
--- a/examples/widgets/tutorials/modelview/1_readonly/mymodel.cpp
+++ b/examples/widgets/tutorials/modelview/1_readonly/mymodel.cpp
@@ -53,7 +53,7 @@
#include "mymodel.h"
MyModel::MyModel(QObject *parent)
- :QAbstractTableModel(parent)
+ : QAbstractTableModel(parent)
{
}
@@ -70,11 +70,10 @@ int MyModel::columnCount(const QModelIndex & /*parent*/) const
QVariant MyModel::data(const QModelIndex &index, int role) const
{
if (role == Qt::DisplayRole)
- {
return QString("Row%1, Column%2")
.arg(index.row() + 1)
.arg(index.column() +1);
- }
+
return QVariant();
}
//! [Quoting ModelView Tutorial]
diff --git a/examples/widgets/tutorials/modelview/1_readonly/mymodel.h b/examples/widgets/tutorials/modelview/1_readonly/mymodel.h
index e675cc6bc2..8761322896 100644
--- a/examples/widgets/tutorials/modelview/1_readonly/mymodel.h
+++ b/examples/widgets/tutorials/modelview/1_readonly/mymodel.h
@@ -59,8 +59,8 @@ class MyModel : public QAbstractTableModel
{
Q_OBJECT
public:
- MyModel(QObject *parent);
- int rowCount(const QModelIndex &parent = QModelIndex()) const override ;
+ MyModel(QObject *parent = nullptr);
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
};
diff --git a/examples/widgets/tutorials/modelview/2_formatting/main.cpp b/examples/widgets/tutorials/modelview/2_formatting/main.cpp
index 80383f8c94..ea571d3699 100644
--- a/examples/widgets/tutorials/modelview/2_formatting/main.cpp
+++ b/examples/widgets/tutorials/modelview/2_formatting/main.cpp
@@ -50,16 +50,16 @@
//! [Quoting ModelView Tutorial]
// main.cpp
-#include <QtWidgets/QApplication>
-#include <QtWidgets/QTableView>
+#include <QApplication>
+#include <QTableView>
#include "mymodel.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QTableView tableView;
- MyModel myModel(0);
- tableView.setModel( &myModel );
+ MyModel myModel;
+ tableView.setModel(&myModel);
tableView.show();
return a.exec();
}
diff --git a/examples/widgets/tutorials/modelview/2_formatting/mymodel.cpp b/examples/widgets/tutorials/modelview/2_formatting/mymodel.cpp
index 9511648392..938597a34e 100644
--- a/examples/widgets/tutorials/modelview/2_formatting/mymodel.cpp
+++ b/examples/widgets/tutorials/modelview/2_formatting/mymodel.cpp
@@ -48,13 +48,14 @@
**
****************************************************************************/
+#include "mymodel.h"
+
#include <QFont>
#include <QBrush>
-#include "mymodel.h"
#include <QDebug>
MyModel::MyModel(QObject *parent)
- :QAbstractTableModel(parent)
+ : QAbstractTableModel(parent)
{
}
@@ -78,7 +79,7 @@ QVariant MyModel::data(const QModelIndex &index, int role) const
qDebug() << QString("row %1, col%2, role %3")
.arg(row).arg(col).arg(role);
- switch(role){
+ switch (role) {
case Qt::DisplayRole:
if (row == 0 && col == 1) return QString("<--left");
if (row == 1 && col == 1) return QString("right-->");
@@ -86,36 +87,25 @@ QVariant MyModel::data(const QModelIndex &index, int role) const
return QString("Row%1, Column%2")
.arg(row + 1)
.arg(col +1);
- break;
case Qt::FontRole:
- if (row == 0 && col == 0) //change font only for cell(0,0)
- {
+ if (row == 0 && col == 0) { //change font only for cell(0,0)
QFont boldFont;
boldFont.setBold(true);
return boldFont;
}
break;
case Qt::BackgroundRole:
-
if (row == 1 && col == 2) //change background only for cell(1,2)
- {
- QBrush redBackground(Qt::red);
- return redBackground;
- }
+ return QBrush(Qt::red);
break;
case Qt::TextAlignmentRole:
-
if (row == 1 && col == 1) //change text alignment only for cell(1,1)
- {
return Qt::AlignRight + Qt::AlignVCenter;
- }
break;
case Qt::CheckStateRole:
-
if (row == 1 && col == 0) //add a checkbox to cell(1,0)
- {
return Qt::Checked;
- }
+ break;
}
return QVariant();
}
diff --git a/examples/widgets/tutorials/modelview/2_formatting/mymodel.h b/examples/widgets/tutorials/modelview/2_formatting/mymodel.h
index 9c12f98ba9..e8ae673f62 100644
--- a/examples/widgets/tutorials/modelview/2_formatting/mymodel.h
+++ b/examples/widgets/tutorials/modelview/2_formatting/mymodel.h
@@ -57,8 +57,8 @@ class MyModel : public QAbstractTableModel
{
Q_OBJECT
public:
- MyModel(QObject *parent);
- int rowCount(const QModelIndex &parent = QModelIndex()) const override ;
+ MyModel(QObject *parent = nullptr);
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
};
diff --git a/examples/widgets/tutorials/modelview/3_changingmodel/main.cpp b/examples/widgets/tutorials/modelview/3_changingmodel/main.cpp
index c03019a910..2330019f93 100644
--- a/examples/widgets/tutorials/modelview/3_changingmodel/main.cpp
+++ b/examples/widgets/tutorials/modelview/3_changingmodel/main.cpp
@@ -48,8 +48,8 @@
**
****************************************************************************/
-#include <QtWidgets/QApplication>
-#include <QtWidgets/QTableView>
+#include <QApplication>
+#include <QTableView>
#include "mymodel.h"
int main(int argc, char *argv[])
@@ -57,7 +57,7 @@ int main(int argc, char *argv[])
QApplication a(argc, argv);
QTableView tableView;
MyModel myModel(0);
- tableView.setModel( &myModel );
+ tableView.setModel(&myModel);
tableView.show();
return a.exec();
}
diff --git a/examples/widgets/tutorials/modelview/3_changingmodel/mymodel.cpp b/examples/widgets/tutorials/modelview/3_changingmodel/mymodel.cpp
index e4580a0e01..f289d9abda 100644
--- a/examples/widgets/tutorials/modelview/3_changingmodel/mymodel.cpp
+++ b/examples/widgets/tutorials/modelview/3_changingmodel/mymodel.cpp
@@ -48,18 +48,17 @@
**
****************************************************************************/
-#include <QBrush>
-#include <QTime>
#include "mymodel.h"
+#include <QTime>
+
//! [quoting mymodel_a]
MyModel::MyModel(QObject *parent)
- :QAbstractTableModel(parent)
+ : QAbstractTableModel(parent)
+ , timer(new QTimer(this))
{
-// selectedCell = 0;
- timer = new QTimer(this);
timer->setInterval(1000);
- connect(timer, SIGNAL(timeout()) , this, SLOT(timerHit()));
+ connect(timer, &QTimer::timeout , this, &MyModel::timerHit);
timer->start();
}
//! [quoting mymodel_a]
@@ -82,13 +81,9 @@ QVariant MyModel::data(const QModelIndex &index, int role) const
int row = index.row();
int col = index.column();
- if (role == Qt::DisplayRole)
- {
- if (row == 0 && col == 0)
- {
- return QTime::currentTime().toString();
- }
- }
+ if (role == Qt::DisplayRole && row == 0 && col == 0)
+ return QTime::currentTime().toString();
+
return QVariant();
}
//! [quoting mymodel_QVariant ]
@@ -99,6 +94,6 @@ void MyModel::timerHit()
//we identify the top left cell
QModelIndex topLeft = createIndex(0,0);
//emit a signal to make the view reread identified data
- emit dataChanged(topLeft, topLeft);
+ emit dataChanged(topLeft, topLeft, {Qt::DisplayRole});
}
//! [quoting mymodel_b ]
diff --git a/examples/widgets/tutorials/modelview/3_changingmodel/mymodel.h b/examples/widgets/tutorials/modelview/3_changingmodel/mymodel.h
index dfcf0f6239..2ef0e480c2 100644
--- a/examples/widgets/tutorials/modelview/3_changingmodel/mymodel.h
+++ b/examples/widgets/tutorials/modelview/3_changingmodel/mymodel.h
@@ -58,13 +58,12 @@ class MyModel : public QAbstractTableModel
{
Q_OBJECT
public:
- MyModel(QObject *parent);
- int rowCount(const QModelIndex &parent = QModelIndex()) const override ;
+ MyModel(QObject *parent = nullptr);
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
- QTimer *timer;
private:
- int selectedCell;
+ QTimer *timer;
private slots:
void timerHit();
};
diff --git a/examples/widgets/tutorials/modelview/4_headers/main.cpp b/examples/widgets/tutorials/modelview/4_headers/main.cpp
index 82d493345d..90a8c6e894 100644
--- a/examples/widgets/tutorials/modelview/4_headers/main.cpp
+++ b/examples/widgets/tutorials/modelview/4_headers/main.cpp
@@ -48,16 +48,16 @@
**
****************************************************************************/
-#include <QtWidgets/QApplication>
-#include <QtWidgets/QTableView>
+#include <QApplication>
+#include <QTableView>
#include "mymodel.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QTableView tableView;
- MyModel myModel(0);
- tableView.setModel( &myModel );
+ MyModel myModel;
+ tableView.setModel(&myModel);
tableView.show();
return a.exec();
-} \ No newline at end of file
+}
diff --git a/examples/widgets/tutorials/modelview/4_headers/mymodel.cpp b/examples/widgets/tutorials/modelview/4_headers/mymodel.cpp
index 35e3463b7f..0084475374 100644
--- a/examples/widgets/tutorials/modelview/4_headers/mymodel.cpp
+++ b/examples/widgets/tutorials/modelview/4_headers/mymodel.cpp
@@ -51,7 +51,7 @@
#include "mymodel.h"
MyModel::MyModel(QObject *parent)
- :QAbstractTableModel(parent)
+ : QAbstractTableModel(parent)
{
}
@@ -70,8 +70,7 @@ int MyModel::columnCount(const QModelIndex & /*parent*/) const
//-------------------------------------------------------
QVariant MyModel::data(const QModelIndex &index, int role) const
{
- if (role == Qt::DisplayRole)
- {
+ if (role == Qt::DisplayRole) {
return QString("Row%1, Column%2")
.arg(index.row() + 1)
.arg(index.column() +1);
@@ -82,18 +81,14 @@ QVariant MyModel::data(const QModelIndex &index, int role) const
//! [quoting mymodel_c]
QVariant MyModel::headerData(int section, Qt::Orientation orientation, int role) const
{
- if (role == Qt::DisplayRole)
- {
- if (orientation == Qt::Horizontal) {
- switch (section)
- {
- case 0:
- return QString("first");
- case 1:
- return QString("second");
- case 2:
- return QString("third");
- }
+ if (role == Qt::DisplayRole && orientation == Qt::Horizontal) {
+ switch (section) {
+ case 0:
+ return QString("first");
+ case 1:
+ return QString("second");
+ case 2:
+ return QString("third");
}
}
return QVariant();
diff --git a/examples/widgets/tutorials/modelview/4_headers/mymodel.h b/examples/widgets/tutorials/modelview/4_headers/mymodel.h
index fb2d7aa940..6d8477dae2 100644
--- a/examples/widgets/tutorials/modelview/4_headers/mymodel.h
+++ b/examples/widgets/tutorials/modelview/4_headers/mymodel.h
@@ -57,8 +57,8 @@ class MyModel : public QAbstractTableModel
{
Q_OBJECT
public:
- MyModel(QObject *parent);
- int rowCount(const QModelIndex &parent = QModelIndex()) const override ;
+ MyModel(QObject *parent = nullptr);
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
diff --git a/examples/widgets/tutorials/modelview/5_edit/main.cpp b/examples/widgets/tutorials/modelview/5_edit/main.cpp
index e1b46339b1..315875a627 100644
--- a/examples/widgets/tutorials/modelview/5_edit/main.cpp
+++ b/examples/widgets/tutorials/modelview/5_edit/main.cpp
@@ -48,7 +48,7 @@
**
****************************************************************************/
-#include <QtWidgets/QApplication>
+#include <QApplication>
#include "mainwindow.h"
int main(int argc, char *argv[])
diff --git a/examples/widgets/tutorials/modelview/5_edit/mainwindow.cpp b/examples/widgets/tutorials/modelview/5_edit/mainwindow.cpp
index e0b6ea7b1f..d8dfc33212 100644
--- a/examples/widgets/tutorials/modelview/5_edit/mainwindow.cpp
+++ b/examples/widgets/tutorials/modelview/5_edit/mainwindow.cpp
@@ -48,23 +48,25 @@
**
****************************************************************************/
-#include <QTableView>
#include "mainwindow.h"
#include "mymodel.h"
+#include <QTableView>
+
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
+ , tableView(new QTableView(this))
{
- tableView = new QTableView(this);
setCentralWidget(tableView);
- QAbstractTableModel *myModel = new MyModel(this);
+ MyModel *myModel = new MyModel(this);
tableView->setModel(myModel);
//transfer changes to the model to the window title
- connect(myModel, SIGNAL(editCompleted(const QString &)), this, SLOT(setWindowTitle(const QString &)));
+ connect(myModel, &MyModel::editCompleted,
+ this, &MainWindow::showWindowTitle);
}
-void MainWindow::showWindowTitle(const QString & title)
+void MainWindow::showWindowTitle(const QString &title)
{
-setWindowTitle(title);
+ setWindowTitle(title);
}
diff --git a/examples/widgets/tutorials/modelview/5_edit/mainwindow.h b/examples/widgets/tutorials/modelview/5_edit/mainwindow.h
index 7915b29cdf..104f06f82e 100644
--- a/examples/widgets/tutorials/modelview/5_edit/mainwindow.h
+++ b/examples/widgets/tutorials/modelview/5_edit/mainwindow.h
@@ -51,9 +51,9 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
-#include <QtWidgets/QMainWindow>
+#include <QMainWindow>
-QT_BEGIN_NAMESPACE // QT_BEGIN_NAMESPACE / QT_END_NAMESPACE are not needed in Qt user code
+QT_BEGIN_NAMESPACE
class QTableView; //forward declaration
QT_END_NAMESPACE
@@ -64,9 +64,9 @@ class MainWindow : public QMainWindow
private:
QTableView *tableView;
public:
- MainWindow(QWidget *parent = 0);
+ MainWindow(QWidget *parent = nullptr);
public slots:
- void showWindowTitle(const QString & title);
+ void showWindowTitle(const QString &title);
};
#endif // MAINWINDOW_H
diff --git a/examples/widgets/tutorials/modelview/5_edit/mymodel.cpp b/examples/widgets/tutorials/modelview/5_edit/mymodel.cpp
index fb2954baf2..eeca2ce0a0 100644
--- a/examples/widgets/tutorials/modelview/5_edit/mymodel.cpp
+++ b/examples/widgets/tutorials/modelview/5_edit/mymodel.cpp
@@ -48,12 +48,10 @@
**
****************************************************************************/
-
#include "mymodel.h"
-
MyModel::MyModel(QObject *parent)
- :QAbstractTableModel(parent)
+ : QAbstractTableModel(parent)
{
}
@@ -72,33 +70,31 @@ int MyModel::columnCount(const QModelIndex & /*parent*/) const
//-----------------------------------------------------------------
QVariant MyModel::data(const QModelIndex &index, int role) const
{
- if (role == Qt::DisplayRole)
- {
- return m_gridData[index.row()][index.column()];
- }
+ if (role == Qt::DisplayRole && checkIndex(index))
+ return m_gridData[index.row()][index.column()];
+
return QVariant();
}
//-----------------------------------------------------------------
//! [quoting mymodel_e]
-bool MyModel::setData(const QModelIndex & index, const QVariant & value, int role)
+bool MyModel::setData(const QModelIndex &index, const QVariant &value, int role)
{
- if (role == Qt::EditRole)
- {
+ if (role == Qt::EditRole) {
+ if (!checkIndex(index))
+ return false;
//save value from editor to member m_gridData
m_gridData[index.row()][index.column()] = value.toString();
//for presentation purposes only: build and emit a joined string
QString result;
- for (int row= 0; row < ROWS; row++)
- {
- for(int col= 0; col < COLS; col++)
- {
+ for (int row = 0; row < ROWS; row++) {
+ for (int col= 0; col < COLS; col++)
result += m_gridData[row][col] + ' ';
- }
}
- emit editCompleted( result );
+ emit editCompleted(result);
+ return true;
}
- return true;
+ return false;
}
//! [quoting mymodel_e]
diff --git a/examples/widgets/tutorials/modelview/5_edit/mymodel.h b/examples/widgets/tutorials/modelview/5_edit/mymodel.h
index dd0d4f5066..ce462351af 100644
--- a/examples/widgets/tutorials/modelview/5_edit/mymodel.h
+++ b/examples/widgets/tutorials/modelview/5_edit/mymodel.h
@@ -64,12 +64,12 @@ class MyModel : public QAbstractTableModel
{
Q_OBJECT
public:
- MyModel(QObject *parent);
- int rowCount(const QModelIndex &parent = QModelIndex()) const override ;
+ MyModel(QObject *parent = nullptr);
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
- bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole) override;
- Qt::ItemFlags flags(const QModelIndex & index) const override ;
+ bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
+ Qt::ItemFlags flags(const QModelIndex &index) const override;
private:
QString m_gridData[ROWS][COLS]; //holds text entered into QTableView
signals:
diff --git a/examples/widgets/tutorials/modelview/6_treeview/main.cpp b/examples/widgets/tutorials/modelview/6_treeview/main.cpp
index e1b46339b1..315875a627 100644
--- a/examples/widgets/tutorials/modelview/6_treeview/main.cpp
+++ b/examples/widgets/tutorials/modelview/6_treeview/main.cpp
@@ -48,7 +48,7 @@
**
****************************************************************************/
-#include <QtWidgets/QApplication>
+#include <QApplication>
#include "mainwindow.h"
int main(int argc, char *argv[])
diff --git a/examples/widgets/tutorials/modelview/6_treeview/mainwindow.cpp b/examples/widgets/tutorials/modelview/6_treeview/mainwindow.cpp
index 1016afba07..ae4a343680 100644
--- a/examples/widgets/tutorials/modelview/6_treeview/mainwindow.cpp
+++ b/examples/widgets/tutorials/modelview/6_treeview/mainwindow.cpp
@@ -50,24 +50,25 @@
//! [Quoting ModelView Tutorial]
// modelview.cpp
+#include "mainwindow.h"
+
#include <QTreeView>
#include <QStandardItemModel>
#include <QStandardItem>
-#include "mainwindow.h"
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
+ , treeView(new QTreeView(this))
+ , standardModel(new QStandardItemModel(this))
{
- treeView = new QTreeView(this);
setCentralWidget(treeView);
- standardModel = new QStandardItemModel ;
- QList<QStandardItem *> preparedRow =prepareRow("first", "second", "third");
+ QList<QStandardItem *> preparedRow = prepareRow("first", "second", "third");
QStandardItem *item = standardModel->invisibleRootItem();
// adding a row to the invisible root item produces a root element
item->appendRow(preparedRow);
- QList<QStandardItem *> secondRow =prepareRow("111", "222", "333");
+ QList<QStandardItem *> secondRow = prepareRow("111", "222", "333");
// adding a row to an item starts a subtree
preparedRow.first()->appendRow(secondRow);
@@ -76,13 +77,11 @@ MainWindow::MainWindow(QWidget *parent)
}
QList<QStandardItem *> MainWindow::prepareRow(const QString &first,
- const QString &second,
- const QString &third)
+ const QString &second,
+ const QString &third) const
{
- QList<QStandardItem *> rowItems;
- rowItems << new QStandardItem(first);
- rowItems << new QStandardItem(second);
- rowItems << new QStandardItem(third);
- return rowItems;
+ return {new QStandardItem(first),
+ new QStandardItem(second),
+ new QStandardItem(third)};
}
//! [Quoting ModelView Tutorial]
diff --git a/examples/widgets/tutorials/modelview/6_treeview/mainwindow.h b/examples/widgets/tutorials/modelview/6_treeview/mainwindow.h
index d625d5991d..65d9c18658 100644
--- a/examples/widgets/tutorials/modelview/6_treeview/mainwindow.h
+++ b/examples/widgets/tutorials/modelview/6_treeview/mainwindow.h
@@ -51,9 +51,9 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
-#include <QtWidgets/QMainWindow>
+#include <QMainWindow>
-QT_BEGIN_NAMESPACE // QT_BEGIN_NAMESPACE / QT_END_NAMESPACE are not needed in Qt user code
+QT_BEGIN_NAMESPACE
class QTreeView; //forward declarations
class QStandardItemModel;
class QStandardItem;
@@ -66,11 +66,11 @@ class MainWindow : public QMainWindow
private:
QTreeView *treeView;
QStandardItemModel *standardModel;
- QList<QStandardItem *> prepareRow( const QString &first,
- const QString &second,
- const QString &third );
+ QList<QStandardItem *> prepareRow(const QString &first,
+ const QString &second,
+ const QString &third) const;
public:
- MainWindow(QWidget *parent = 0);
+ MainWindow(QWidget *parent = nullptr);
};
#endif // MAINWINDOW_H
diff --git a/examples/widgets/tutorials/modelview/7_selections/main.cpp b/examples/widgets/tutorials/modelview/7_selections/main.cpp
index e1b46339b1..315875a627 100644
--- a/examples/widgets/tutorials/modelview/7_selections/main.cpp
+++ b/examples/widgets/tutorials/modelview/7_selections/main.cpp
@@ -48,7 +48,7 @@
**
****************************************************************************/
-#include <QtWidgets/QApplication>
+#include <QApplication>
#include "mainwindow.h"
int main(int argc, char *argv[])
diff --git a/examples/widgets/tutorials/modelview/7_selections/mainwindow.cpp b/examples/widgets/tutorials/modelview/7_selections/mainwindow.cpp
index 200751ee6d..2b10071a68 100644
--- a/examples/widgets/tutorials/modelview/7_selections/mainwindow.cpp
+++ b/examples/widgets/tutorials/modelview/7_selections/mainwindow.cpp
@@ -49,17 +49,18 @@
****************************************************************************/
//! [quoting modelview_a]
+#include "mainwindow.h"
+
#include <QTreeView>
#include <QStandardItemModel>
#include <QItemSelectionModel>
-#include "mainwindow.h"
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
+ , treeView(new QTreeView(this))
+ , standardModel(new QStandardItemModel(this))
{
- treeView = new QTreeView(this);
setCentralWidget(treeView);
- standardModel = new QStandardItemModel ;
QStandardItem *rootNode = standardModel->invisibleRootItem();
@@ -88,9 +89,9 @@ MainWindow::MainWindow(QWidget *parent)
treeView->expandAll();
//selection changes shall trigger a slot
- QItemSelectionModel *selectionModel= treeView->selectionModel();
- connect(selectionModel, SIGNAL(selectionChanged (const QItemSelection &, const QItemSelection &)),
- this, SLOT(selectionChangedSlot(const QItemSelection &, const QItemSelection &)));
+ QItemSelectionModel *selectionModel = treeView->selectionModel();
+ connect(selectionModel, &QItemSelectionModel::selectionChanged,
+ this, &MainWindow::selectionChangedSlot);
}
//! [quoting modelview_a]
@@ -103,10 +104,9 @@ void MainWindow::selectionChangedSlot(const QItemSelection & /*newSelection*/, c
const QModelIndex index = treeView->selectionModel()->currentIndex();
QString selectedText = index.data(Qt::DisplayRole).toString();
//find out the hierarchy level of the selected item
- int hierarchyLevel=1;
+ int hierarchyLevel = 1;
QModelIndex seekRoot = index;
- while(seekRoot.parent() != QModelIndex())
- {
+ while (seekRoot.parent() != QModelIndex()) {
seekRoot = seekRoot.parent();
hierarchyLevel++;
}
diff --git a/examples/widgets/tutorials/modelview/7_selections/mainwindow.h b/examples/widgets/tutorials/modelview/7_selections/mainwindow.h
index 13ca7dbc30..c9761dd3d9 100644
--- a/examples/widgets/tutorials/modelview/7_selections/mainwindow.h
+++ b/examples/widgets/tutorials/modelview/7_selections/mainwindow.h
@@ -51,9 +51,9 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
-#include <QtWidgets/QMainWindow>
+#include <QMainWindow>
-QT_BEGIN_NAMESPACE // QT_BEGIN_NAMESPACE / QT_END_NAMESPACE are not needed in Qt user code
+QT_BEGIN_NAMESPACE
class QTreeView; //forward declarations
class QStandardItemModel;
class QItemSelection;
@@ -67,7 +67,7 @@ private:
QTreeView *treeView;
QStandardItemModel *standardModel;
private slots:
- void selectionChangedSlot(const QItemSelection & newSelection, const QItemSelection & oldSelection);
+ void selectionChangedSlot(const QItemSelection &newSelection, const QItemSelection &oldSelection);
public:
MainWindow(QWidget *parent = 0);
};
diff --git a/mkspecs/macx-xcode/default.xcscheme b/mkspecs/macx-xcode/default.xcscheme
index bd2cb0e565..170174ed2b 100644
--- a/mkspecs/macx-xcode/default.xcscheme
+++ b/mkspecs/macx-xcode/default.xcscheme
@@ -26,6 +26,7 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "NO"
+ disableMainThreadChecker = "YES"
buildConfiguration = "Debug">
<Testables>
<TestableReference
diff --git a/mkspecs/win32-arm64-msvc2017/qmake.conf b/mkspecs/win32-arm64-msvc2017/qmake.conf
new file mode 100644
index 0000000000..ee10f9cc40
--- /dev/null
+++ b/mkspecs/win32-arm64-msvc2017/qmake.conf
@@ -0,0 +1,15 @@
+#
+# qmake configuration for win32-arm64-msvc2017
+#
+# Written for Microsoft C/C++ Optimizing Compiler targeting arm64.
+#
+
+include(../common/msvc-desktop.conf)
+
+WINSDK_VER = 10.0
+VCPROJ_ARCH = ARM64
+
+DEFINES += WIN64
+QMAKE_COMPILER_DEFINES += _WIN64
+
+load(qt_config)
diff --git a/mkspecs/win32-arm64-msvc2017/qplatformdefs.h b/mkspecs/win32-arm64-msvc2017/qplatformdefs.h
new file mode 100644
index 0000000000..8a3afa7630
--- /dev/null
+++ b/mkspecs/win32-arm64-msvc2017/qplatformdefs.h
@@ -0,0 +1,40 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the qmake spec 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 The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "../win32-msvc/qplatformdefs.h"
diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp
index f2cd7c633b..306ae57871 100644
--- a/qmake/generators/win32/msvc_nmake.cpp
+++ b/qmake/generators/win32/msvc_nmake.cpp
@@ -71,18 +71,28 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t)
return MakefileGenerator::writeStubMakefile(t);
#endif
if (!project->isHostBuild()) {
+ const QString msvcVer = project->first("MSVC_VER").toQString();
+ if (msvcVer.isEmpty()) {
+ fprintf(stderr, "Mkspec does not specify MSVC_VER. Cannot continue.\n");
+ return false;
+ }
+
+ bool winrtBuild = false;
+ bool crossPlatformDesktopBuild = false;
+ QString arch = project->first("VCPROJ_ARCH").toQString().toLower();
if (project->isActiveConfig(QStringLiteral("winrt"))) {
- QString arch = project->first("VCPROJ_ARCH").toQString().toLower();
+ winrtBuild = true;
+
+ // Only add explicit support for arm64 cross-platform desktop builds.
+ } else if ((arch == QLatin1String("arm64")) && (msvcVer == QStringLiteral("15.0"))) {
+ crossPlatformDesktopBuild = true;
+ }
+
+ if (winrtBuild || crossPlatformDesktopBuild) {
QString compiler;
QString compilerArch;
- const QString msvcVer = project->first("MSVC_VER").toQString();
- if (msvcVer.isEmpty()) {
- fprintf(stderr, "Mkspec does not specify MSVC_VER. Cannot continue.\n");
- return false;
- }
-
+ const ProStringList hostArch = project->values("QMAKE_TARGET.arch");
if (msvcVer == QStringLiteral("15.0")) {
- const ProStringList hostArch = project->values("QMAKE_TARGET.arch");
if (hostArch.contains("x86_64"))
compiler = QStringLiteral("HostX64/");
else
@@ -93,6 +103,9 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t)
} else if (arch == QLatin1String("x64")) {
compiler += QStringLiteral("x64");
compilerArch = QStringLiteral("amd64");
+ } else if (arch == QLatin1String("arm64")) {
+ compiler += QStringLiteral("arm64");
+ compilerArch = QStringLiteral("arm64");
} else {
arch = QStringLiteral("x86");
compiler += QStringLiteral("x86");
@@ -119,7 +132,7 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t)
return false;
}
const QString targetVer = project->first("WINTARGET_VER").toQString();
- if (targetVer.isEmpty()) {
+ if (targetVer.isEmpty() && winrtBuild) {
fprintf(stderr, "Mkspec does not specify WINTARGET_VER. Cannot continue.\n");
return false;
}
@@ -181,10 +194,19 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t)
incDirs << crtInclude + QStringLiteral("/shared");
incDirs << crtInclude + QStringLiteral("/winrt");
- incDirs << kitDir + QStringLiteral("Extension SDKs/WindowsMobile/")
- + crtVersion + QStringLiteral("/Include/WinRT");
+ if (winrtBuild) {
+ // Only use mobile-specific headers and link against store-specific libs for
+ // winrt builds.
+ incDirs << kitDir + QStringLiteral("Extension SDKs/WindowsMobile/")
+ + crtVersion + QStringLiteral("/Include/WinRT");
- libDirs << toolsInstallDir + QStringLiteral("lib/") + arch + QStringLiteral("/store");
+ libDirs << toolsInstallDir + QStringLiteral("lib/") + arch + QStringLiteral("/store");
+ } else {
+ // Desktop projects may require the atl headers and libs.
+ incDirs << toolsInstallDir + QStringLiteral("atlmfc/include");
+ libDirs << toolsInstallDir + QStringLiteral("atlmfc/lib/") + compilerArch;
+ libDirs << toolsInstallDir + QStringLiteral("lib/") + arch;
+ }
libDirs << vcInstallDir + QStringLiteral("VC/Auxiliary/VS/lib/") + arch;
diff --git a/src/3rdparty/angle/src/common/mathutil.h b/src/3rdparty/angle/src/common/mathutil.h
index 372e432066..88aedddfe8 100644
--- a/src/3rdparty/angle/src/common/mathutil.h
+++ b/src/3rdparty/angle/src/common/mathutil.h
@@ -150,7 +150,7 @@ inline bool supportsSSE2()
return supports;
}
-#if defined(ANGLE_PLATFORM_WINDOWS) && !defined(_M_ARM)
+#if defined(ANGLE_PLATFORM_WINDOWS) && !defined(_M_ARM) && !defined(_M_ARM64)
{
int info[4];
__cpuid(info, 0);
@@ -162,7 +162,7 @@ inline bool supportsSSE2()
supports = (info[3] >> 26) & 1;
}
}
-#endif // defined(ANGLE_PLATFORM_WINDOWS) && !defined(_M_ARM)
+#endif // defined(ANGLE_PLATFORM_WINDOWS) && !defined(_M_ARM) && !defined(_M_ARM64)
checked = true;
return supports;
#else // defined(ANGLE_USE_SSE)
@@ -884,14 +884,14 @@ inline uint32_t BitfieldReverse(uint32_t value)
// Count the 1 bits.
#if defined(ANGLE_PLATFORM_WINDOWS)
-#if defined(_M_ARM)
+#if defined(_M_ARM) || defined(_M_ARM64)
inline int BitCount(uint32_t bits)
{
bits = bits - ((bits >> 1) & 0x55555555);
bits = (bits & 0x33333333) + ((bits >> 2) & 0x33333333);
return (((bits + (bits >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24;
}
-#else // _M_ARM
+#else // _M_ARM || _M_ARM64
inline int BitCount(uint32_t bits)
{
return static_cast<int>(__popcnt(bits));
diff --git a/src/3rdparty/angle/src/common/platform.h b/src/3rdparty/angle/src/common/platform.h
index 47cd57b999..fb251da579 100644
--- a/src/3rdparty/angle/src/common/platform.h
+++ b/src/3rdparty/angle/src/common/platform.h
@@ -83,7 +83,7 @@
# undef far
#endif
-#if defined(_MSC_VER) && !defined(_M_ARM)
+#if defined(_MSC_VER) && !defined(_M_ARM) && !defined(_M_ARM64)
#include <intrin.h>
#define ANGLE_USE_SSE
#elif defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__)) && !defined(__MINGW32__)
diff --git a/src/3rdparty/sha3/qt_attribution.json b/src/3rdparty/sha3/qt_attribution.json
index 4866be32ea..5e6e993e19 100644
--- a/src/3rdparty/sha3/qt_attribution.json
+++ b/src/3rdparty/sha3/qt_attribution.json
@@ -17,9 +17,11 @@
"Name": "Secure Hash Algorithm SHA-3 - Keccak",
"QDocModule": "qtcore",
"QtUsage": "Used in Qt Core (QCryptographicHash).",
+ "Files": "https://keccak.team/obsolete/KeccakReferenceAndOptimized-3.2.zip - but it's obsolete",
"Files": "KeccakF-1600-32-rvk.macros KeccakF-1600-32.macros KeccakF-1600-64.macros KeccakF-1600-interface.h KeccakF-1600-opt32.c KeccakF-1600-opt64.c KeccakF-1600-unrolling.macros KeccakNISTInterface.c KeccakNISTInterface.h KeccakSponge.c KeccakSponge.h",
"Description": "SHA-3, originally known as Keccak, is a cryptographic hash function.",
+ "Version": "3.2",
"License": "Creative Commons Zero v1.0 Universal",
"LicenseId": "CC0-1.0",
"LicenseFile": "CC0_LICENSE",
diff --git a/src/angle/patches/0011-ANGLE-Fix-build-for-ARM64.patch b/src/angle/patches/0011-ANGLE-Fix-build-for-ARM64.patch
new file mode 100644
index 0000000000..3a43894a8a
--- /dev/null
+++ b/src/angle/patches/0011-ANGLE-Fix-build-for-ARM64.patch
@@ -0,0 +1,63 @@
+From 416fb93dae5009bb51da9f6720a95918a2c79e78 Mon Sep 17 00:00:00 2001
+From: Thomas Miller <thomaslmiller91@gmail.com>
+Date: Tue Oct 16 08:29:58 2018 -0700
+Subject: [PATCH] ANGLE: Fix build for ARM64
+
+__popcnt, SSE, and intrin.h are not available when building for ARM64.
+---
+ src/3rdparty/angle/src/common/mathutil.h | 8 ++++----
+ src/3rdparty/angle/src/common/platform.h | 2 +-
+ 2 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/src/3rdparty/angle/src/common/mathutil.h b/src/3rdparty/angle/src/common/mathutil.h
+index 372e432066..88aedddfe8 100644
+--- a/src/3rdparty/angle/src/common/mathutil.h
++++ b/src/3rdparty/angle/src/common/mathutil.h
+@@ -150,7 +150,7 @@ inline bool supportsSSE2()
+ return supports;
+ }
+
+-#if defined(ANGLE_PLATFORM_WINDOWS) && !defined(_M_ARM)
++#if defined(ANGLE_PLATFORM_WINDOWS) && !defined(_M_ARM) && !defined(_M_ARM64)
+ {
+ int info[4];
+ __cpuid(info, 0);
+@@ -162,7 +162,7 @@ inline bool supportsSSE2()
+ supports = (info[3] >> 26) & 1;
+ }
+ }
+-#endif // defined(ANGLE_PLATFORM_WINDOWS) && !defined(_M_ARM)
++#endif // defined(ANGLE_PLATFORM_WINDOWS) && !defined(_M_ARM) && !defined(_M_ARM64)
+ checked = true;
+ return supports;
+ #else // defined(ANGLE_USE_SSE)
+@@ -884,14 +884,14 @@ inline uint32_t BitfieldReverse(uint32_t value)
+
+ // Count the 1 bits.
+ #if defined(ANGLE_PLATFORM_WINDOWS)
+-#if defined(_M_ARM)
++#if defined(_M_ARM) || defined(_M_ARM64)
+ inline int BitCount(uint32_t bits)
+ {
+ bits = bits - ((bits >> 1) & 0x55555555);
+ bits = (bits & 0x33333333) + ((bits >> 2) & 0x33333333);
+ return (((bits + (bits >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24;
+ }
+-#else // _M_ARM
++#else // _M_ARM || _M_ARM64
+ inline int BitCount(uint32_t bits)
+ {
+ return static_cast<int>(__popcnt(bits));
+diff --git a/src/3rdparty/angle/src/common/platform.h b/src/3rdparty/angle/src/common/platform.h
+index 47cd57b999..fb251da579 100644
+--- a/src/3rdparty/angle/src/common/platform.h
++++ b/src/3rdparty/angle/src/common/platform.h
+@@ -83,7 +83,7 @@
+ # undef far
+ #endif
+
+-#if defined(_MSC_VER) && !defined(_M_ARM)
++#if defined(_MSC_VER) && !defined(_M_ARM) && !defined(_M_ARM64)
+ #include <intrin.h>
+ #define ANGLE_USE_SSE
+ #elif defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__)) && !defined(__MINGW32__)
diff --git a/src/corelib/global/qprocessordetection.h b/src/corelib/global/qprocessordetection.h
index aaa27dff4a..77b3ba36b0 100644
--- a/src/corelib/global/qprocessordetection.h
+++ b/src/corelib/global/qprocessordetection.h
@@ -94,8 +94,8 @@
ARM is bi-endian, detect using __ARMEL__ or __ARMEB__, falling back to
auto-detection implemented below.
*/
-#if defined(__arm__) || defined(__TARGET_ARCH_ARM) || defined(_M_ARM) || defined(__aarch64__) || defined(__ARM64__)
-# if defined(__aarch64__) || defined(__ARM64__)
+#if defined(__arm__) || defined(__TARGET_ARCH_ARM) || defined(_M_ARM) || defined(_M_ARM64) || defined(__aarch64__) || defined(__ARM64__)
+# if defined(__aarch64__) || defined(__ARM64__) || defined(_M_ARM64)
# define Q_PROCESSOR_ARM_64
# define Q_PROCESSOR_WORDSIZE 8
# else
@@ -110,7 +110,8 @@
# elif defined(__ARM64_ARCH_8__) \
|| defined(__aarch64__) \
|| defined(__ARMv8__) \
- || defined(__ARMv8_A__)
+ || defined(__ARMv8_A__) \
+ || defined(_M_ARM64)
# define Q_PROCESSOR_ARM 8
# elif defined(__ARM_ARCH_7__) \
|| defined(__ARM_ARCH_7A__) \
@@ -148,7 +149,7 @@
# else
# error "ARM architecture too old"
# endif
-# if defined(__ARMEL__)
+# if defined(__ARMEL__) || defined(_M_ARM64)
# define Q_BYTE_ORDER Q_LITTLE_ENDIAN
# elif defined(__ARMEB__)
# define Q_BYTE_ORDER Q_BIG_ENDIAN
diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp
index 5a5a3a82c6..b2d81066db 100644
--- a/src/corelib/io/qfilesystemengine_unix.cpp
+++ b/src/corelib/io/qfilesystemengine_unix.cpp
@@ -285,7 +285,7 @@ mtime(const T &statBuffer, int)
{ return timespecToMSecs(statBuffer.st_mtimespec); }
#endif
-#ifndef st_mtimensec
+#if !defined(st_mtimensec) && !defined(__alpha__)
// Xtimensec
template <typename T>
Q_DECL_UNUSED static typename std::enable_if<(&T::st_atimensec, true), qint64>::type
diff --git a/src/corelib/io/qfilesystemwatcher_inotify.cpp b/src/corelib/io/qfilesystemwatcher_inotify.cpp
index 3b7135e582..a5e629b646 100644
--- a/src/corelib/io/qfilesystemwatcher_inotify.cpp
+++ b/src/corelib/io/qfilesystemwatcher_inotify.cpp
@@ -330,13 +330,24 @@ QStringList QInotifyFileSystemWatcherEngine::removePaths(const QStringList &path
while (it.hasNext()) {
QString path = it.next();
int id = pathToID.take(path);
- QString x = idToPath.take(id);
- if (x.isEmpty() || x != path)
+
+ // Multiple paths could be associated to the same watch descriptor
+ // when a file is moved and added with the new name.
+ // So we should find and delete the correct one by using
+ // both id and path
+ auto path_range = idToPath.equal_range(id);
+ auto path_it = std::find(path_range.first, path_range.second, path);
+ if (path_it == idToPath.end())
continue;
- int wd = id < 0 ? -id : id;
- // qDebug() << "removing watch for path" << path << "wd" << wd;
- inotify_rm_watch(inotifyFd, wd);
+ const ssize_t num_elements = std::distance(path_range.first, path_range.second);
+ idToPath.erase(path_it);
+
+ // If there was only one path associated to the given id we should remove the watch
+ if (num_elements == 1) {
+ int wd = id < 0 ? -id : id;
+ inotify_rm_watch(inotifyFd, wd);
+ }
it.remove();
if (id < 0) {
diff --git a/src/corelib/thread/qthreadpool.cpp b/src/corelib/thread/qthreadpool.cpp
index ea2c611082..4d2389f699 100644
--- a/src/corelib/thread/qthreadpool.cpp
+++ b/src/corelib/thread/qthreadpool.cpp
@@ -39,7 +39,7 @@
#include "qthreadpool.h"
#include "qthreadpool_p.h"
-#include "qelapsedtimer.h"
+#include "qdeadlinetimer.h"
#include <algorithm>
@@ -130,11 +130,6 @@ void QThreadPoolThread::run()
}
} while (true);
- if (manager->isExiting) {
- registerThreadInactive();
- break;
- }
-
// if too many threads are active, expire this thread
bool expired = manager->tooManyThreadsActive();
if (!expired) {
@@ -145,6 +140,10 @@ void QThreadPoolThread::run()
++manager->activeThreads;
if (manager->waitingThreads.removeOne(this))
expired = true;
+ if (!manager->allThreads.contains(this)) {
+ registerThreadInactive();
+ break;
+ }
}
if (expired) {
manager->expiredThreads.enqueue(this);
@@ -267,7 +266,7 @@ void QThreadPoolPrivate::startThread(QRunnable *runnable)
QScopedPointer <QThreadPoolThread> thread(new QThreadPoolThread(this));
thread->setObjectName(QLatin1String("Thread (pooled)"));
Q_ASSERT(!allThreads.contains(thread.data())); // if this assert hits, we have an ABA problem (deleted threads don't get removed here)
- allThreads.append(thread.data());
+ allThreads.insert(thread.data());
++activeThreads;
if (runnable->autoDelete())
@@ -278,49 +277,54 @@ void QThreadPoolPrivate::startThread(QRunnable *runnable)
/*!
\internal
- Makes all threads exit, waits for each thread to exit and deletes it.
+
+ Helper function only to be called from waitForDone(int)
*/
void QThreadPoolPrivate::reset()
{
- QMutexLocker locker(&mutex);
- isExiting = true;
-
- while (!allThreads.empty()) {
- // move the contents of the set out so that we can iterate without the lock
- QList<QThreadPoolThread *> allThreadsCopy;
- allThreadsCopy.swap(allThreads);
- locker.unlock();
+ // move the contents of the set out so that we can iterate without the lock
+ QSet<QThreadPoolThread *> allThreadsCopy;
+ allThreadsCopy.swap(allThreads);
+ expiredThreads.clear();
+ waitingThreads.clear();
+ mutex.unlock();
- for (QThreadPoolThread *thread : qAsConst(allThreadsCopy)) {
+ for (QThreadPoolThread *thread: qAsConst(allThreadsCopy)) {
+ if (!thread->isFinished()) {
thread->runnableReady.wakeAll();
thread->wait();
- delete thread;
}
-
- locker.relock();
- // repeat until all newly arrived threads have also completed
+ delete thread;
}
- waitingThreads.clear();
- expiredThreads.clear();
+ mutex.lock();
+}
+
+/*!
+ \internal
- isExiting = false;
+ Helper function only to be called from waitForDone(int)
+*/
+bool QThreadPoolPrivate::waitForDone(const QDeadlineTimer &timer)
+{
+ while (!(queue.isEmpty() && activeThreads == 0) && !timer.hasExpired())
+ noActiveThreads.wait(&mutex, timer);
+
+ return queue.isEmpty() && activeThreads == 0;
}
bool QThreadPoolPrivate::waitForDone(int msecs)
{
QMutexLocker locker(&mutex);
- if (msecs < 0) {
- while (!(queue.isEmpty() && activeThreads == 0))
- noActiveThreads.wait(locker.mutex());
- } else {
- QElapsedTimer timer;
- timer.start();
- int t;
- while (!(queue.isEmpty() && activeThreads == 0) &&
- ((t = msecs - timer.elapsed()) > 0))
- noActiveThreads.wait(locker.mutex(), t);
- }
+ QDeadlineTimer timer(msecs);
+ do {
+ if (!waitForDone(timer))
+ return false;
+ reset();
+ // More threads can be started during reset(), in that case continue
+ // waiting if we still have time left.
+ } while ((!queue.isEmpty() || activeThreads) && !timer.hasExpired());
+
return queue.isEmpty() && activeThreads == 0;
}
@@ -686,10 +690,7 @@ void QThreadPool::releaseThread()
bool QThreadPool::waitForDone(int msecs)
{
Q_D(QThreadPool);
- bool rc = d->waitForDone(msecs);
- if (rc)
- d->reset();
- return rc;
+ return d->waitForDone(msecs);
}
/*!
diff --git a/src/corelib/thread/qthreadpool_p.h b/src/corelib/thread/qthreadpool_p.h
index 0e6a00d243..952e02ef20 100644
--- a/src/corelib/thread/qthreadpool_p.h
+++ b/src/corelib/thread/qthreadpool_p.h
@@ -63,6 +63,8 @@ QT_REQUIRE_CONFIG(thread);
QT_BEGIN_NAMESPACE
+class QDeadlineTimer;
+
class QueuePage {
public:
enum {
@@ -163,12 +165,13 @@ public:
void startThread(QRunnable *runnable = 0);
void reset();
bool waitForDone(int msecs);
+ bool waitForDone(const QDeadlineTimer &timer);
void clear();
void stealAndRunRunnable(QRunnable *runnable);
void deletePageIfFinished(QueuePage *page);
mutable QMutex mutex;
- QList<QThreadPoolThread *> allThreads;
+ QSet<QThreadPoolThread *> allThreads;
QQueue<QThreadPoolThread *> waitingThreads;
QQueue<QThreadPoolThread *> expiredThreads;
QVector<QueuePage*> queue;
@@ -179,7 +182,6 @@ public:
int reservedThreads = 0;
int activeThreads = 0;
uint stackSize = 0;
- bool isExiting = false;
};
QT_END_NAMESPACE
diff --git a/src/corelib/tools/qline.cpp b/src/corelib/tools/qline.cpp
index 9704a00b85..949f63ea15 100644
--- a/src/corelib/tools/qline.cpp
+++ b/src/corelib/tools/qline.cpp
@@ -387,10 +387,9 @@ QDataStream &operator>>(QDataStream &stream, QLine &line)
\value UnboundedIntersection The two lines intersect, but not
within the range defined by their lengths. This will be the case
- if the lines are not parallel.
-
- intersect() will also return this value if the intersect point is
- within the start and end point of only one of the lines.
+ if the lines are not parallel. intersect() will also return this
+ value if the intersect point is within the start and end point of
+ only one of the lines.
\value BoundedIntersection The two lines intersect with each other
within the start and end points of each line.
diff --git a/src/corelib/tools/qt_attribution.json b/src/corelib/tools/qt_attribution.json
index 5bb95c9f5b..a842d9467b 100644
--- a/src/corelib/tools/qt_attribution.json
+++ b/src/corelib/tools/qt_attribution.json
@@ -4,12 +4,14 @@
"Name": "Unicode Character Database (UCD)",
"QDocModule": "qtcore",
"QtUsage": "Qt Core uses data obtained from UCD files for working with characters and strings.",
+ "Files": "For update, see qtbase/util/unicode/README",
"Files": "qunicodetables_p.h qunicodetables.cpp",
"Description": "The Unicode Character Database (UCD) is a set of files that
define the Unicode character properties and internal mappings.",
"Homepage": "https://www.unicode.org/ucd/",
- "Version": "10.0.0",
+ "Version": "Don't use the Unicode standard version; UCD has its own 'Revision' numbers",
+ "Version": "20",
"License": "Unicode License Agreement - Data Files and Software (2016)",
"LicenseId": "Unicode-DFS-2016",
"LicenseFile": "UNICODE_LICENSE.txt",
diff --git a/src/gui/doc/snippets/qimagewriter/main.cpp b/src/gui/doc/snippets/qimagewriter/main.cpp
new file mode 100644
index 0000000000..3758110356
--- /dev/null
+++ b/src/gui/doc/snippets/qimagewriter/main.cpp
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 Samuel Gaist <samuel.gaist@idiap.ch>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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 The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, 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 The Qt Company Ltd 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$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+int main(int argc, char **argv)
+{
+ QApplication app(argc, argv);
+
+//! [0]
+ QString imagePath(QStringLiteral("path/image.jpeg"));
+ QImage image(64, 64, QImage::Format_RGB32);
+ image.fill(Qt::red);
+ {
+ QImageWriter writer(imagePath);
+ writer.write(image);
+ }
+
+ QFile::rename(imagePath,
+ QStringLiteral("path/other_image.jpeg"));
+//! [0]
+
+ return 0;
+}
diff --git a/src/gui/image/qimagewriter.cpp b/src/gui/image/qimagewriter.cpp
index 5ce7e309bb..d3f9a9b881 100644
--- a/src/gui/image/qimagewriter.cpp
+++ b/src/gui/image/qimagewriter.cpp
@@ -71,6 +71,16 @@
formats, in addition to any image format plugins that support
writing.
+ \note QImageWriter assumes exclusive control over the file or
+ device that is assigned. Any attempts to modify the assigned file
+ or device during the lifetime of the QImageWriter object will
+ yield undefined results. If immediate access to a resource is
+ desired, the use of a scope is the recommended method.
+
+ For example:
+
+ \snippet qimagewriter/main.cpp 0
+
\sa QImageReader, QImageIOHandler, QImageIOPlugin
*/
diff --git a/src/gui/kernel/qscreen.cpp b/src/gui/kernel/qscreen.cpp
index 479e228e27..f208eb02be 100644
--- a/src/gui/kernel/qscreen.cpp
+++ b/src/gui/kernel/qscreen.cpp
@@ -701,6 +701,11 @@ void QScreenPrivate::updatePrimaryOrientation()
border of the window. If \a height is negative, the function
copies everything to the bottom of the window.
+ The offset and size arguments are specified in device independent
+ pixels. The returned pixmap may be larger than the requested size
+ when grabbing from a high-DPI screen. Call QPixmap::devicePixelRatio()
+ to determine if this is the case.
+
The window system identifier (\c WId) can be retrieved using the
QWidget::winId() function. The rationale for using a window
identifier and not a QWidget, is to enable grabbing of windows
@@ -748,7 +753,7 @@ QPixmap QScreen::grabWindow(WId window, int x, int y, int width, int height)
QPixmap result =
platformScreen->grabWindow(window, nativePos.x(), nativePos.y(),
nativeSize.width(), nativeSize.height());
- result.setDevicePixelRatio(factor);
+ result.setDevicePixelRatio(result.devicePixelRatio() * factor);
return result;
}
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp
index 6ca4bc8209..008f695da0 100644
--- a/src/gui/text/qtextdocument.cpp
+++ b/src/gui/text/qtextdocument.cpp
@@ -1912,7 +1912,7 @@ static void printPage(int index, QPainter *painter, const QTextDocument *doc, co
}
/*!
- Prints the document to the given \a printer. The QPageablePaintDevice must be
+ Prints the document to the given \a printer. The QPagedPaintDevice must be
set up before being used with this function.
This is only a convenience method to print the whole document to the printer.
diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp
index b380b0f7d6..24c17124dc 100644
--- a/src/network/socket/qnativesocketengine_unix.cpp
+++ b/src/network/socket/qnativesocketengine_unix.cpp
@@ -1383,20 +1383,24 @@ qint64 QNativeSocketEnginePrivate::nativeRead(char *data, qint64 maxSize)
// No data was available for reading
r = -2;
break;
- case EBADF:
- case EINVAL:
- case EIO:
- //error string is now set in read(), not here in nativeRead()
- break;
case ECONNRESET:
#if defined(Q_OS_VXWORKS)
case ESHUTDOWN:
#endif
r = 0;
break;
+ case ETIMEDOUT:
+ socketError = QAbstractSocket::SocketTimeoutError;
+ break;
default:
+ socketError = QAbstractSocket::NetworkError;
break;
}
+
+ if (r == -1) {
+ hasSetSocketError = true;
+ socketErrorString = qt_error_string();
+ }
}
#if defined (QNATIVESOCKETENGINE_DEBUG)
diff --git a/src/plugins/platforms/cocoa/qcocoascreen.mm b/src/plugins/platforms/cocoa/qcocoascreen.mm
index f82ef202b1..0d6567070e 100644
--- a/src/plugins/platforms/cocoa/qcocoascreen.mm
+++ b/src/plugins/platforms/cocoa/qcocoascreen.mm
@@ -466,6 +466,7 @@ QPixmap QCocoaScreen::grabWindow(WId window, int x, int y, int width, int height
const qreal dpr = devicePixelRatio();
QPixmap windowPixmap(windowSize * dpr);
+ windowPixmap.setDevicePixelRatio(dpr);
windowPixmap.fill(Qt::transparent);
for (uint i = 0; i < displayCount; ++i) {
@@ -473,8 +474,8 @@ QPixmap QCocoaScreen::grabWindow(WId window, int x, int y, int width, int height
// Calculate the position and size of the requested area
QPoint pos(qAbs(bounds.origin.x - x), qAbs(bounds.origin.y - y));
- QSize size(qMin(pos.x() + width, qRound(bounds.size.width)),
- qMin(pos.y() + height, qRound(bounds.size.height)));
+ QSize size(qMin(width, qRound(bounds.size.width)),
+ qMin(height, qRound(bounds.size.height)));
pos *= dpr;
size *= dpr;
diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
index 681b35eb7c..b629cc00a3 100644
--- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
+++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
@@ -558,6 +558,10 @@ public:
SFGAOF attributes() const { return m_attributes; }
QString normalDisplay() const // base name, usually
{ return displayName(m_item, SIGDN_NORMALDISPLAY); }
+ QString urlString() const
+ { return displayName(m_item, SIGDN_URL); }
+ QString fileSysPath() const
+ { return displayName(m_item, SIGDN_FILESYSPATH); }
QString desktopAbsoluteParsing() const
{ return displayName(m_item, SIGDN_DESKTOPABSOLUTEPARSING); }
QString path() const; // Only set for 'FileSystem' (SFGAO_FILESYSTEM) items
@@ -734,7 +738,8 @@ void QWindowsShellItem::format(QDebug &d) const
if (canCopy())
d << " [copyable]";
d << ", normalDisplay=\"" << normalDisplay()
- << "\", desktopAbsoluteParsing=\"" << desktopAbsoluteParsing() << '"';
+ << "\", desktopAbsoluteParsing=\"" << desktopAbsoluteParsing()
+ << "\", urlString=\"" << urlString() << "\", fileSysPath=\"" << fileSysPath() << '"';
const QString pathS = path();
if (!pathS.isEmpty())
d << ", path=\"" << pathS << '"';
diff --git a/src/plugins/platforms/windows/qwindowskeymapper.cpp b/src/plugins/platforms/windows/qwindowskeymapper.cpp
index 9e6101b758..96abfdb9d7 100644
--- a/src/plugins/platforms/windows/qwindowskeymapper.cpp
+++ b/src/plugins/platforms/windows/qwindowskeymapper.cpp
@@ -1263,6 +1263,13 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, MSG msg,
}
#endif // !QT_NO_SHORTCUT
key_recorder.storeKey(int(msg.wParam), a, state, text);
+
+ // QTBUG-71210
+ // VK_PACKET specifies multiple characters. The system only sends the first
+ // character of this sequence for each.
+ if (msg.wParam == VK_PACKET)
+ code = asciiToKeycode(char(uch.cell()), state);
+
QWindowSystemInterface::handleExtendedKeyEvent(receiver, QEvent::KeyPress, code,
modifiers, scancode, quint32(msg.wParam), nModifiers, text, false);
result =true;
diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.cpp b/src/plugins/platforms/xcb/qxcbbackingstore.cpp
index c8c806749f..ba9a3e68ee 100644
--- a/src/plugins/platforms/xcb/qxcbbackingstore.cpp
+++ b/src/plugins/platforms/xcb/qxcbbackingstore.cpp
@@ -837,6 +837,9 @@ void QXcbBackingStore::endPaint()
QImage QXcbBackingStore::toImage() const
{
+ // If the backingstore is rgbSwapped, return the internal image type here.
+ if (!m_rgbImage.isNull())
+ return m_rgbImage;
return m_image && m_image->image() ? *m_image->image() : QImage();
}
diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm
index 0204bd6104..1fd3420899 100644
--- a/src/plugins/styles/mac/qmacstyle_mac.mm
+++ b/src/plugins/styles/mac/qmacstyle_mac.mm
@@ -1512,7 +1512,7 @@ QRectF QMacStylePrivate::CocoaControl::adjustedControlFrame(const QRectF &rect)
frameRect = frameRect.translated(rect.topLeft());
if (type == QMacStylePrivate::Button_PullDown || type == QMacStylePrivate::Button_PopupButton) {
if (size == QStyleHelper::SizeLarge)
- frameRect = frameRect.adjusted(0, 0, -6, 0).translated(3, -1);
+ frameRect = frameRect.adjusted(0, 0, -6, 0).translated(3, 0);
else if (size == QStyleHelper::SizeSmall)
frameRect = frameRect.adjusted(0, 0, -4, 0).translated(2, 1);
else if (size == QStyleHelper::SizeMini)
diff --git a/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp b/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp
index 2115a14adf..738905a9a0 100644
--- a/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp
+++ b/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp
@@ -212,8 +212,11 @@ static QString generateInterfaceXml(const ClassDef *mo)
access |= 2;
int typeId = QMetaType::type(mp.type.constData());
- if (!typeId)
+ if (!typeId) {
+ fprintf(stderr, PROGRAMNAME ": unregistered type: '%s', ignoring\n",
+ mp.type.constData());
continue;
+ }
const char *signature = QDBusMetaType::typeToSignature(typeId);
if (!signature)
continue;
diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp
index 99157747dd..d8cd19ef1a 100644
--- a/src/widgets/dialogs/qmessagebox.cpp
+++ b/src/widgets/dialogs/qmessagebox.cpp
@@ -1844,10 +1844,10 @@ void QMessageBox::aboutQt(QWidget *parent, const QString &title)
"<p>Qt licensed under our commercial license agreement is appropriate "
"for development of proprietary/commercial software where you do not "
"want to share any source code with third parties or otherwise cannot "
- "comply with the terms of the GNU LGPL version 3.</p>"
- "<p>Qt licensed under the GNU LGPL version 3 is appropriate for the "
+ "comply with the terms of GNU (L)GPL.</p>"
+ "<p>Qt licensed under GNU (L)GPL is appropriate for the "
"development of Qt&nbsp;applications provided you can comply with the terms "
- "and conditions of the GNU LGPL version 3.</p>"
+ "and conditions of the respective licenses.</p>"
"<p>Please see <a href=\"http://%2/\">%2</a> "
"for an overview of Qt licensing.</p>"
"<p>Copyright (C) %1 The Qt Company Ltd and other "
diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp
index b40c2d12ad..a32eb2a03b 100644
--- a/src/widgets/kernel/qwidgetbackingstore.cpp
+++ b/src/widgets/kernel/qwidgetbackingstore.cpp
@@ -101,6 +101,13 @@ void QWidgetBackingStore::qt_flush(QWidget *widget, const QRegion &region, QBack
if (tlw->testAttribute(Qt::WA_DontShowOnScreen) || widget->testAttribute(Qt::WA_DontShowOnScreen))
return;
+
+ // Foreign Windows do not have backing store content and must not be flushed
+ if (QWindow *widgetWindow = widget->windowHandle()) {
+ if (widgetWindow->type() == Qt::ForeignWindow)
+ return;
+ }
+
static bool fpsDebug = qEnvironmentVariableIntValue("QT_DEBUG_FPS");
if (fpsDebug) {
if (!widgetBackingStore->perfFrames++)
diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp
index 0b2d72f330..279c6c0282 100644
--- a/src/widgets/kernel/qwidgetwindow.cpp
+++ b/src/widgets/kernel/qwidgetwindow.cpp
@@ -642,7 +642,8 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
if (!widget)
widget = m_widget;
- if (event->type() == QEvent::MouseButtonPress)
+ const bool initialPress = event->buttons() == event->button();
+ if (event->type() == QEvent::MouseButtonPress && initialPress)
qt_button_down = widget;
QWidget *receiver = QApplicationPrivate::pickMouseReceiver(m_widget, event->windowPos().toPoint(), &mapped, event->type(), event->buttons(),
diff --git a/tests/auto/corelib/io/qsettings/BLACKLIST b/tests/auto/corelib/io/qsettings/BLACKLIST
deleted file mode 100644
index 36d68bd918..0000000000
--- a/tests/auto/corelib/io/qsettings/BLACKLIST
+++ /dev/null
@@ -1,2 +0,0 @@
-[isWritable:native]
-osx-10.11
diff --git a/tests/auto/gui/kernel/qwindow/BLACKLIST b/tests/auto/gui/kernel/qwindow/BLACKLIST
index f54865b841..caf39742f6 100644
--- a/tests/auto/gui/kernel/qwindow/BLACKLIST
+++ b/tests/auto/gui/kernel/qwindow/BLACKLIST
@@ -26,7 +26,6 @@ osx
# QTBUG-69163
android
[visibility]
-osx-10.11 ci
osx-10.12 ci
[testInputEvents]
diff --git a/tests/auto/other/macnativeevents/BLACKLIST b/tests/auto/other/macnativeevents/BLACKLIST
index 32e0b1d50b..2922e22d9f 100644
--- a/tests/auto/other/macnativeevents/BLACKLIST
+++ b/tests/auto/other/macnativeevents/BLACKLIST
@@ -32,7 +32,6 @@ osx
osx
# QTQAINFRA-1292
[testPushButtonPressRelease]
-osx-10.11 ci
osx-10.12 ci
# QTQAINFRA-1292
diff --git a/tests/auto/testlib/selftests/test/BLACKLIST b/tests/auto/testlib/selftests/test/BLACKLIST
deleted file mode 100644
index 2d4adf1feb..0000000000
--- a/tests/auto/testlib/selftests/test/BLACKLIST
+++ /dev/null
@@ -1,3 +0,0 @@
-#QTBUG-55155
-[runSubTest:maxwarnings all loggers]
-osx-10.11
diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/BLACKLIST b/tests/auto/widgets/graphicsview/qgraphicsscene/BLACKLIST
index 0e7a1b451f..b8b427b3dd 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsscene/BLACKLIST
+++ b/tests/auto/widgets/graphicsview/qgraphicsscene/BLACKLIST
@@ -1,10 +1,6 @@
-[removeItem]
-# QTBUG-60754, QTest::mouseMove is not always respected, or the CI moves the cursor
-osx-10.11 ci
[isActive]
opensuse-42.3 ci
[removeFullyTransparentItem]
-osx-10.11
osx-10.12
[tabFocus_sceneWithNestedFocusWidgets]
opensuse
diff --git a/tests/auto/widgets/kernel/qwidget/BLACKLIST b/tests/auto/widgets/kernel/qwidget/BLACKLIST
index d8654e5768..1f68308bbe 100644
--- a/tests/auto/widgets/kernel/qwidget/BLACKLIST
+++ b/tests/auto/widgets/kernel/qwidget/BLACKLIST
@@ -32,7 +32,6 @@ osx
[render_systemClip]
osx
[showMinimizedKeepsFocus]
-osx-10.11 ci
osx-10.12 ci
osx-10.13 ci
[maskedUpdate]
diff --git a/tests/auto/widgets/widgets/qmenu/BLACKLIST b/tests/auto/widgets/widgets/qmenu/BLACKLIST
index 89d12a259f..bac14ea225 100644
--- a/tests/auto/widgets/widgets/qmenu/BLACKLIST
+++ b/tests/auto/widgets/widgets/qmenu/BLACKLIST
@@ -1,7 +1,6 @@
[task258920_mouseBorder]
osx
[submenuTearOffDontClose]
-osx-10.11 ci
osx-10.12 ci
[layoutDirection]
# Fails when enabling synchronous expose events QTBUG-62092
diff --git a/tests/manual/dialogs/main.cpp b/tests/manual/dialogs/main.cpp
index 83089e684c..fc4adebcc0 100644
--- a/tests/manual/dialogs/main.cpp
+++ b/tests/manual/dialogs/main.cpp
@@ -44,6 +44,8 @@
#include <QAction>
#include <QKeySequence>
+static bool optNoPrinter = false;
+
// Test for dialogs, allowing to play with all dialog options for implementing native dialogs.
// Compiles with Qt 4.8 and Qt 5.
@@ -109,7 +111,8 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
tabWidget->addTab(new WizardPanel, tr("QWizard"));
tabWidget->addTab(new MessageBoxPanel, tr("QMessageBox"));
#ifndef QT_NO_PRINTER
- tabWidget->addTab(new PrintDialogPanel, tr("QPrintDialog"));
+ if (!optNoPrinter)
+ tabWidget->addTab(new PrintDialogPanel, tr("QPrintDialog"));
#endif
setCentralWidget(tabWidget);
}
@@ -123,14 +126,16 @@ void MainWindow::aboutDialog()
int main(int argc, char *argv[])
{
-#if QT_VERSION >= 0x050700
for (int a = 1; a < argc; ++a) {
if (!qstrcmp(argv[a], "-n")) {
qDebug("AA_DontUseNativeDialogs");
+#if QT_VERSION >= 0x050700
QCoreApplication::setAttribute(Qt::AA_DontUseNativeDialogs);
+#endif
+ } else if (!qstrcmp(argv[a], "-p")) {
+ optNoPrinter = true; // Avoid startup slowdown by printer code
}
}
-#endif // Qt 5
QApplication a(argc, argv);
MainWindow w;
diff --git a/util/unicode/README b/util/unicode/README
index ca34266a36..e52f26175a 100644
--- a/util/unicode/README
+++ b/util/unicode/README
@@ -1 +1,32 @@
Unicode is used to generate the unicode data in src/corelib/tools.
+
+To update:
+* Find the data (UAX #44, UCD; not the XML version) at
+ ftp://www.unicode.org/Public/zipped/$Version/
+* Unpack the zip file; for each file in data/, replace with the new
+ version; find the *BreakProperty.txt in auxiliary/. (These last are
+ only in the zip, not in the web-space's unpacked versions.)
+* If needed, add an entry to enum QChar::UnicodeVersion for the new
+ Unicode version
+* In that case, also update main.cpp's initAgeMap and DATA_VERSION_S*
+ to match
+* Build this project. Its binary, unicode, ignores command-line
+ options and assumes it is being run from this directory. When run,
+ it produces lots of output. Hopefully that doesn't matter.
+* Assertions may trigger: if so, study code and understand what's more
+ complicated about this update; talk to folk named in the git logs,
+ maybe push a WIP to gerrit to solicit advice. Some bit-field may
+ need to be expanded, for example. In some cases QChar may need
+ additions to some of its enums.
+* Build with the modified code, fix any compilation issues.
+* That may have updated qtbase/src/corelib/tools/qunicodetables.cpp;
+ if so the update matters; be sure to commit the changes to data/ at
+ the same time and update tools/qt_attribution.json to match; use the
+ UCD Revision number, rather than the Unicode standard number, as the
+ Version, for all that qunicodetables.cpp uses the latter.
+
+The script writingSystems.sh generates a list of writing systems,
+ostensibly as a the basis for updating QFontDatabase::WritingSystem
+enum; however, the Release 20 output of it contains many more writing
+systems than are present in that enum, suggesting it has not been run
+in a very long time. Further research needed.
diff --git a/util/unicode/main.cpp b/util/unicode/main.cpp
index 0c3c0b2ee1..00c69de008 100644
--- a/util/unicode/main.cpp
+++ b/util/unicode/main.cpp
@@ -78,7 +78,6 @@ static void initAgeMap()
}
}
-
static QHash<QByteArray, QChar::Category> categoryMap;
static void initCategoryMap()
@@ -778,7 +777,6 @@ static void initScriptMap()
{ QChar::Script_Soyombo, "Soyombo" },
{ QChar::Script_ZanabazarSquare, "ZanabazarSquare" },
-
// unhandled
{ QChar::Script_Unknown, 0 }
};
@@ -789,7 +787,6 @@ static void initScriptMap()
}
}
-
// Keep this one in sync with the code in createPropertyInfo
static const char *property_string =
"struct Properties {\n"
@@ -2473,9 +2470,9 @@ static QByteArray createPropertyInfo()
out += ", ";
out += QByteArray::number( p.lowerCaseDiff );
out += ", ";
- out += "#ifdef Q_OS_WASM \n"
+ out += "#ifdef Q_OS_WASM \n";
// " unsigned char : 0; //wasm 64 packing trick QTBUG-65259\n"
- out += "#endif \n"
+ out += "#endif \n";
out += ", ";
// " ushort upperCaseSpecial : 1;\n"
// " signed short upperCaseDiff : 15;\n"
@@ -2501,9 +2498,9 @@ static QByteArray createPropertyInfo()
// " ushort nfQuickCheck : 8;\n"
out += QByteArray::number( p.nfQuickCheck );
out += ", ";
- out += "#ifdef Q_OS_WASM \n"
+ out += "#ifdef Q_OS_WASM \n";
// " unsigned char : 0; //wasm 64 packing trick QTBUG-65259\n"
- out += "#endif \n"
+ out += "#endif \n";
out += ", ";
// " ushort graphemeBreakClass : 5; /* 5 used */\n"
// " ushort wordBreakClass : 5; /* 5 used */\n"