Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: I7f11733bda960196a96c6452bdabeb7072a8430d
This commit is contained in:
commit
cd04181b2b
@ -53,7 +53,7 @@
|
|||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
|
|
||||||
SpreadSheetDelegate::SpreadSheetDelegate(QObject *parent)
|
SpreadSheetDelegate::SpreadSheetDelegate(QObject *parent)
|
||||||
: QItemDelegate(parent)
|
: QStyledItemDelegate(parent)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
QWidget *SpreadSheetDelegate::createEditor(QWidget *parent,
|
QWidget *SpreadSheetDelegate::createEditor(QWidget *parent,
|
||||||
|
@ -51,9 +51,9 @@
|
|||||||
#ifndef SPREADSHEETDELEGATE_H
|
#ifndef SPREADSHEETDELEGATE_H
|
||||||
#define SPREADSHEETDELEGATE_H
|
#define SPREADSHEETDELEGATE_H
|
||||||
|
|
||||||
#include <QItemDelegate>
|
#include <QStyledItemDelegate>
|
||||||
|
|
||||||
class SpreadSheetDelegate : public QItemDelegate
|
class SpreadSheetDelegate : public QStyledItemDelegate
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@ -55,9 +55,8 @@
|
|||||||
|
|
||||||
//! [0]
|
//! [0]
|
||||||
ImageDelegate::ImageDelegate(QObject *parent)
|
ImageDelegate::ImageDelegate(QObject *parent)
|
||||||
: QItemDelegate(parent)
|
: QStyledItemDelegate(parent)
|
||||||
{
|
{}
|
||||||
}
|
|
||||||
//! [0]
|
//! [0]
|
||||||
|
|
||||||
//! [1]
|
//! [1]
|
||||||
|
@ -51,10 +51,10 @@
|
|||||||
#ifndef IMAGEDELEGATE_H
|
#ifndef IMAGEDELEGATE_H
|
||||||
#define IMAGEDELEGATE_H
|
#define IMAGEDELEGATE_H
|
||||||
|
|
||||||
#include <QItemDelegate>
|
#include <QStyledItemDelegate>
|
||||||
|
|
||||||
//! [0]
|
//! [0]
|
||||||
class ImageDelegate : public QItemDelegate
|
class ImageDelegate : public QStyledItemDelegate
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ public:
|
|||||||
//! [1] //! [2]
|
//! [1] //! [2]
|
||||||
private slots:
|
private slots:
|
||||||
void emitCommitData();
|
void emitCommitData();
|
||||||
};
|
|
||||||
//! [2]
|
//! [2]
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -216,16 +216,13 @@ void MainWindow::changeIcon()
|
|||||||
QImage image(fileName);
|
QImage image(fileName);
|
||||||
if (!image.isNull())
|
if (!image.isNull())
|
||||||
icon.addPixmap(QPixmap::fromImage(image), mode, state);
|
icon.addPixmap(QPixmap::fromImage(image), mode, state);
|
||||||
//! [8] //! [9]
|
//! [8]
|
||||||
}
|
}
|
||||||
//! [9] //! [10]
|
|
||||||
}
|
}
|
||||||
//! [10]
|
|
||||||
|
|
||||||
//! [11]
|
//! [11]
|
||||||
previewArea->setIcon(icon);
|
previewArea->setIcon(icon);
|
||||||
}
|
|
||||||
//! [11]
|
//! [11]
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::addSampleImages()
|
void MainWindow::addSampleImages()
|
||||||
{
|
{
|
||||||
@ -280,17 +277,15 @@ void MainWindow::loadImages(const QStringList &fileNames)
|
|||||||
.arg(QDir::toNativeSeparators(fileInfo.absolutePath()), fileInfo.fileName())
|
.arg(QDir::toNativeSeparators(fileInfo.absolutePath()), fileInfo.fileName())
|
||||||
.arg(fileInfo2x.exists() ? fileInfo2x.fileName() : tr("<None>"))
|
.arg(fileInfo2x.exists() ? fileInfo2x.fileName() : tr("<None>"))
|
||||||
.arg(image.width()).arg(image.height());
|
.arg(image.width()).arg(image.height());
|
||||||
//! [13] //! [14]
|
|
||||||
QTableWidgetItem *fileItem = new QTableWidgetItem(imageName);
|
QTableWidgetItem *fileItem = new QTableWidgetItem(imageName);
|
||||||
fileItem->setData(Qt::UserRole, fileName);
|
fileItem->setData(Qt::UserRole, fileName);
|
||||||
fileItem->setIcon(QPixmap::fromImage(image));
|
fileItem->setIcon(QPixmap::fromImage(image));
|
||||||
fileItem->setFlags((fileItem->flags() | Qt::ItemIsUserCheckable) & ~Qt::ItemIsEditable);
|
fileItem->setFlags((fileItem->flags() | Qt::ItemIsUserCheckable) & ~Qt::ItemIsEditable);
|
||||||
fileItem->setToolTip(toolTip);
|
fileItem->setToolTip(toolTip);
|
||||||
//! [14]
|
//! [13]
|
||||||
|
|
||||||
//! [15]
|
//! [15]
|
||||||
QIcon::Mode mode = QIcon::Normal;
|
QIcon::Mode mode = QIcon::Normal;
|
||||||
//! [15] //! [16]
|
|
||||||
QIcon::State state = QIcon::Off;
|
QIcon::State state = QIcon::Off;
|
||||||
if (guessModeStateAct->isChecked()) {
|
if (guessModeStateAct->isChecked()) {
|
||||||
if (imageName.contains(QLatin1String("_act"), Qt::CaseInsensitive))
|
if (imageName.contains(QLatin1String("_act"), Qt::CaseInsensitive))
|
||||||
@ -302,13 +297,11 @@ void MainWindow::loadImages(const QStringList &fileNames)
|
|||||||
|
|
||||||
if (imageName.contains(QLatin1String("_on"), Qt::CaseInsensitive))
|
if (imageName.contains(QLatin1String("_on"), Qt::CaseInsensitive))
|
||||||
state = QIcon::On;
|
state = QIcon::On;
|
||||||
//! [16] //! [17]
|
//! [15]
|
||||||
}
|
}
|
||||||
//! [17]
|
|
||||||
|
|
||||||
//! [18]
|
//! [18]
|
||||||
imagesTable->setItem(row, 0, fileItem);
|
imagesTable->setItem(row, 0, fileItem);
|
||||||
//! [18] //! [19]
|
|
||||||
QTableWidgetItem *modeItem =
|
QTableWidgetItem *modeItem =
|
||||||
new QTableWidgetItem(IconPreviewArea::iconModeNames().at(IconPreviewArea::iconModes().indexOf(mode)));
|
new QTableWidgetItem(IconPreviewArea::iconModeNames().at(IconPreviewArea::iconModes().indexOf(mode)));
|
||||||
modeItem->setToolTip(toolTip);
|
modeItem->setToolTip(toolTip);
|
||||||
@ -321,9 +314,9 @@ void MainWindow::loadImages(const QStringList &fileNames)
|
|||||||
imagesTable->openPersistentEditor(stateItem);
|
imagesTable->openPersistentEditor(stateItem);
|
||||||
|
|
||||||
fileItem->setCheckState(Qt::Checked);
|
fileItem->setCheckState(Qt::Checked);
|
||||||
|
//! [18]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//! [19]
|
|
||||||
|
|
||||||
void MainWindow::useHighDpiPixmapsChanged(int checkState)
|
void MainWindow::useHighDpiPixmapsChanged(int checkState)
|
||||||
{
|
{
|
||||||
@ -350,9 +343,7 @@ QWidget *MainWindow::createImagesGroupBox()
|
|||||||
//! [21]
|
//! [21]
|
||||||
|
|
||||||
//! [22]
|
//! [22]
|
||||||
QStringList labels;
|
const QStringList labels({tr("Image"), tr("Mode"), tr("State")});
|
||||||
//! [22] //! [23]
|
|
||||||
labels << tr("Image") << tr("Mode") << tr("State");
|
|
||||||
|
|
||||||
imagesTable->horizontalHeader()->setDefaultSectionSize(90);
|
imagesTable->horizontalHeader()->setDefaultSectionSize(90);
|
||||||
imagesTable->setColumnCount(3);
|
imagesTable->setColumnCount(3);
|
||||||
@ -361,18 +352,17 @@ QWidget *MainWindow::createImagesGroupBox()
|
|||||||
imagesTable->horizontalHeader()->setSectionResizeMode(1, QHeaderView::Fixed);
|
imagesTable->horizontalHeader()->setSectionResizeMode(1, QHeaderView::Fixed);
|
||||||
imagesTable->horizontalHeader()->setSectionResizeMode(2, QHeaderView::Fixed);
|
imagesTable->horizontalHeader()->setSectionResizeMode(2, QHeaderView::Fixed);
|
||||||
imagesTable->verticalHeader()->hide();
|
imagesTable->verticalHeader()->hide();
|
||||||
//! [23]
|
//! [22]
|
||||||
|
|
||||||
//! [24]
|
//! [24]
|
||||||
connect(imagesTable, &QTableWidget::itemChanged,
|
connect(imagesTable, &QTableWidget::itemChanged,
|
||||||
//! [24] //! [25]
|
|
||||||
this, &MainWindow::changeIcon);
|
this, &MainWindow::changeIcon);
|
||||||
|
|
||||||
QVBoxLayout *layout = new QVBoxLayout(imagesGroupBox);
|
QVBoxLayout *layout = new QVBoxLayout(imagesGroupBox);
|
||||||
layout->addWidget(imagesTable);
|
layout->addWidget(imagesTable);
|
||||||
return imagesGroupBox;
|
return imagesGroupBox;
|
||||||
}
|
|
||||||
//! [25]
|
//! [25]
|
||||||
|
}
|
||||||
|
|
||||||
//! [26]
|
//! [26]
|
||||||
QWidget *MainWindow::createIconSizeGroupBox()
|
QWidget *MainWindow::createIconSizeGroupBox()
|
||||||
@ -428,8 +418,8 @@ QWidget *MainWindow::createIconSizeGroupBox()
|
|||||||
layout->addLayout(otherSizeLayout, 3, 0, 1, 2);
|
layout->addLayout(otherSizeLayout, 3, 0, 1, 2);
|
||||||
layout->setRowStretch(4, 1);
|
layout->setRowStretch(4, 1);
|
||||||
return iconSizeGroupBox;
|
return iconSizeGroupBox;
|
||||||
}
|
|
||||||
//! [27]
|
//! [27]
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::screenChanged()
|
void MainWindow::screenChanged()
|
||||||
{
|
{
|
||||||
|
@ -22,7 +22,7 @@ QMAKE_CFLAGS_WARN_OFF = -W0
|
|||||||
QMAKE_CFLAGS_DEBUG = $$QMAKE_CFLAGS_OPTIMIZE_DEBUG -Zi -MDd
|
QMAKE_CFLAGS_DEBUG = $$QMAKE_CFLAGS_OPTIMIZE_DEBUG -Zi -MDd
|
||||||
QMAKE_CFLAGS_UTF8_SOURCE = -Qoption,cpp,--unicode_source_kind,UTF-8
|
QMAKE_CFLAGS_UTF8_SOURCE = -Qoption,cpp,--unicode_source_kind,UTF-8
|
||||||
QMAKE_CFLAGS_LTCG = -Qipo
|
QMAKE_CFLAGS_LTCG = -Qipo
|
||||||
QMAKE_CFLAGS_DISABLE_LTCG = -Qno-ipo
|
QMAKE_CFLAGS_DISABLE_LTCG = -Qipo-
|
||||||
|
|
||||||
QMAKE_CFLAGS_SSE2 = -QxSSE2
|
QMAKE_CFLAGS_SSE2 = -QxSSE2
|
||||||
QMAKE_CFLAGS_SSE3 = -QxSSE3
|
QMAKE_CFLAGS_SSE3 = -QxSSE3
|
||||||
@ -39,6 +39,11 @@ QMAKE_CFLAGS_AVX512DQ += -QxCORE-AVX512
|
|||||||
QMAKE_CFLAGS_AVX512BW += -QxCORE-AVX512
|
QMAKE_CFLAGS_AVX512BW += -QxCORE-AVX512
|
||||||
QMAKE_CFLAGS_AVX512VL += -QxCORE-AVX512
|
QMAKE_CFLAGS_AVX512VL += -QxCORE-AVX512
|
||||||
QMAKE_CFLAGS_F16C = $$QMAKE_CFLAGS_AVX2
|
QMAKE_CFLAGS_F16C = $$QMAKE_CFLAGS_AVX2
|
||||||
|
QMAKE_CFLAGS_RDRND = $$QMAKE_CFLAGS_AVX2
|
||||||
|
# ICC on Windows lacks the mrdseed compiler option that sets the RDSEED macro
|
||||||
|
QMAKE_CFLAGS_RDSEED = -D__RDSEED__=1
|
||||||
|
QMAKE_CFLAGS_ARCH_HASWELL = $$QMAKE_CFLAGS_AVX2
|
||||||
|
|
||||||
QMAKE_CFLAGS_AESNI = -QxSSE2
|
QMAKE_CFLAGS_AESNI = -QxSSE2
|
||||||
QMAKE_CFLAGS_SHANI = -QxSSE4.2
|
QMAKE_CFLAGS_SHANI = -QxSSE4.2
|
||||||
|
|
||||||
|
@ -362,6 +362,7 @@ public:
|
|||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
ExtraData *extraData; // extra data set by the user
|
ExtraData *extraData; // extra data set by the user
|
||||||
|
QThreadData *getThreadData() const { return threadData; }
|
||||||
QThreadData *threadData; // id of the thread that owns the object
|
QThreadData *threadData; // id of the thread that owns the object
|
||||||
|
|
||||||
using ConnectionDataPointer = QExplicitlySharedDataPointer<ConnectionData>;
|
using ConnectionDataPointer = QExplicitlySharedDataPointer<ConnectionData>;
|
||||||
|
@ -214,9 +214,6 @@ QT_BEGIN_NAMESPACE
|
|||||||
QShader, it indicates no shader code was found for the requested key.
|
QShader, it indicates no shader code was found for the requested key.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static const int QSB_VERSION = 2;
|
|
||||||
static const int QSB_VERSION_WITHOUT_BINDINGS = 1;
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Constructs a new, empty (and thus invalid) QShader instance.
|
Constructs a new, empty (and thus invalid) QShader instance.
|
||||||
*/
|
*/
|
||||||
@ -368,9 +365,9 @@ QByteArray QShader::serialized() const
|
|||||||
if (!buf.open(QIODevice::WriteOnly))
|
if (!buf.open(QIODevice::WriteOnly))
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
|
|
||||||
ds << QSB_VERSION;
|
ds << QShaderPrivate::QSB_VERSION;
|
||||||
ds << d->stage;
|
ds << d->stage;
|
||||||
ds << d->desc.toBinaryJson();
|
ds << d->desc.toCbor();
|
||||||
ds << d->shaders.count();
|
ds << d->shaders.count();
|
||||||
for (auto it = d->shaders.cbegin(), itEnd = d->shaders.cend(); it != itEnd; ++it) {
|
for (auto it = d->shaders.cbegin(), itEnd = d->shaders.cend(); it != itEnd; ++it) {
|
||||||
const QShaderKey &k(it.key());
|
const QShaderKey &k(it.key());
|
||||||
@ -429,9 +426,12 @@ QShader QShader::fromSerialized(const QByteArray &data)
|
|||||||
Q_ASSERT(d->ref.loadRelaxed() == 1); // must be detached
|
Q_ASSERT(d->ref.loadRelaxed() == 1); // must be detached
|
||||||
int intVal;
|
int intVal;
|
||||||
ds >> intVal;
|
ds >> intVal;
|
||||||
const int qsbVersion = intVal;
|
d->qsbVersion = intVal;
|
||||||
if (qsbVersion != QSB_VERSION && qsbVersion != QSB_VERSION_WITHOUT_BINDINGS) {
|
if (d->qsbVersion != QShaderPrivate::QSB_VERSION
|
||||||
qWarning("Attempted to deserialize QShader with unknown version %d.", qsbVersion);
|
&& d->qsbVersion != QShaderPrivate::QSB_VERSION_WITH_BINARY_JSON
|
||||||
|
&& d->qsbVersion != QShaderPrivate::QSB_VERSION_WITHOUT_BINDINGS)
|
||||||
|
{
|
||||||
|
qWarning("Attempted to deserialize QShader with unknown version %d.", d->qsbVersion);
|
||||||
return QShader();
|
return QShader();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -439,6 +439,9 @@ QShader QShader::fromSerialized(const QByteArray &data)
|
|||||||
d->stage = Stage(intVal);
|
d->stage = Stage(intVal);
|
||||||
QByteArray descBin;
|
QByteArray descBin;
|
||||||
ds >> descBin;
|
ds >> descBin;
|
||||||
|
if (d->qsbVersion > QShaderPrivate::QSB_VERSION_WITH_BINARY_JSON)
|
||||||
|
d->desc = QShaderDescription::fromCbor(descBin);
|
||||||
|
else
|
||||||
d->desc = QShaderDescription::fromBinaryJson(descBin);
|
d->desc = QShaderDescription::fromBinaryJson(descBin);
|
||||||
int count;
|
int count;
|
||||||
ds >> count;
|
ds >> count;
|
||||||
@ -454,7 +457,7 @@ QShader QShader::fromSerialized(const QByteArray &data)
|
|||||||
d->shaders[k] = shader;
|
d->shaders[k] = shader;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qsbVersion != QSB_VERSION_WITHOUT_BINDINGS) {
|
if (d->qsbVersion > QShaderPrivate::QSB_VERSION_WITHOUT_BINDINGS) {
|
||||||
ds >> count;
|
ds >> count;
|
||||||
for (int i = 0; i < count; ++i) {
|
for (int i = 0; i < count; ++i) {
|
||||||
QShaderKey k;
|
QShaderKey k;
|
||||||
|
@ -57,6 +57,10 @@ QT_BEGIN_NAMESPACE
|
|||||||
|
|
||||||
struct Q_GUI_EXPORT QShaderPrivate
|
struct Q_GUI_EXPORT QShaderPrivate
|
||||||
{
|
{
|
||||||
|
static const int QSB_VERSION = 3;
|
||||||
|
static const int QSB_VERSION_WITH_BINARY_JSON = 2;
|
||||||
|
static const int QSB_VERSION_WITHOUT_BINDINGS = 1;
|
||||||
|
|
||||||
QShaderPrivate()
|
QShaderPrivate()
|
||||||
: ref(1)
|
: ref(1)
|
||||||
{
|
{
|
||||||
@ -64,6 +68,7 @@ struct Q_GUI_EXPORT QShaderPrivate
|
|||||||
|
|
||||||
QShaderPrivate(const QShaderPrivate *other)
|
QShaderPrivate(const QShaderPrivate *other)
|
||||||
: ref(1),
|
: ref(1),
|
||||||
|
qsbVersion(other->qsbVersion),
|
||||||
stage(other->stage),
|
stage(other->stage),
|
||||||
desc(other->desc),
|
desc(other->desc),
|
||||||
shaders(other->shaders),
|
shaders(other->shaders),
|
||||||
@ -75,6 +80,7 @@ struct Q_GUI_EXPORT QShaderPrivate
|
|||||||
static const QShaderPrivate *get(const QShader *s) { return s->d; }
|
static const QShaderPrivate *get(const QShader *s) { return s->d; }
|
||||||
|
|
||||||
QAtomicInt ref;
|
QAtomicInt ref;
|
||||||
|
int qsbVersion = QSB_VERSION;
|
||||||
QShader::Stage stage = QShader::VertexStage;
|
QShader::Stage stage = QShader::VertexStage;
|
||||||
QShaderDescription desc;
|
QShaderDescription desc;
|
||||||
QHash<QShaderKey, QShaderCode> shaders;
|
QHash<QShaderKey, QShaderCode> shaders;
|
||||||
|
@ -38,6 +38,9 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
#include <QJsonArray>
|
#include <QJsonArray>
|
||||||
|
#include <QCborValue>
|
||||||
|
#include <QCborMap>
|
||||||
|
#include <QCborArray>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
@ -335,11 +338,27 @@ bool QShaderDescription::isValid() const
|
|||||||
/*!
|
/*!
|
||||||
\return a serialized binary version of the data.
|
\return a serialized binary version of the data.
|
||||||
|
|
||||||
\sa toJson()
|
\sa toJson(), toCbor()
|
||||||
*/
|
*/
|
||||||
QByteArray QShaderDescription::toBinaryJson() const
|
QByteArray QShaderDescription::toBinaryJson() const
|
||||||
{
|
{
|
||||||
|
#if QT_CONFIG(binaryjson)
|
||||||
return d->makeDoc().toBinaryData();
|
return d->makeDoc().toBinaryData();
|
||||||
|
#else
|
||||||
|
qWarning("Cannot generate binary JSON from QShaderDescription due to disabled binaryjson feature");
|
||||||
|
return QByteArray();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\return a serialized binary version of the data in CBOR (Concise Binary
|
||||||
|
Object Representation) format.
|
||||||
|
|
||||||
|
\sa QCborValue, toBinaryJson(), toJson()
|
||||||
|
*/
|
||||||
|
QByteArray QShaderDescription::toCbor() const
|
||||||
|
{
|
||||||
|
return QCborValue::fromJsonValue(d->makeDoc().object()).toCbor();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -347,7 +366,7 @@ QByteArray QShaderDescription::toBinaryJson() const
|
|||||||
|
|
||||||
\note There is no deserialization method provided for JSON text.
|
\note There is no deserialization method provided for JSON text.
|
||||||
|
|
||||||
\sa toBinaryJson()
|
\sa toBinaryJson(), toCbor()
|
||||||
*/
|
*/
|
||||||
QByteArray QShaderDescription::toJson() const
|
QByteArray QShaderDescription::toJson() const
|
||||||
{
|
{
|
||||||
@ -357,11 +376,38 @@ QByteArray QShaderDescription::toJson() const
|
|||||||
/*!
|
/*!
|
||||||
Deserializes the given binary JSON \a data and returns a new
|
Deserializes the given binary JSON \a data and returns a new
|
||||||
QShaderDescription.
|
QShaderDescription.
|
||||||
|
|
||||||
|
\sa fromCbor()
|
||||||
*/
|
*/
|
||||||
QShaderDescription QShaderDescription::fromBinaryJson(const QByteArray &data)
|
QShaderDescription QShaderDescription::fromBinaryJson(const QByteArray &data)
|
||||||
{
|
{
|
||||||
QShaderDescription desc;
|
QShaderDescription desc;
|
||||||
|
#if QT_CONFIG(binaryjson)
|
||||||
QShaderDescriptionPrivate::get(&desc)->loadDoc(QJsonDocument::fromBinaryData(data));
|
QShaderDescriptionPrivate::get(&desc)->loadDoc(QJsonDocument::fromBinaryData(data));
|
||||||
|
#else
|
||||||
|
Q_UNUSED(data);
|
||||||
|
qWarning("Cannot load QShaderDescription from binary JSON due to disabled binaryjson feature");
|
||||||
|
#endif
|
||||||
|
return desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Deserializes the given CBOR \a data and returns a new QShaderDescription.
|
||||||
|
|
||||||
|
\sa fromBinaryJson()
|
||||||
|
*/
|
||||||
|
QShaderDescription QShaderDescription::fromCbor(const QByteArray &data)
|
||||||
|
{
|
||||||
|
QShaderDescription desc;
|
||||||
|
const QCborValue cbor = QCborValue::fromCbor(data);
|
||||||
|
if (cbor.isMap()) {
|
||||||
|
const QJsonDocument doc(cbor.toMap().toJsonObject());
|
||||||
|
QShaderDescriptionPrivate::get(&desc)->loadDoc(doc);
|
||||||
|
}
|
||||||
|
if (cbor.isArray()) {
|
||||||
|
const QJsonDocument doc(cbor.toArray().toJsonArray());
|
||||||
|
QShaderDescriptionPrivate::get(&desc)->loadDoc(doc);
|
||||||
|
}
|
||||||
return desc;
|
return desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1119,4 +1165,106 @@ void QShaderDescriptionPrivate::loadDoc(const QJsonDocument &doc)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Returns \c true if the two QShaderDescription objects \a lhs and \a rhs are
|
||||||
|
equal.
|
||||||
|
|
||||||
|
\relates QShaderDescription
|
||||||
|
*/
|
||||||
|
bool operator==(const QShaderDescription &lhs, const QShaderDescription &rhs) Q_DECL_NOTHROW
|
||||||
|
{
|
||||||
|
if (lhs.d == rhs.d)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return lhs.d->inVars == rhs.d->inVars
|
||||||
|
&& lhs.d->outVars == rhs.d->outVars
|
||||||
|
&& lhs.d->uniformBlocks == rhs.d->uniformBlocks
|
||||||
|
&& lhs.d->pushConstantBlocks == rhs.d->pushConstantBlocks
|
||||||
|
&& lhs.d->storageBlocks == rhs.d->storageBlocks
|
||||||
|
&& lhs.d->combinedImageSamplers == rhs.d->combinedImageSamplers
|
||||||
|
&& lhs.d->storageImages == rhs.d->storageImages
|
||||||
|
&& lhs.d->localSize == rhs.d->localSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Returns \c true if the two InOutVariable objects \a lhs and \a rhs are
|
||||||
|
equal.
|
||||||
|
|
||||||
|
\relates QShaderDescription::InOutVariable
|
||||||
|
*/
|
||||||
|
bool operator==(const QShaderDescription::InOutVariable &lhs, const QShaderDescription::InOutVariable &rhs) Q_DECL_NOTHROW
|
||||||
|
{
|
||||||
|
return lhs.name == rhs.name
|
||||||
|
&& lhs.type == rhs.type
|
||||||
|
&& lhs.location == rhs.location
|
||||||
|
&& lhs.binding == rhs.binding
|
||||||
|
&& lhs.descriptorSet == rhs.descriptorSet
|
||||||
|
&& lhs.imageFormat == rhs.imageFormat
|
||||||
|
&& lhs.imageFlags == rhs.imageFlags;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Returns \c true if the two BlockVariable objects \a lhs and \a rhs are
|
||||||
|
equal.
|
||||||
|
|
||||||
|
\relates QShaderDescription::BlockVariable
|
||||||
|
*/
|
||||||
|
bool operator==(const QShaderDescription::BlockVariable &lhs, const QShaderDescription::BlockVariable &rhs) Q_DECL_NOTHROW
|
||||||
|
{
|
||||||
|
return lhs.name == rhs.name
|
||||||
|
&& lhs.type == rhs.type
|
||||||
|
&& lhs.offset == rhs.offset
|
||||||
|
&& lhs.size == rhs.size
|
||||||
|
&& lhs.arrayDims == rhs.arrayDims
|
||||||
|
&& lhs.arrayStride == rhs.arrayStride
|
||||||
|
&& lhs.matrixStride == rhs.matrixStride
|
||||||
|
&& lhs.matrixIsRowMajor == rhs.matrixIsRowMajor
|
||||||
|
&& lhs.structMembers == rhs.structMembers;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Returns \c true if the two UniformBlock objects \a lhs and \a rhs are
|
||||||
|
equal.
|
||||||
|
|
||||||
|
\relates QShaderDescription::UniformBlock
|
||||||
|
*/
|
||||||
|
bool operator==(const QShaderDescription::UniformBlock &lhs, const QShaderDescription::UniformBlock &rhs) Q_DECL_NOTHROW
|
||||||
|
{
|
||||||
|
return lhs.blockName == rhs.blockName
|
||||||
|
&& lhs.structName == rhs.structName
|
||||||
|
&& lhs.size == rhs.size
|
||||||
|
&& lhs.binding == rhs.binding
|
||||||
|
&& lhs.descriptorSet == rhs.descriptorSet
|
||||||
|
&& lhs.members == rhs.members;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Returns \c true if the two PushConstantBlock objects \a lhs and \a rhs are
|
||||||
|
equal.
|
||||||
|
|
||||||
|
\relates QShaderDescription::PushConstantBlock
|
||||||
|
*/
|
||||||
|
bool operator==(const QShaderDescription::PushConstantBlock &lhs, const QShaderDescription::PushConstantBlock &rhs) Q_DECL_NOTHROW
|
||||||
|
{
|
||||||
|
return lhs.name == rhs.name
|
||||||
|
&& lhs.size == rhs.size
|
||||||
|
&& lhs.members == rhs.members;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Returns \c true if the two StorageBlock objects \a lhs and \a rhs are
|
||||||
|
equal.
|
||||||
|
|
||||||
|
\relates QShaderDescription::StorageBlock
|
||||||
|
*/
|
||||||
|
bool operator==(const QShaderDescription::StorageBlock &lhs, const QShaderDescription::StorageBlock &rhs) Q_DECL_NOTHROW
|
||||||
|
{
|
||||||
|
return lhs.blockName == rhs.blockName
|
||||||
|
&& lhs.instanceName == rhs.instanceName
|
||||||
|
&& lhs.knownSize == rhs.knownSize
|
||||||
|
&& lhs.binding == rhs.binding
|
||||||
|
&& lhs.descriptorSet == rhs.descriptorSet
|
||||||
|
&& lhs.members == rhs.members;
|
||||||
|
}
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
@ -69,9 +69,11 @@ public:
|
|||||||
bool isValid() const;
|
bool isValid() const;
|
||||||
|
|
||||||
QByteArray toBinaryJson() const;
|
QByteArray toBinaryJson() const;
|
||||||
|
QByteArray toCbor() const;
|
||||||
QByteArray toJson() const;
|
QByteArray toJson() const;
|
||||||
|
|
||||||
static QShaderDescription fromBinaryJson(const QByteArray &data);
|
static QShaderDescription fromBinaryJson(const QByteArray &data);
|
||||||
|
static QShaderDescription fromCbor(const QByteArray &data);
|
||||||
|
|
||||||
enum VariableType {
|
enum VariableType {
|
||||||
Unknown = 0,
|
Unknown = 0,
|
||||||
@ -263,6 +265,7 @@ private:
|
|||||||
#ifndef QT_NO_DEBUG_STREAM
|
#ifndef QT_NO_DEBUG_STREAM
|
||||||
friend Q_GUI_EXPORT QDebug operator<<(QDebug, const QShaderDescription &);
|
friend Q_GUI_EXPORT QDebug operator<<(QDebug, const QShaderDescription &);
|
||||||
#endif
|
#endif
|
||||||
|
friend Q_GUI_EXPORT bool operator==(const QShaderDescription &lhs, const QShaderDescription &rhs) Q_DECL_NOTHROW;
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_OPERATORS_FOR_FLAGS(QShaderDescription::ImageFlags)
|
Q_DECLARE_OPERATORS_FOR_FLAGS(QShaderDescription::ImageFlags)
|
||||||
@ -276,6 +279,43 @@ Q_GUI_EXPORT QDebug operator<<(QDebug, const QShaderDescription::PushConstantBlo
|
|||||||
Q_GUI_EXPORT QDebug operator<<(QDebug, const QShaderDescription::StorageBlock &);
|
Q_GUI_EXPORT QDebug operator<<(QDebug, const QShaderDescription::StorageBlock &);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Q_GUI_EXPORT bool operator==(const QShaderDescription &lhs, const QShaderDescription &rhs) Q_DECL_NOTHROW;
|
||||||
|
Q_GUI_EXPORT bool operator==(const QShaderDescription::InOutVariable &lhs, const QShaderDescription::InOutVariable &rhs) Q_DECL_NOTHROW;
|
||||||
|
Q_GUI_EXPORT bool operator==(const QShaderDescription::BlockVariable &lhs, const QShaderDescription::BlockVariable &rhs) Q_DECL_NOTHROW;
|
||||||
|
Q_GUI_EXPORT bool operator==(const QShaderDescription::UniformBlock &lhs, const QShaderDescription::UniformBlock &rhs) Q_DECL_NOTHROW;
|
||||||
|
Q_GUI_EXPORT bool operator==(const QShaderDescription::PushConstantBlock &lhs, const QShaderDescription::PushConstantBlock &rhs) Q_DECL_NOTHROW;
|
||||||
|
Q_GUI_EXPORT bool operator==(const QShaderDescription::StorageBlock &lhs, const QShaderDescription::StorageBlock &rhs) Q_DECL_NOTHROW;
|
||||||
|
|
||||||
|
inline bool operator!=(const QShaderDescription &lhs, const QShaderDescription &rhs) Q_DECL_NOTHROW
|
||||||
|
{
|
||||||
|
return !(lhs == rhs);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool operator!=(const QShaderDescription::InOutVariable &lhs, const QShaderDescription::InOutVariable &rhs) Q_DECL_NOTHROW
|
||||||
|
{
|
||||||
|
return !(lhs == rhs);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool operator!=(const QShaderDescription::BlockVariable &lhs, const QShaderDescription::BlockVariable &rhs) Q_DECL_NOTHROW
|
||||||
|
{
|
||||||
|
return !(lhs == rhs);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool operator!=(const QShaderDescription::UniformBlock &lhs, const QShaderDescription::UniformBlock &rhs) Q_DECL_NOTHROW
|
||||||
|
{
|
||||||
|
return !(lhs == rhs);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool operator!=(const QShaderDescription::PushConstantBlock &lhs, const QShaderDescription::PushConstantBlock &rhs) Q_DECL_NOTHROW
|
||||||
|
{
|
||||||
|
return !(lhs == rhs);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool operator!=(const QShaderDescription::StorageBlock &lhs, const QShaderDescription::StorageBlock &rhs) Q_DECL_NOTHROW
|
||||||
|
{
|
||||||
|
return !(lhs == rhs);
|
||||||
|
}
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -461,6 +461,7 @@ QNetworkReplyHttpImplPrivate::QNetworkReplyHttpImplPrivate()
|
|||||||
, preMigrationDownloaded(-1)
|
, preMigrationDownloaded(-1)
|
||||||
, bytesDownloaded(0)
|
, bytesDownloaded(0)
|
||||||
, bytesBuffered(0)
|
, bytesBuffered(0)
|
||||||
|
, transferTimeout(nullptr)
|
||||||
, downloadBufferReadPosition(0)
|
, downloadBufferReadPosition(0)
|
||||||
, downloadBufferCurrentSize(0)
|
, downloadBufferCurrentSize(0)
|
||||||
, downloadZerocopyBuffer(nullptr)
|
, downloadZerocopyBuffer(nullptr)
|
||||||
@ -1064,6 +1065,7 @@ void QNetworkReplyHttpImplPrivate::replyDownloadData(QByteArray d)
|
|||||||
if (!isHttpRedirectResponse()) {
|
if (!isHttpRedirectResponse()) {
|
||||||
buffer.append(d);
|
buffer.append(d);
|
||||||
bytesDownloaded += d.size();
|
bytesDownloaded += d.size();
|
||||||
|
setupTransferTimeout();
|
||||||
}
|
}
|
||||||
bytesBuffered += d.size();
|
bytesBuffered += d.size();
|
||||||
|
|
||||||
@ -1389,6 +1391,7 @@ void QNetworkReplyHttpImplPrivate::replyDownloadProgressSlot(qint64 bytesReceive
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
bytesDownloaded = bytesReceived;
|
bytesDownloaded = bytesReceived;
|
||||||
|
setupTransferTimeout();
|
||||||
|
|
||||||
downloadBufferCurrentSize = bytesReceived;
|
downloadBufferCurrentSize = bytesReceived;
|
||||||
|
|
||||||
@ -1845,7 +1848,6 @@ bool QNetworkReplyHttpImplPrivate::startWaitForSession(QSharedPointer<QNetworkSe
|
|||||||
void QNetworkReplyHttpImplPrivate::_q_startOperation()
|
void QNetworkReplyHttpImplPrivate::_q_startOperation()
|
||||||
{
|
{
|
||||||
Q_Q(QNetworkReplyHttpImpl);
|
Q_Q(QNetworkReplyHttpImpl);
|
||||||
|
|
||||||
if (state == Working) // ensure this function is only being called once
|
if (state == Working) // ensure this function is only being called once
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1885,6 +1887,7 @@ void QNetworkReplyHttpImplPrivate::_q_startOperation()
|
|||||||
}
|
}
|
||||||
#endif // QT_NO_BEARERMANAGEMENT
|
#endif // QT_NO_BEARERMANAGEMENT
|
||||||
|
|
||||||
|
setupTransferTimeout();
|
||||||
if (synchronous) {
|
if (synchronous) {
|
||||||
state = Finished;
|
state = Finished;
|
||||||
q_func()->setFinished(true);
|
q_func()->setFinished(true);
|
||||||
@ -2021,6 +2024,31 @@ void QNetworkReplyHttpImplPrivate::_q_bufferOutgoingData()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QNetworkReplyHttpImplPrivate::_q_transferTimedOut()
|
||||||
|
{
|
||||||
|
Q_Q(QNetworkReplyHttpImpl);
|
||||||
|
q->abort();
|
||||||
|
}
|
||||||
|
|
||||||
|
void QNetworkReplyHttpImplPrivate::setupTransferTimeout()
|
||||||
|
{
|
||||||
|
Q_Q(QNetworkReplyHttpImpl);
|
||||||
|
if (!transferTimeout) {
|
||||||
|
transferTimeout = new QTimer(q);
|
||||||
|
QObject::connect(transferTimeout, SIGNAL(timeout()),
|
||||||
|
q, SLOT(_q_transferTimedOut()),
|
||||||
|
Qt::QueuedConnection);
|
||||||
|
}
|
||||||
|
transferTimeout->stop();
|
||||||
|
if (request.transferTimeout()) {
|
||||||
|
transferTimeout->setSingleShot(true);
|
||||||
|
transferTimeout->setInterval(request.transferTimeout());
|
||||||
|
QMetaObject::invokeMethod(transferTimeout, "start",
|
||||||
|
Qt::QueuedConnection);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef QT_NO_BEARERMANAGEMENT
|
#ifndef QT_NO_BEARERMANAGEMENT
|
||||||
void QNetworkReplyHttpImplPrivate::_q_networkSessionConnected()
|
void QNetworkReplyHttpImplPrivate::_q_networkSessionConnected()
|
||||||
{
|
{
|
||||||
@ -2103,6 +2131,8 @@ void QNetworkReplyHttpImplPrivate::emitReplyUploadProgress(qint64 bytesSent, qin
|
|||||||
if (isFinished)
|
if (isFinished)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
setupTransferTimeout();
|
||||||
|
|
||||||
if (!emitAllUploadProgressSignals) {
|
if (!emitAllUploadProgressSignals) {
|
||||||
//choke signal emissions, except the first and last signals which are unconditional
|
//choke signal emissions, except the first and last signals which are unconditional
|
||||||
if (uploadProgressSignalChoke.isValid()) {
|
if (uploadProgressSignalChoke.isValid()) {
|
||||||
@ -2114,7 +2144,6 @@ void QNetworkReplyHttpImplPrivate::emitReplyUploadProgress(qint64 bytesSent, qin
|
|||||||
uploadProgressSignalChoke.start();
|
uploadProgressSignalChoke.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
emit q->uploadProgress(bytesSent, bytesTotal);
|
emit q->uploadProgress(bytesSent, bytesTotal);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2147,7 +2176,8 @@ void QNetworkReplyHttpImplPrivate::_q_finished()
|
|||||||
void QNetworkReplyHttpImplPrivate::finished()
|
void QNetworkReplyHttpImplPrivate::finished()
|
||||||
{
|
{
|
||||||
Q_Q(QNetworkReplyHttpImpl);
|
Q_Q(QNetworkReplyHttpImpl);
|
||||||
|
if (transferTimeout)
|
||||||
|
transferTimeout->stop();
|
||||||
if (state == Finished || state == Aborted || state == WaitingForSession)
|
if (state == Finished || state == Aborted || state == WaitingForSession)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -59,6 +59,7 @@
|
|||||||
#include "QtCore/qdatetime.h"
|
#include "QtCore/qdatetime.h"
|
||||||
#include "QtCore/qsharedpointer.h"
|
#include "QtCore/qsharedpointer.h"
|
||||||
#include "QtCore/qscopedpointer.h"
|
#include "QtCore/qscopedpointer.h"
|
||||||
|
#include "QtCore/qtimer.h"
|
||||||
#include "qatomic.h"
|
#include "qatomic.h"
|
||||||
|
|
||||||
#include <QtNetwork/QNetworkCacheMetaData>
|
#include <QtNetwork/QNetworkCacheMetaData>
|
||||||
@ -100,6 +101,7 @@ public:
|
|||||||
Q_PRIVATE_SLOT(d_func(), void _q_cacheLoadReadyRead())
|
Q_PRIVATE_SLOT(d_func(), void _q_cacheLoadReadyRead())
|
||||||
Q_PRIVATE_SLOT(d_func(), void _q_bufferOutgoingData())
|
Q_PRIVATE_SLOT(d_func(), void _q_bufferOutgoingData())
|
||||||
Q_PRIVATE_SLOT(d_func(), void _q_bufferOutgoingDataFinished())
|
Q_PRIVATE_SLOT(d_func(), void _q_bufferOutgoingDataFinished())
|
||||||
|
Q_PRIVATE_SLOT(d_func(), void _q_transferTimedOut())
|
||||||
#ifndef QT_NO_BEARERMANAGEMENT
|
#ifndef QT_NO_BEARERMANAGEMENT
|
||||||
Q_PRIVATE_SLOT(d_func(), void _q_networkSessionConnected())
|
Q_PRIVATE_SLOT(d_func(), void _q_networkSessionConnected())
|
||||||
Q_PRIVATE_SLOT(d_func(), void _q_networkSessionFailed())
|
Q_PRIVATE_SLOT(d_func(), void _q_networkSessionFailed())
|
||||||
@ -181,6 +183,9 @@ public:
|
|||||||
|
|
||||||
void _q_cacheSaveDeviceAboutToClose();
|
void _q_cacheSaveDeviceAboutToClose();
|
||||||
|
|
||||||
|
void _q_transferTimedOut();
|
||||||
|
void setupTransferTimeout();
|
||||||
|
|
||||||
#ifndef QT_NO_BEARERMANAGEMENT
|
#ifndef QT_NO_BEARERMANAGEMENT
|
||||||
void _q_networkSessionConnected();
|
void _q_networkSessionConnected();
|
||||||
void _q_networkSessionFailed();
|
void _q_networkSessionFailed();
|
||||||
@ -250,6 +255,8 @@ public:
|
|||||||
qint64 bytesDownloaded;
|
qint64 bytesDownloaded;
|
||||||
qint64 bytesBuffered;
|
qint64 bytesBuffered;
|
||||||
|
|
||||||
|
QTimer *transferTimeout;
|
||||||
|
|
||||||
// Only used when the "zero copy" style is used.
|
// Only used when the "zero copy" style is used.
|
||||||
// Please note that the whole "zero copy" download buffer API is private right now. Do not use it.
|
// Please note that the whole "zero copy" download buffer API is private right now. Do not use it.
|
||||||
qint64 downloadBufferReadPosition;
|
qint64 downloadBufferReadPosition;
|
||||||
|
@ -407,6 +407,18 @@ QT_BEGIN_NAMESPACE
|
|||||||
based on some app-specific configuration.
|
based on some app-specific configuration.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\enum QNetworkRequest::TransferTimeoutConstant
|
||||||
|
\since 5.15
|
||||||
|
|
||||||
|
A constant that can be used for enabling transfer
|
||||||
|
timeouts with a preset value.
|
||||||
|
|
||||||
|
\value TransferTimeoutPreset The transfer timeout in milliseconds.
|
||||||
|
Used if setTimeout() is called
|
||||||
|
without an argument.
|
||||||
|
*/
|
||||||
|
|
||||||
class QNetworkRequestPrivate: public QSharedData, public QNetworkHeadersPrivate
|
class QNetworkRequestPrivate: public QSharedData, public QNetworkHeadersPrivate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -417,6 +429,7 @@ public:
|
|||||||
, sslConfiguration(0)
|
, sslConfiguration(0)
|
||||||
#endif
|
#endif
|
||||||
, maxRedirectsAllowed(maxRedirectCount)
|
, maxRedirectsAllowed(maxRedirectCount)
|
||||||
|
, transferTimeout(0)
|
||||||
{ qRegisterMetaType<QNetworkRequest>(); }
|
{ qRegisterMetaType<QNetworkRequest>(); }
|
||||||
~QNetworkRequestPrivate()
|
~QNetworkRequestPrivate()
|
||||||
{
|
{
|
||||||
@ -441,6 +454,7 @@ public:
|
|||||||
#if QT_CONFIG(http)
|
#if QT_CONFIG(http)
|
||||||
h2Configuration = other.h2Configuration;
|
h2Configuration = other.h2Configuration;
|
||||||
#endif
|
#endif
|
||||||
|
transferTimeout = other.transferTimeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool operator==(const QNetworkRequestPrivate &other) const
|
inline bool operator==(const QNetworkRequestPrivate &other) const
|
||||||
@ -454,6 +468,7 @@ public:
|
|||||||
#if QT_CONFIG(http)
|
#if QT_CONFIG(http)
|
||||||
&& h2Configuration == other.h2Configuration
|
&& h2Configuration == other.h2Configuration
|
||||||
#endif
|
#endif
|
||||||
|
&& transferTimeout == other.transferTimeout
|
||||||
;
|
;
|
||||||
// don't compare cookedHeaders
|
// don't compare cookedHeaders
|
||||||
}
|
}
|
||||||
@ -468,6 +483,7 @@ public:
|
|||||||
#if QT_CONFIG(http)
|
#if QT_CONFIG(http)
|
||||||
QHttp2Configuration h2Configuration;
|
QHttp2Configuration h2Configuration;
|
||||||
#endif
|
#endif
|
||||||
|
int transferTimeout;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -891,6 +907,40 @@ void QNetworkRequest::setHttp2Configuration(const QHttp2Configuration &configura
|
|||||||
{
|
{
|
||||||
d->h2Configuration = configuration;
|
d->h2Configuration = configuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\since 5.15
|
||||||
|
|
||||||
|
Returns the timeout used for transfers, in milliseconds.
|
||||||
|
|
||||||
|
This timeout is zero if setTransferTimeout hasn't been
|
||||||
|
called, which means that the timeout is not used.
|
||||||
|
|
||||||
|
\sa setTransferTimeout
|
||||||
|
*/
|
||||||
|
int QNetworkRequest::transferTimeout()
|
||||||
|
{
|
||||||
|
return d->transferTimeout;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\since 5.15
|
||||||
|
|
||||||
|
Sets \a timeout as the transfer timeout in milliseconds.
|
||||||
|
|
||||||
|
Transfers are aborted if no bytes are transferred before
|
||||||
|
the timeout expires. Zero means no timer is set. If no
|
||||||
|
argument is provided, the timeout is
|
||||||
|
QNetworkRequest::TransferTimeoutPreset. If this function
|
||||||
|
is not called, the timeout is disabled and has the
|
||||||
|
value zero.
|
||||||
|
|
||||||
|
\sa transferTimeout
|
||||||
|
*/
|
||||||
|
void QNetworkRequest::setTransferTimeout(int timeout)
|
||||||
|
{
|
||||||
|
d->transferTimeout = timeout;
|
||||||
|
}
|
||||||
#endif // QT_CONFIG(http) || defined(Q_CLANG_QDOC)
|
#endif // QT_CONFIG(http) || defined(Q_CLANG_QDOC)
|
||||||
|
|
||||||
static QByteArray headerName(QNetworkRequest::KnownHeaders header)
|
static QByteArray headerName(QNetworkRequest::KnownHeaders header)
|
||||||
|
@ -126,6 +126,9 @@ public:
|
|||||||
UserVerifiedRedirectPolicy
|
UserVerifiedRedirectPolicy
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum TransferTimeoutConstant {
|
||||||
|
TransferTimeoutPreset = 30000
|
||||||
|
};
|
||||||
|
|
||||||
QNetworkRequest();
|
QNetworkRequest();
|
||||||
explicit QNetworkRequest(const QUrl &url);
|
explicit QNetworkRequest(const QUrl &url);
|
||||||
@ -177,6 +180,9 @@ public:
|
|||||||
#if QT_CONFIG(http) || defined(Q_CLANG_QDOC)
|
#if QT_CONFIG(http) || defined(Q_CLANG_QDOC)
|
||||||
QHttp2Configuration http2Configuration() const;
|
QHttp2Configuration http2Configuration() const;
|
||||||
void setHttp2Configuration(const QHttp2Configuration &configuration);
|
void setHttp2Configuration(const QHttp2Configuration &configuration);
|
||||||
|
|
||||||
|
int transferTimeout();
|
||||||
|
void setTransferTimeout(int timeout = TransferTimeoutPreset);
|
||||||
#endif // QT_CONFIG(http) || defined(Q_CLANG_QDOC)
|
#endif // QT_CONFIG(http) || defined(Q_CLANG_QDOC)
|
||||||
private:
|
private:
|
||||||
QSharedDataPointer<QNetworkRequestPrivate> d;
|
QSharedDataPointer<QNetworkRequestPrivate> d;
|
||||||
|
@ -210,16 +210,14 @@ QList<QNetworkProxy> macQueryInternal(const QNetworkProxyQuery &query)
|
|||||||
QList<QNetworkProxy> result;
|
QList<QNetworkProxy> result;
|
||||||
|
|
||||||
// obtain a dictionary to the proxy settings:
|
// obtain a dictionary to the proxy settings:
|
||||||
CFDictionaryRef dict = SCDynamicStoreCopyProxies(NULL);
|
const QCFType<CFDictionaryRef> dict = SCDynamicStoreCopyProxies(NULL);
|
||||||
if (!dict) {
|
if (!dict) {
|
||||||
qWarning("QNetworkProxyFactory::systemProxyForQuery: SCDynamicStoreCopyProxies returned NULL");
|
qWarning("QNetworkProxyFactory::systemProxyForQuery: SCDynamicStoreCopyProxies returned NULL");
|
||||||
return result; // failed
|
return result; // failed
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isHostExcluded(dict, query.peerHostName())) {
|
if (isHostExcluded(dict, query.peerHostName()))
|
||||||
CFRelease(dict);
|
|
||||||
return result; // no proxy for this host
|
return result; // no proxy for this host
|
||||||
}
|
|
||||||
|
|
||||||
// is there a PAC enabled? If so, use it first.
|
// is there a PAC enabled? If so, use it first.
|
||||||
CFNumberRef pacEnabled;
|
CFNumberRef pacEnabled;
|
||||||
@ -329,7 +327,6 @@ QList<QNetworkProxy> macQueryInternal(const QNetworkProxyQuery &query)
|
|||||||
result << https;
|
result << https;
|
||||||
}
|
}
|
||||||
|
|
||||||
CFRelease(dict);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -293,12 +293,9 @@ bool QCocoaEventDispatcher::hasPendingEvents()
|
|||||||
return qGlobalPostedEventsCount() || (qt_is_gui_used && !CFRunLoopIsWaiting(CFRunLoopGetMain()));
|
return qGlobalPostedEventsCount() || (qt_is_gui_used && !CFRunLoopIsWaiting(CFRunLoopGetMain()));
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool IsMouseOrKeyEvent( NSEvent* event )
|
static bool isUserInputEvent(NSEvent* event)
|
||||||
{
|
{
|
||||||
bool result = false;
|
switch ([event type]) {
|
||||||
|
|
||||||
switch( [event type] )
|
|
||||||
{
|
|
||||||
case NSEventTypeLeftMouseDown:
|
case NSEventTypeLeftMouseDown:
|
||||||
case NSEventTypeLeftMouseUp:
|
case NSEventTypeLeftMouseUp:
|
||||||
case NSEventTypeRightMouseDown:
|
case NSEventTypeRightMouseDown:
|
||||||
@ -326,13 +323,12 @@ static bool IsMouseOrKeyEvent( NSEvent* event )
|
|||||||
case NSEventTypeBeginGesture:
|
case NSEventTypeBeginGesture:
|
||||||
case NSEventTypeEndGesture:
|
case NSEventTypeEndGesture:
|
||||||
#endif // QT_NO_GESTURES
|
#endif // QT_NO_GESTURES
|
||||||
result = true;
|
return true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return result;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void qt_mac_waitForMoreEvents(NSString *runLoopMode = NSDefaultRunLoopMode)
|
static inline void qt_mac_waitForMoreEvents(NSString *runLoopMode = NSDefaultRunLoopMode)
|
||||||
@ -465,7 +461,7 @@ bool QCocoaEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags flags)
|
|||||||
dequeue: YES];
|
dequeue: YES];
|
||||||
|
|
||||||
if (event) {
|
if (event) {
|
||||||
if (IsMouseOrKeyEvent(event)) {
|
if (isUserInputEvent(event)) {
|
||||||
[event retain];
|
[event retain];
|
||||||
d->queuedUserInputEvents.append(event);
|
d->queuedUserInputEvents.append(event);
|
||||||
continue;
|
continue;
|
||||||
@ -485,7 +481,7 @@ bool QCocoaEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags flags)
|
|||||||
|
|
||||||
if (event) {
|
if (event) {
|
||||||
if (flags & QEventLoop::ExcludeUserInputEvents) {
|
if (flags & QEventLoop::ExcludeUserInputEvents) {
|
||||||
if (IsMouseOrKeyEvent(event)) {
|
if (isUserInputEvent(event)) {
|
||||||
[event retain];
|
[event retain];
|
||||||
d->queuedUserInputEvents.append(event);
|
d->queuedUserInputEvents.append(event);
|
||||||
continue;
|
continue;
|
||||||
|
@ -99,18 +99,18 @@ private:
|
|||||||
static void add(CGDirectDisplayID displayId);
|
static void add(CGDirectDisplayID displayId);
|
||||||
void remove();
|
void remove();
|
||||||
|
|
||||||
CGDirectDisplayID m_displayId = 0;
|
CGDirectDisplayID m_displayId = kCGNullDirectDisplay;
|
||||||
|
|
||||||
QRect m_geometry;
|
QRect m_geometry;
|
||||||
QRect m_availableGeometry;
|
QRect m_availableGeometry;
|
||||||
QDpi m_logicalDpi;
|
QDpi m_logicalDpi;
|
||||||
qreal m_refreshRate;
|
qreal m_refreshRate = 0;
|
||||||
int m_depth;
|
int m_depth = 0;
|
||||||
QString m_name;
|
QString m_name;
|
||||||
QImage::Format m_format;
|
QImage::Format m_format;
|
||||||
QSizeF m_physicalSize;
|
QSizeF m_physicalSize;
|
||||||
QCocoaCursor *m_cursor;
|
QCocoaCursor *m_cursor;
|
||||||
qreal m_devicePixelRatio;
|
qreal m_devicePixelRatio = 0;
|
||||||
|
|
||||||
CVDisplayLinkRef m_displayLink = nullptr;
|
CVDisplayLinkRef m_displayLink = nullptr;
|
||||||
dispatch_source_t m_displayLinkSource = nullptr;
|
dispatch_source_t m_displayLinkSource = nullptr;
|
||||||
|
@ -54,6 +54,23 @@
|
|||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
namespace CoreGraphics {
|
||||||
|
Q_NAMESPACE
|
||||||
|
enum DisplayChange {
|
||||||
|
Moved = kCGDisplayMovedFlag,
|
||||||
|
SetMain = kCGDisplaySetMainFlag,
|
||||||
|
SetMode = kCGDisplaySetModeFlag,
|
||||||
|
Added = kCGDisplayAddFlag,
|
||||||
|
Removed = kCGDisplayRemoveFlag,
|
||||||
|
Enabled = kCGDisplayEnabledFlag,
|
||||||
|
Disabled = kCGDisplayDisabledFlag,
|
||||||
|
Mirrored = kCGDisplayMirrorFlag,
|
||||||
|
UnMirrored = kCGDisplayUnMirrorFlag,
|
||||||
|
DesktopShapeChanged = kCGDisplayDesktopShapeChangedFlag
|
||||||
|
};
|
||||||
|
Q_ENUM_NS(DisplayChange)
|
||||||
|
}
|
||||||
|
|
||||||
void QCocoaScreen::initializeScreens()
|
void QCocoaScreen::initializeScreens()
|
||||||
{
|
{
|
||||||
uint32_t displayCount = 0;
|
uint32_t displayCount = 0;
|
||||||
@ -73,6 +90,10 @@ void QCocoaScreen::initializeScreens()
|
|||||||
|
|
||||||
Q_UNUSED(userInfo);
|
Q_UNUSED(userInfo);
|
||||||
|
|
||||||
|
qCDebug(lcQpaScreen).verbosity(0).nospace() << "Display reconfiguration"
|
||||||
|
<< " (" << QFlags<CoreGraphics::DisplayChange>(flags) << ")"
|
||||||
|
<< " for displayId=" << displayId;
|
||||||
|
|
||||||
QCocoaScreen *cocoaScreen = QCocoaScreen::get(displayId);
|
QCocoaScreen *cocoaScreen = QCocoaScreen::get(displayId);
|
||||||
|
|
||||||
if ((flags & kCGDisplayAddFlag) || !cocoaScreen) {
|
if ((flags & kCGDisplayAddFlag) || !cocoaScreen) {
|
||||||
@ -93,22 +114,24 @@ void QCocoaScreen::initializeScreens()
|
|||||||
mainDisplay->updateProperties();
|
mainDisplay->updateProperties();
|
||||||
qCInfo(lcQpaScreen) << "Primary screen changed to" << mainDisplay;
|
qCInfo(lcQpaScreen) << "Primary screen changed to" << mainDisplay;
|
||||||
QWindowSystemInterface::handlePrimaryScreenChanged(mainDisplay);
|
QWindowSystemInterface::handlePrimaryScreenChanged(mainDisplay);
|
||||||
}
|
|
||||||
|
|
||||||
if (cocoaScreen == mainDisplay)
|
if (cocoaScreen == mainDisplay)
|
||||||
return; // Already reconfigured
|
return; // Already reconfigured
|
||||||
|
}
|
||||||
|
|
||||||
cocoaScreen->updateProperties();
|
cocoaScreen->updateProperties();
|
||||||
qCInfo(lcQpaScreen) << "Reconfigured" << cocoaScreen;
|
qCInfo(lcQpaScreen).nospace() << "Reconfigured " <<
|
||||||
|
(primaryScreen() == cocoaScreen ? "primary " : "")
|
||||||
|
<< cocoaScreen;
|
||||||
}
|
}
|
||||||
}, nullptr);
|
}, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QCocoaScreen::add(CGDirectDisplayID displayId)
|
void QCocoaScreen::add(CGDirectDisplayID displayId)
|
||||||
{
|
{
|
||||||
|
const bool isPrimary = CGDisplayIsMain(displayId);
|
||||||
QCocoaScreen *cocoaScreen = new QCocoaScreen(displayId);
|
QCocoaScreen *cocoaScreen = new QCocoaScreen(displayId);
|
||||||
qCInfo(lcQpaScreen) << "Adding" << cocoaScreen;
|
qCInfo(lcQpaScreen).nospace() << "Adding " << (isPrimary ? "new primary " : "") << cocoaScreen;
|
||||||
QWindowSystemInterface::handleScreenAdded(cocoaScreen, CGDisplayIsMain(displayId));
|
QWindowSystemInterface::handleScreenAdded(cocoaScreen, isPrimary);
|
||||||
}
|
}
|
||||||
|
|
||||||
QCocoaScreen::QCocoaScreen(CGDirectDisplayID displayId)
|
QCocoaScreen::QCocoaScreen(CGDirectDisplayID displayId)
|
||||||
@ -127,7 +150,7 @@ void QCocoaScreen::cleanupScreens()
|
|||||||
|
|
||||||
void QCocoaScreen::remove()
|
void QCocoaScreen::remove()
|
||||||
{
|
{
|
||||||
m_displayId = 0; // Prevent stale references during removal
|
m_displayId = kCGNullDirectDisplay; // Prevent stale references during removal
|
||||||
|
|
||||||
// This may result in the application responding to QGuiApplication::screenRemoved
|
// This may result in the application responding to QGuiApplication::screenRemoved
|
||||||
// by moving the window to another screen, either by setGeometry, or by setScreen.
|
// by moving the window to another screen, either by setGeometry, or by setScreen.
|
||||||
@ -140,6 +163,7 @@ void QCocoaScreen::remove()
|
|||||||
// QCocoaWindow::windowDidChangeScreen. At that point the window will appear to have
|
// QCocoaWindow::windowDidChangeScreen. At that point the window will appear to have
|
||||||
// already changed its screen, but that's only true if comparing the Qt screens,
|
// already changed its screen, but that's only true if comparing the Qt screens,
|
||||||
// not when comparing the NSScreens.
|
// not when comparing the NSScreens.
|
||||||
|
qCInfo(lcQpaScreen).nospace() << "Removing " << (primaryScreen() == this ? "current primary " : "") << this;
|
||||||
QWindowSystemInterface::handleScreenRemoved(this);
|
QWindowSystemInterface::handleScreenRemoved(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -552,10 +576,10 @@ QPixmap QCocoaScreen::grabWindow(WId view, int x, int y, int width, int height)
|
|||||||
*/
|
*/
|
||||||
QCocoaScreen *QCocoaScreen::primaryScreen()
|
QCocoaScreen *QCocoaScreen::primaryScreen()
|
||||||
{
|
{
|
||||||
auto screen = static_cast<QCocoaScreen *>(QGuiApplication::primaryScreen()->handle());
|
// Note: The primary screen that Qt knows about may not match the current CGMainDisplayID()
|
||||||
Q_ASSERT_X(screen == get(CGMainDisplayID()), "QCocoaScreen",
|
// if macOS has not yet been able to inform us that the main display has changed, but we
|
||||||
"The application's primary screen should always be in sync with the main display");
|
// will update the primary screen accordingly once the reconfiguration callback comes in.
|
||||||
return screen;
|
return static_cast<QCocoaScreen *>(QGuiApplication::primaryScreen()->handle());
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QPlatformScreen*> QCocoaScreen::virtualSiblings() const
|
QList<QPlatformScreen*> QCocoaScreen::virtualSiblings() const
|
||||||
@ -597,7 +621,7 @@ NSScreen *QCocoaScreen::nativeScreen() const
|
|||||||
QCFType<CFUUIDRef> uuid = CGDisplayCreateUUIDFromDisplayID(m_displayId);
|
QCFType<CFUUIDRef> uuid = CGDisplayCreateUUIDFromDisplayID(m_displayId);
|
||||||
|
|
||||||
for (NSScreen *screen in [NSScreen screens]) {
|
for (NSScreen *screen in [NSScreen screens]) {
|
||||||
if (CGDisplayCreateUUIDFromDisplayID(screen.qt_displayId) == uuid)
|
if (QCFType<CFUUIDRef>(CGDisplayCreateUUIDFromDisplayID(screen.qt_displayId)) == uuid)
|
||||||
return screen;
|
return screen;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -639,6 +663,7 @@ QDebug operator<<(QDebug debug, const QCocoaScreen *screen)
|
|||||||
debug << ", geometry=" << screen->geometry();
|
debug << ", geometry=" << screen->geometry();
|
||||||
debug << ", dpr=" << screen->devicePixelRatio();
|
debug << ", dpr=" << screen->devicePixelRatio();
|
||||||
debug << ", name=" << screen->name();
|
debug << ", name=" << screen->name();
|
||||||
|
debug << ", displayId=" << screen->m_displayId;
|
||||||
debug << ", native=" << screen->nativeScreen();
|
debug << ", native=" << screen->nativeScreen();
|
||||||
}
|
}
|
||||||
debug << ')';
|
debug << ')';
|
||||||
@ -646,6 +671,8 @@ QDebug operator<<(QDebug debug, const QCocoaScreen *screen)
|
|||||||
}
|
}
|
||||||
#endif // !QT_NO_DEBUG_STREAM
|
#endif // !QT_NO_DEBUG_STREAM
|
||||||
|
|
||||||
|
#include "qcocoascreen.moc"
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
@implementation NSScreen (QtExtras)
|
@implementation NSScreen (QtExtras)
|
||||||
|
15
tests/auto/gui/rhi/qshader/data/README
Normal file
15
tests/auto/gui/rhi/qshader/data/README
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
Warning: Do NOT regenerate the .qsb files without proper planning and understanding
|
||||||
|
the following.
|
||||||
|
|
||||||
|
Among other things, we are also testing backwards compatibility for QShader
|
||||||
|
deserialization.
|
||||||
|
|
||||||
|
.qsb files with _v1 in the name were produced with an older qtshadertools
|
||||||
|
and have a QSB_VERSION of 1.
|
||||||
|
|
||||||
|
Files with _v2 are generated with a newer qsb, those have QSB_VERSION 2.
|
||||||
|
The difference is the support for nativeResourceBindingMap() which is only
|
||||||
|
present in v2.
|
||||||
|
|
||||||
|
Files with _v3 come from an even newer qsb, and have QSB_VERSION 3. The
|
||||||
|
difference to 2 is the use of CBOR instead of binary JSON for QShaderDescription.
|
16
tests/auto/gui/rhi/qshader/data/texture.frag
Normal file
16
tests/auto/gui/rhi/qshader/data/texture.frag
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#version 440
|
||||||
|
|
||||||
|
layout(location = 0) in vec2 qt_TexCoord;
|
||||||
|
layout(location = 0) out vec4 fragColor;
|
||||||
|
|
||||||
|
layout(std140, binding = 0) uniform buf {
|
||||||
|
mat4 qt_Matrix;
|
||||||
|
float opacity;
|
||||||
|
} ubuf;
|
||||||
|
|
||||||
|
layout(binding = 1) uniform sampler2D qt_Texture;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
fragColor = texture(qt_Texture, qt_TexCoord) * ubuf.opacity;
|
||||||
|
}
|
BIN
tests/auto/gui/rhi/qshader/data/texture_all_v2.frag.qsb
Normal file
BIN
tests/auto/gui/rhi/qshader/data/texture_all_v2.frag.qsb
Normal file
Binary file not shown.
BIN
tests/auto/gui/rhi/qshader/data/texture_all_v3.frag.qsb
Normal file
BIN
tests/auto/gui/rhi/qshader/data/texture_all_v3.frag.qsb
Normal file
Binary file not shown.
@ -40,6 +40,9 @@ private slots:
|
|||||||
void genVariants();
|
void genVariants();
|
||||||
void shaderDescImplicitSharing();
|
void shaderDescImplicitSharing();
|
||||||
void bakedShaderImplicitSharing();
|
void bakedShaderImplicitSharing();
|
||||||
|
void mslResourceMapping();
|
||||||
|
void loadV3();
|
||||||
|
void serializeShaderDesc();
|
||||||
};
|
};
|
||||||
|
|
||||||
static QShader getShader(const QString &name)
|
static QShader getShader(const QString &name)
|
||||||
@ -53,8 +56,9 @@ static QShader getShader(const QString &name)
|
|||||||
|
|
||||||
void tst_QShader::simpleCompileCheckResults()
|
void tst_QShader::simpleCompileCheckResults()
|
||||||
{
|
{
|
||||||
QShader s = getShader(QLatin1String(":/data/color_simple.vert.qsb"));
|
QShader s = getShader(QLatin1String(":/data/color_spirv_v1.vert.qsb"));
|
||||||
QVERIFY(s.isValid());
|
QVERIFY(s.isValid());
|
||||||
|
QCOMPARE(QShaderPrivate::get(&s)->qsbVersion, 1);
|
||||||
QCOMPARE(s.availableShaders().count(), 1);
|
QCOMPARE(s.availableShaders().count(), 1);
|
||||||
|
|
||||||
const QShaderCode shader = s.shader(QShaderKey(QShader::SpirvShader,
|
const QShaderCode shader = s.shader(QShaderKey(QShader::SpirvShader,
|
||||||
@ -125,10 +129,11 @@ void tst_QShader::simpleCompileCheckResults()
|
|||||||
|
|
||||||
void tst_QShader::genVariants()
|
void tst_QShader::genVariants()
|
||||||
{
|
{
|
||||||
QShader s = getShader(QLatin1String(":/data/color.vert.qsb"));
|
QShader s = getShader(QLatin1String(":/data/color_all_v1.vert.qsb"));
|
||||||
// spirv, glsl 100, glsl 330, glsl 120, hlsl 50, msl 12
|
// spirv, glsl 100, glsl 330, glsl 120, hlsl 50, msl 12
|
||||||
// + batchable variants
|
// + batchable variants
|
||||||
QVERIFY(s.isValid());
|
QVERIFY(s.isValid());
|
||||||
|
QCOMPARE(QShaderPrivate::get(&s)->qsbVersion, 1);
|
||||||
QCOMPARE(s.availableShaders().count(), 2 * 6);
|
QCOMPARE(s.availableShaders().count(), 2 * 6);
|
||||||
|
|
||||||
int batchableVariantCount = 0;
|
int batchableVariantCount = 0;
|
||||||
@ -149,8 +154,9 @@ void tst_QShader::genVariants()
|
|||||||
|
|
||||||
void tst_QShader::shaderDescImplicitSharing()
|
void tst_QShader::shaderDescImplicitSharing()
|
||||||
{
|
{
|
||||||
QShader s = getShader(QLatin1String(":/data/color_simple.vert.qsb"));
|
QShader s = getShader(QLatin1String(":/data/color_spirv_v1.vert.qsb"));
|
||||||
QVERIFY(s.isValid());
|
QVERIFY(s.isValid());
|
||||||
|
QCOMPARE(QShaderPrivate::get(&s)->qsbVersion, 1);
|
||||||
QCOMPARE(s.availableShaders().count(), 1);
|
QCOMPARE(s.availableShaders().count(), 1);
|
||||||
QVERIFY(s.availableShaders().contains(QShaderKey(QShader::SpirvShader, QShaderVersion(100))));
|
QVERIFY(s.availableShaders().contains(QShaderKey(QShader::SpirvShader, QShaderVersion(100))));
|
||||||
|
|
||||||
@ -168,6 +174,7 @@ void tst_QShader::shaderDescImplicitSharing()
|
|||||||
QCOMPARE(d1.inputVariables().count(), 2);
|
QCOMPARE(d1.inputVariables().count(), 2);
|
||||||
QCOMPARE(d1.outputVariables().count(), 1);
|
QCOMPARE(d1.outputVariables().count(), 1);
|
||||||
QCOMPARE(d1.uniformBlocks().count(), 1);
|
QCOMPARE(d1.uniformBlocks().count(), 1);
|
||||||
|
QCOMPARE(d0, d1);
|
||||||
|
|
||||||
d1.detach();
|
d1.detach();
|
||||||
QVERIFY(QShaderDescriptionPrivate::get(&d0) != QShaderDescriptionPrivate::get(&d1));
|
QVERIFY(QShaderDescriptionPrivate::get(&d0) != QShaderDescriptionPrivate::get(&d1));
|
||||||
@ -177,12 +184,17 @@ void tst_QShader::shaderDescImplicitSharing()
|
|||||||
QCOMPARE(d1.inputVariables().count(), 2);
|
QCOMPARE(d1.inputVariables().count(), 2);
|
||||||
QCOMPARE(d1.outputVariables().count(), 1);
|
QCOMPARE(d1.outputVariables().count(), 1);
|
||||||
QCOMPARE(d1.uniformBlocks().count(), 1);
|
QCOMPARE(d1.uniformBlocks().count(), 1);
|
||||||
|
QCOMPARE(d0, d1);
|
||||||
|
|
||||||
|
d1 = QShaderDescription();
|
||||||
|
QVERIFY(d0 != d1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_QShader::bakedShaderImplicitSharing()
|
void tst_QShader::bakedShaderImplicitSharing()
|
||||||
{
|
{
|
||||||
QShader s0 = getShader(QLatin1String(":/data/color_simple.vert.qsb"));
|
QShader s0 = getShader(QLatin1String(":/data/color_spirv_v1.vert.qsb"));
|
||||||
QVERIFY(s0.isValid());
|
QVERIFY(s0.isValid());
|
||||||
|
QCOMPARE(QShaderPrivate::get(&s0)->qsbVersion, 1);
|
||||||
QCOMPARE(s0.availableShaders().count(), 1);
|
QCOMPARE(s0.availableShaders().count(), 1);
|
||||||
QVERIFY(s0.availableShaders().contains(QShaderKey(QShader::SpirvShader, QShaderVersion(100))));
|
QVERIFY(s0.availableShaders().contains(QShaderKey(QShader::SpirvShader, QShaderVersion(100))));
|
||||||
|
|
||||||
@ -229,5 +241,159 @@ void tst_QShader::bakedShaderImplicitSharing()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void tst_QShader::mslResourceMapping()
|
||||||
|
{
|
||||||
|
QShader s = getShader(QLatin1String(":/data/texture_all_v2.frag.qsb"));
|
||||||
|
QVERIFY(s.isValid());
|
||||||
|
QCOMPARE(QShaderPrivate::get(&s)->qsbVersion, 2);
|
||||||
|
|
||||||
|
const QVector<QShaderKey> availableShaders = s.availableShaders();
|
||||||
|
QCOMPARE(availableShaders.count(), 7);
|
||||||
|
QVERIFY(availableShaders.contains(QShaderKey(QShader::SpirvShader, QShaderVersion(100))));
|
||||||
|
QVERIFY(availableShaders.contains(QShaderKey(QShader::MslShader, QShaderVersion(12))));
|
||||||
|
QVERIFY(availableShaders.contains(QShaderKey(QShader::HlslShader, QShaderVersion(50))));
|
||||||
|
QVERIFY(availableShaders.contains(QShaderKey(QShader::GlslShader, QShaderVersion(100, QShaderVersion::GlslEs))));
|
||||||
|
QVERIFY(availableShaders.contains(QShaderKey(QShader::GlslShader, QShaderVersion(120))));
|
||||||
|
QVERIFY(availableShaders.contains(QShaderKey(QShader::GlslShader, QShaderVersion(150))));
|
||||||
|
QVERIFY(availableShaders.contains(QShaderKey(QShader::GlslShader, QShaderVersion(330))));
|
||||||
|
|
||||||
|
const QShader::NativeResourceBindingMap *resMap =
|
||||||
|
s.nativeResourceBindingMap(QShaderKey(QShader::GlslShader, QShaderVersion(330)));
|
||||||
|
QVERIFY(!resMap);
|
||||||
|
|
||||||
|
// The Metal shader must come with a mapping table for binding points 0
|
||||||
|
// (uniform buffer) and 1 (combined image sampler mapped to a texture and
|
||||||
|
// sampler in the shader).
|
||||||
|
resMap = s.nativeResourceBindingMap(QShaderKey(QShader::MslShader, QShaderVersion(12)));
|
||||||
|
QVERIFY(resMap);
|
||||||
|
|
||||||
|
QCOMPARE(resMap->count(), 2);
|
||||||
|
QCOMPARE(resMap->value(0).first, 0); // mapped to native buffer index 0
|
||||||
|
QCOMPARE(resMap->value(1), qMakePair(0, 0)); // mapped to native texture index 0 and sampler index 0
|
||||||
|
}
|
||||||
|
|
||||||
|
void tst_QShader::loadV3()
|
||||||
|
{
|
||||||
|
// qsb version 3: QShaderDescription is serialized as CBOR. Ensure the deserialized data is as expected.
|
||||||
|
QShader s = getShader(QLatin1String(":/data/texture_all_v3.frag.qsb"));
|
||||||
|
QVERIFY(s.isValid());
|
||||||
|
QCOMPARE(QShaderPrivate::get(&s)->qsbVersion, 3);
|
||||||
|
|
||||||
|
const QVector<QShaderKey> availableShaders = s.availableShaders();
|
||||||
|
QCOMPARE(availableShaders.count(), 7);
|
||||||
|
QVERIFY(availableShaders.contains(QShaderKey(QShader::SpirvShader, QShaderVersion(100))));
|
||||||
|
QVERIFY(availableShaders.contains(QShaderKey(QShader::MslShader, QShaderVersion(12))));
|
||||||
|
QVERIFY(availableShaders.contains(QShaderKey(QShader::HlslShader, QShaderVersion(50))));
|
||||||
|
QVERIFY(availableShaders.contains(QShaderKey(QShader::GlslShader, QShaderVersion(100, QShaderVersion::GlslEs))));
|
||||||
|
QVERIFY(availableShaders.contains(QShaderKey(QShader::GlslShader, QShaderVersion(120))));
|
||||||
|
QVERIFY(availableShaders.contains(QShaderKey(QShader::GlslShader, QShaderVersion(150))));
|
||||||
|
QVERIFY(availableShaders.contains(QShaderKey(QShader::GlslShader, QShaderVersion(330))));
|
||||||
|
|
||||||
|
const QShaderDescription desc = s.description();
|
||||||
|
QVERIFY(desc.isValid());
|
||||||
|
QCOMPARE(desc.inputVariables().count(), 1);
|
||||||
|
for (const QShaderDescription::InOutVariable &v : desc.inputVariables()) {
|
||||||
|
switch (v.location) {
|
||||||
|
case 0:
|
||||||
|
QCOMPARE(v.name, QLatin1String("qt_TexCoord"));
|
||||||
|
QCOMPARE(v.type, QShaderDescription::Vec2);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
QVERIFY(false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QCOMPARE(desc.outputVariables().count(), 1);
|
||||||
|
for (const QShaderDescription::InOutVariable &v : desc.outputVariables()) {
|
||||||
|
switch (v.location) {
|
||||||
|
case 0:
|
||||||
|
QCOMPARE(v.name, QLatin1String("fragColor"));
|
||||||
|
QCOMPARE(v.type, QShaderDescription::Vec4);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
QVERIFY(false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QCOMPARE(desc.uniformBlocks().count(), 1);
|
||||||
|
const QShaderDescription::UniformBlock blk = desc.uniformBlocks().first();
|
||||||
|
QCOMPARE(blk.blockName, QLatin1String("buf"));
|
||||||
|
QCOMPARE(blk.structName, QLatin1String("ubuf"));
|
||||||
|
QCOMPARE(blk.size, 68);
|
||||||
|
QCOMPARE(blk.binding, 0);
|
||||||
|
QCOMPARE(blk.descriptorSet, 0);
|
||||||
|
QCOMPARE(blk.members.count(), 2);
|
||||||
|
for (int i = 0; i < blk.members.count(); ++i) {
|
||||||
|
const QShaderDescription::BlockVariable v = blk.members[i];
|
||||||
|
switch (i) {
|
||||||
|
case 0:
|
||||||
|
QCOMPARE(v.offset, 0);
|
||||||
|
QCOMPARE(v.size, 64);
|
||||||
|
QCOMPARE(v.name, QLatin1String("qt_Matrix"));
|
||||||
|
QCOMPARE(v.type, QShaderDescription::Mat4);
|
||||||
|
QCOMPARE(v.matrixStride, 16);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
QCOMPARE(v.offset, 64);
|
||||||
|
QCOMPARE(v.size, 4);
|
||||||
|
QCOMPARE(v.name, QLatin1String("opacity"));
|
||||||
|
QCOMPARE(v.type, QShaderDescription::Float);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
QVERIFY(false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void tst_QShader::serializeShaderDesc()
|
||||||
|
{
|
||||||
|
// default constructed QShaderDescription
|
||||||
|
{
|
||||||
|
QShaderDescription desc;
|
||||||
|
QVERIFY(!desc.isValid());
|
||||||
|
|
||||||
|
const QByteArray data = desc.toCbor();
|
||||||
|
QVERIFY(!data.isEmpty());
|
||||||
|
|
||||||
|
QShaderDescription desc2 = QShaderDescription::fromCbor(data);
|
||||||
|
QVERIFY(!desc2.isValid());
|
||||||
|
}
|
||||||
|
|
||||||
|
// a QShaderDescription with inputs, outputs, uniform block and combined image sampler
|
||||||
|
{
|
||||||
|
QShader s = getShader(QLatin1String(":/data/texture_all_v3.frag.qsb"));
|
||||||
|
QVERIFY(s.isValid());
|
||||||
|
const QShaderDescription desc = s.description();
|
||||||
|
QVERIFY(desc.isValid());
|
||||||
|
|
||||||
|
const QByteArray data = desc.toCbor();
|
||||||
|
QVERIFY(!data.isEmpty());
|
||||||
|
|
||||||
|
QShaderDescription desc2;
|
||||||
|
QVERIFY(!desc2.isValid());
|
||||||
|
QVERIFY(!(desc == desc2));
|
||||||
|
QVERIFY(desc != desc2);
|
||||||
|
|
||||||
|
desc2 = QShaderDescription::fromCbor(data);
|
||||||
|
QVERIFY(desc2.isValid());
|
||||||
|
QCOMPARE(desc, desc2);
|
||||||
|
}
|
||||||
|
|
||||||
|
// exercise QShader and QShaderDescription comparisons
|
||||||
|
{
|
||||||
|
QShader s1 = getShader(QLatin1String(":/data/texture_all_v3.frag.qsb"));
|
||||||
|
QVERIFY(s1.isValid());
|
||||||
|
QShader s2 = getShader(QLatin1String(":/data/color_all_v1.vert.qsb"));
|
||||||
|
QVERIFY(s2.isValid());
|
||||||
|
|
||||||
|
QVERIFY(s1.description().isValid());
|
||||||
|
QVERIFY(s2.description().isValid());
|
||||||
|
|
||||||
|
QVERIFY(s1 != s2);
|
||||||
|
QVERIFY(s1.description() != s2.description());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#include <tst_qshader.moc>
|
#include <tst_qshader.moc>
|
||||||
QTEST_MAIN(tst_QShader)
|
QTEST_MAIN(tst_QShader)
|
||||||
|
@ -511,6 +511,8 @@ private Q_SLOTS:
|
|||||||
void autoDeleteReplies_data();
|
void autoDeleteReplies_data();
|
||||||
void autoDeleteReplies();
|
void autoDeleteReplies();
|
||||||
|
|
||||||
|
void getWithTimeout();
|
||||||
|
void postWithTimeout();
|
||||||
// NOTE: This test must be last!
|
// NOTE: This test must be last!
|
||||||
void parentingRepliesToTheApp();
|
void parentingRepliesToTheApp();
|
||||||
private:
|
private:
|
||||||
@ -589,6 +591,7 @@ public:
|
|||||||
bool multiple;
|
bool multiple;
|
||||||
int totalConnections;
|
int totalConnections;
|
||||||
|
|
||||||
|
bool stopTransfer = false;
|
||||||
bool hasContent = false;
|
bool hasContent = false;
|
||||||
int contentRead = 0;
|
int contentRead = 0;
|
||||||
int contentLength = 0;
|
int contentLength = 0;
|
||||||
@ -655,7 +658,7 @@ protected:
|
|||||||
// we need to emulate the bytesWrittenSlot call if the data is empty.
|
// we need to emulate the bytesWrittenSlot call if the data is empty.
|
||||||
if (dataToTransmit.size() == 0) {
|
if (dataToTransmit.size() == 0) {
|
||||||
emit client->bytesWritten(0);
|
emit client->bytesWritten(0);
|
||||||
} else {
|
} else if (!stopTransfer) {
|
||||||
client->write(dataToTransmit);
|
client->write(dataToTransmit);
|
||||||
// FIXME: For SSL connections, if we don't flush the socket, the
|
// FIXME: For SSL connections, if we don't flush the socket, the
|
||||||
// client never receives the data and since we're doing a disconnect
|
// client never receives the data and since we're doing a disconnect
|
||||||
@ -711,7 +714,8 @@ public slots:
|
|||||||
Q_ASSERT(currentClient);
|
Q_ASSERT(currentClient);
|
||||||
if (currentClient != client)
|
if (currentClient != client)
|
||||||
client = currentClient;
|
client = currentClient;
|
||||||
|
if (stopTransfer)
|
||||||
|
return;
|
||||||
receivedData += client->readAll();
|
receivedData += client->readAll();
|
||||||
const int doubleEndlPos = receivedData.indexOf("\r\n\r\n");
|
const int doubleEndlPos = receivedData.indexOf("\r\n\r\n");
|
||||||
|
|
||||||
@ -9338,6 +9342,58 @@ void tst_QNetworkReply::autoDeleteReplies()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void tst_QNetworkReply::getWithTimeout()
|
||||||
|
{
|
||||||
|
MiniHttpServer server(tst_QNetworkReply::httpEmpty200Response, false);
|
||||||
|
|
||||||
|
QNetworkRequest request(QUrl("http://localhost:" + QString::number(server.serverPort())));
|
||||||
|
QNetworkReplyPtr reply(manager.get(request));
|
||||||
|
QSignalSpy spy(reply.data(), SIGNAL(error(QNetworkReply::NetworkError)));
|
||||||
|
|
||||||
|
QCOMPARE(waitForFinish(reply), int(Success));
|
||||||
|
|
||||||
|
QCOMPARE(spy.count(), 0);
|
||||||
|
QVERIFY(reply->error() == QNetworkReply::NoError);
|
||||||
|
|
||||||
|
request.setTransferTimeout(1000);
|
||||||
|
server.stopTransfer = true;
|
||||||
|
|
||||||
|
QNetworkReplyPtr reply2(manager.get(request));
|
||||||
|
QSignalSpy spy2(reply2.data(), SIGNAL(error(QNetworkReply::NetworkError)));
|
||||||
|
|
||||||
|
QCOMPARE(waitForFinish(reply2), int(Failure));
|
||||||
|
|
||||||
|
QCOMPARE(spy2.count(), 1);
|
||||||
|
QVERIFY(reply2->error() == QNetworkReply::OperationCanceledError);
|
||||||
|
}
|
||||||
|
|
||||||
|
void tst_QNetworkReply::postWithTimeout()
|
||||||
|
{
|
||||||
|
MiniHttpServer server(tst_QNetworkReply::httpEmpty200Response, false);
|
||||||
|
|
||||||
|
QNetworkRequest request(QUrl("http://localhost:" + QString::number(server.serverPort())));
|
||||||
|
request.setRawHeader("Content-Type", "application/octet-stream");
|
||||||
|
QByteArray postData("Just some nonsense");
|
||||||
|
QNetworkReplyPtr reply(manager.post(request, postData));
|
||||||
|
QSignalSpy spy(reply.data(), SIGNAL(error(QNetworkReply::NetworkError)));
|
||||||
|
|
||||||
|
QCOMPARE(waitForFinish(reply), int(Success));
|
||||||
|
|
||||||
|
QCOMPARE(spy.count(), 0);
|
||||||
|
QVERIFY(reply->error() == QNetworkReply::NoError);
|
||||||
|
|
||||||
|
request.setTransferTimeout(1000);
|
||||||
|
server.stopTransfer = true;
|
||||||
|
|
||||||
|
QNetworkReplyPtr reply2(manager.post(request, postData));
|
||||||
|
QSignalSpy spy2(reply2.data(), SIGNAL(error(QNetworkReply::NetworkError)));
|
||||||
|
|
||||||
|
QCOMPARE(waitForFinish(reply2), int(Failure));
|
||||||
|
|
||||||
|
QCOMPARE(spy2.count(), 1);
|
||||||
|
QVERIFY(reply2->error() == QNetworkReply::OperationCanceledError);
|
||||||
|
}
|
||||||
|
|
||||||
// NOTE: This test must be last testcase in tst_qnetworkreply!
|
// NOTE: This test must be last testcase in tst_qnetworkreply!
|
||||||
void tst_QNetworkReply::parentingRepliesToTheApp()
|
void tst_QNetworkReply::parentingRepliesToTheApp()
|
||||||
{
|
{
|
||||||
|
@ -25,15 +25,16 @@
|
|||||||
** $QT_END_LICENSE$
|
** $QT_END_LICENSE$
|
||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include <QDataWidgetMapper>
|
|
||||||
#include <QStandardItemModel>
|
|
||||||
#include <QLineEdit>
|
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
|
#include <QDataWidgetMapper>
|
||||||
|
#include <QLineEdit>
|
||||||
|
#include <QMetaType>
|
||||||
|
#include <QStandardItemModel>
|
||||||
|
#include <QSignalSpy>
|
||||||
|
#include <QTest>
|
||||||
#include <QTextEdit>
|
#include <QTextEdit>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QTest>
|
|
||||||
#include <QSignalSpy>
|
|
||||||
#include <QMetaType>
|
|
||||||
|
|
||||||
class tst_QDataWidgetMapper: public QObject
|
class tst_QDataWidgetMapper: public QObject
|
||||||
{
|
{
|
||||||
@ -56,7 +57,7 @@ private slots:
|
|||||||
|
|
||||||
Q_DECLARE_METATYPE(QAbstractItemDelegate::EndEditHint)
|
Q_DECLARE_METATYPE(QAbstractItemDelegate::EndEditHint)
|
||||||
|
|
||||||
static QStandardItemModel *testModel(QObject *parent = 0)
|
static QStandardItemModel *testModel(QObject *parent)
|
||||||
{
|
{
|
||||||
QStandardItemModel *model = new QStandardItemModel(10, 10, parent);
|
QStandardItemModel *model = new QStandardItemModel(10, 10, parent);
|
||||||
|
|
||||||
@ -84,7 +85,7 @@ void tst_QDataWidgetMapper::setModel()
|
|||||||
{ // let the model go out of scope firstma
|
{ // let the model go out of scope firstma
|
||||||
QStandardItemModel model;
|
QStandardItemModel model;
|
||||||
mapper.setModel(&model);
|
mapper.setModel(&model);
|
||||||
QCOMPARE(mapper.model(), static_cast<QAbstractItemModel *>(&model));
|
QCOMPARE(mapper.model(), &model);
|
||||||
}
|
}
|
||||||
|
|
||||||
QCOMPARE(mapper.model(), nullptr);
|
QCOMPARE(mapper.model(), nullptr);
|
||||||
@ -273,7 +274,7 @@ void tst_QDataWidgetMapper::currentIndexChanged()
|
|||||||
QAbstractItemModel *model = testModel(&mapper);
|
QAbstractItemModel *model = testModel(&mapper);
|
||||||
mapper.setModel(model);
|
mapper.setModel(model);
|
||||||
|
|
||||||
QSignalSpy spy(&mapper, SIGNAL(currentIndexChanged(int)));
|
QSignalSpy spy(&mapper, &QDataWidgetMapper::currentIndexChanged);
|
||||||
|
|
||||||
mapper.toFirst();
|
mapper.toFirst();
|
||||||
QCOMPARE(spy.count(), 1);
|
QCOMPARE(spy.count(), 1);
|
||||||
@ -405,13 +406,13 @@ void tst_QDataWidgetMapper::mappedWidgetAt()
|
|||||||
mapper.addMapping(&lineEdit1, 1);
|
mapper.addMapping(&lineEdit1, 1);
|
||||||
mapper.addMapping(&lineEdit2, 2);
|
mapper.addMapping(&lineEdit2, 2);
|
||||||
|
|
||||||
QCOMPARE(mapper.mappedWidgetAt(1), static_cast<QWidget *>(&lineEdit1));
|
QCOMPARE(mapper.mappedWidgetAt(1), &lineEdit1);
|
||||||
QCOMPARE(mapper.mappedWidgetAt(2), static_cast<QWidget *>(&lineEdit2));
|
QCOMPARE(mapper.mappedWidgetAt(2), &lineEdit2);
|
||||||
|
|
||||||
mapper.addMapping(&lineEdit2, 4242);
|
mapper.addMapping(&lineEdit2, 4242);
|
||||||
|
|
||||||
QCOMPARE(mapper.mappedWidgetAt(2), nullptr);
|
QCOMPARE(mapper.mappedWidgetAt(2), nullptr);
|
||||||
QCOMPARE(mapper.mappedWidgetAt(4242), static_cast<QWidget *>(&lineEdit2));
|
QCOMPARE(mapper.mappedWidgetAt(4242), &lineEdit2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_QDataWidgetMapper::textEditDoesntChangeFocusOnTab_qtbug3305()
|
void tst_QDataWidgetMapper::textEditDoesntChangeFocusOnTab_qtbug3305()
|
||||||
@ -423,7 +424,8 @@ void tst_QDataWidgetMapper::textEditDoesntChangeFocusOnTab_qtbug3305()
|
|||||||
QAbstractItemModel *model = testModel(&mapper);
|
QAbstractItemModel *model = testModel(&mapper);
|
||||||
mapper.setModel(model);
|
mapper.setModel(model);
|
||||||
|
|
||||||
QSignalSpy closeEditorSpy(mapper.itemDelegate(), SIGNAL(closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)));
|
QSignalSpy closeEditorSpy(mapper.itemDelegate(),
|
||||||
|
&QAbstractItemDelegate::closeEditor);
|
||||||
QVERIFY(closeEditorSpy.isValid());
|
QVERIFY(closeEditorSpy.isValid());
|
||||||
|
|
||||||
QWidget container;
|
QWidget container;
|
||||||
|
@ -27,16 +27,15 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#include <QtTest/QtTest>
|
#include <QFileIconProvider>
|
||||||
#include <qfileiconprovider.h>
|
#include <QFileInfo>
|
||||||
#include <qfileinfo.h>
|
#include <QTest>
|
||||||
|
|
||||||
class tst_QFileIconProvider : public QObject
|
class tst_QFileIconProvider : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void qfileiconprovider_data();
|
|
||||||
void qfileiconprovider();
|
void qfileiconprovider();
|
||||||
|
|
||||||
void iconType_data();
|
void iconType_data();
|
||||||
@ -51,21 +50,10 @@ private slots:
|
|||||||
void taskQTBUG_46755_QFileIconEngine_crash();
|
void taskQTBUG_46755_QFileIconEngine_crash();
|
||||||
};
|
};
|
||||||
|
|
||||||
// Subclass that exposes the protected functions.
|
|
||||||
class SubQFileIconProvider : public QFileIconProvider
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
void tst_QFileIconProvider::qfileiconprovider_data()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void tst_QFileIconProvider::qfileiconprovider()
|
void tst_QFileIconProvider::qfileiconprovider()
|
||||||
{
|
{
|
||||||
// don't crash
|
// don't crash
|
||||||
SubQFileIconProvider provider;
|
QFileIconProvider provider;
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(QFileIconProvider::IconType)
|
Q_DECLARE_METATYPE(QFileIconProvider::IconType)
|
||||||
@ -86,7 +74,7 @@ void tst_QFileIconProvider::iconType_data()
|
|||||||
void tst_QFileIconProvider::iconType()
|
void tst_QFileIconProvider::iconType()
|
||||||
{
|
{
|
||||||
QFETCH(QFileIconProvider::IconType, type);
|
QFETCH(QFileIconProvider::IconType, type);
|
||||||
SubQFileIconProvider provider;
|
QFileIconProvider provider;
|
||||||
QVERIFY(!provider.icon(type).isNull());
|
QVERIFY(!provider.icon(type).isNull());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,7 +97,7 @@ void tst_QFileIconProvider::iconInfo()
|
|||||||
|
|
||||||
if (setPath)
|
if (setPath)
|
||||||
QVERIFY(info.exists());
|
QVERIFY(info.exists());
|
||||||
SubQFileIconProvider provider;
|
QFileIconProvider provider;
|
||||||
// we should always get an icon
|
// we should always get an icon
|
||||||
QVERIFY(!provider.icon(info).isNull());
|
QVERIFY(!provider.icon(info).isNull());
|
||||||
}
|
}
|
||||||
@ -131,7 +119,7 @@ void tst_QFileIconProvider::type_data()
|
|||||||
void tst_QFileIconProvider::type()
|
void tst_QFileIconProvider::type()
|
||||||
{
|
{
|
||||||
QFETCH(QFileInfo, info);
|
QFETCH(QFileInfo, info);
|
||||||
SubQFileIconProvider provider;
|
QFileIconProvider provider;
|
||||||
QVERIFY(!provider.type(info).isEmpty());
|
QVERIFY(!provider.type(info).isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,7 +132,8 @@ static QIcon getIcon()
|
|||||||
void tst_QFileIconProvider::taskQTBUG_46755_QFileIconEngine_crash()
|
void tst_QFileIconProvider::taskQTBUG_46755_QFileIconEngine_crash()
|
||||||
{
|
{
|
||||||
const QIcon &icon = getIcon();
|
const QIcon &icon = getIcon();
|
||||||
foreach (const QSize &size, icon.availableSizes())
|
const auto sizes = icon.availableSizes();
|
||||||
|
for (const QSize &size : sizes)
|
||||||
icon.pixmap(size);
|
icon.pixmap(size);
|
||||||
|
|
||||||
// No crash, all good.
|
// No crash, all good.
|
||||||
|
@ -25,9 +25,11 @@
|
|||||||
** $QT_END_LICENSE$
|
** $QT_END_LICENSE$
|
||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include <QtGui/QtGui>
|
|
||||||
#include <QtWidgets/QtWidgets>
|
|
||||||
#include <QtTest/QtTest>
|
#include <QDoubleSpinBox>
|
||||||
|
#include <QItemEditorFactory>
|
||||||
|
#include <QTest>
|
||||||
|
|
||||||
class tst_QItemEditorFactory: public QObject
|
class tst_QItemEditorFactory: public QObject
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user