Merge remote-tracking branch 'origin/5.12' into dev
Change-Id: I5dbdc13c6133e5b03e362c5461b4a599d781bd1ebb10
commit
0441d959ff
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -1214,6 +1214,7 @@
|
|||
},
|
||||
"compile_examples": {
|
||||
"label": "Compile examples",
|
||||
"autoDetect": "!config.wasm",
|
||||
"output": [ "privateConfig" ]
|
||||
},
|
||||
"incredibuild_xge": {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 ]
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@
|
|||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <QtWidgets/QApplication>
|
||||
#include <QApplication>
|
||||
#include "mainwindow.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@
|
|||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <QtWidgets/QApplication>
|
||||
#include <QApplication>
|
||||
#include "mainwindow.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@
|
|||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <QtWidgets/QApplication>
|
||||
#include <QApplication>
|
||||
#include "mainwindow.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
|
|
|
|||
|
|
@ -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++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "NO"
|
||||
disableMainThreadChecker = "YES"
|
||||
buildConfiguration = "Debug">
|
||||
<Testables>
|
||||
<TestableReference
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
@ -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"
|
||||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -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__)
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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__)
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
// 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();
|
||||
|
||||
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();
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
isExiting = false;
|
||||
/*!
|
||||
\internal
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -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
|
||||
*/
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -1383,19 +1383,23 @@ 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;
|
||||
default:
|
||||
case ETIMEDOUT:
|
||||
socketError = QAbstractSocket::SocketTimeoutError;
|
||||
break;
|
||||
default:
|
||||
socketError = QAbstractSocket::NetworkError;
|
||||
break;
|
||||
}
|
||||
|
||||
if (r == -1) {
|
||||
hasSetSocketError = true;
|
||||
socketErrorString = qt_error_string();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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 << '"';
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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 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 "
|
||||
|
|
|
|||
|
|
@ -101,6 +101,13 @@ void QWidgetBackingStore::qt_flush(QWidget *widget, const QRegion ®ion, 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++)
|
||||
|
|
|
|||
|
|
@ -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(),
|
||||
|
|
|
|||
|
|
@ -1,2 +0,0 @@
|
|||
[isWritable:native]
|
||||
osx-10.11
|
||||
|
|
@ -26,7 +26,6 @@ osx
|
|||
# QTBUG-69163
|
||||
android
|
||||
[visibility]
|
||||
osx-10.11 ci
|
||||
osx-10.12 ci
|
||||
|
||||
[testInputEvents]
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@ osx
|
|||
osx
|
||||
# QTQAINFRA-1292
|
||||
[testPushButtonPressRelease]
|
||||
osx-10.11 ci
|
||||
osx-10.12 ci
|
||||
|
||||
# QTQAINFRA-1292
|
||||
|
|
|
|||
|
|
@ -1,3 +0,0 @@
|
|||
#QTBUG-55155
|
||||
[runSubTest:maxwarnings all loggers]
|
||||
osx-10.11
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@ osx
|
|||
[render_systemClip]
|
||||
osx
|
||||
[showMinimizedKeepsFocus]
|
||||
osx-10.11 ci
|
||||
osx-10.12 ci
|
||||
osx-10.13 ci
|
||||
[maskedUpdate]
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Reference in New Issue