Merge "Merge remote-tracking branch 'origin/5.15' into dev"

This commit is contained in:
Qt Forward Merge Bot 2020-04-11 01:00:13 +02:00 committed by Shawn Rutledge
commit ce1d4d3628
22 changed files with 395 additions and 120 deletions

View File

@ -205,22 +205,24 @@ bool ScribbleArea::event(QEvent *event)
continue; continue;
default: default:
{ {
QRectF rect = touchPoint.rect(); QSizeF diams = touchPoint.ellipseDiameters();
if (rect.isEmpty()) { if (diams.isEmpty()) {
qreal diameter = MaximumDiameter; qreal diameter = MaximumDiameter;
if (touch->device()->capabilities() & QTouchDevice::Pressure) if (touch->device()->capabilities() & QTouchDevice::Pressure)
diameter = MinimumDiameter + (MaximumDiameter - MinimumDiameter) * touchPoint.pressure(); diameter = MinimumDiameter + (MaximumDiameter - MinimumDiameter) * touchPoint.pressure();
rect.setSize(QSizeF(diameter, diameter)); diams = QSizeF(diameter, diameter);
} }
QPainter painter(&image); QPainter painter(&image);
painter.setPen(Qt::NoPen); painter.setPen(Qt::NoPen);
painter.setBrush(myPenColors.at(touchPoint.id() % myPenColors.count())); painter.setBrush(myPenColors.at(touchPoint.id() % myPenColors.count()));
painter.drawEllipse(rect); painter.drawEllipse(touchPoint.pos(), diams.width() / 2, diams.height() / 2);
painter.end(); painter.end();
modified = true; modified = true;
int rad = 2; const int rad = 2;
QRectF rect(QPointF(), diams);
rect.moveCenter(touchPoint.pos());
update(rect.toRect().adjusted(-rad,-rad, +rad, +rad)); update(rect.toRect().adjusted(-rad,-rad, +rad, +rad));
} }
break; break;

View File

@ -37,7 +37,7 @@ EMCC_COMMON_LFLAGS += \
-s FULL_ES2=1 \ -s FULL_ES2=1 \
-s FULL_ES3=1 \ -s FULL_ES3=1 \
-s USE_WEBGL2=1 \ -s USE_WEBGL2=1 \
-s NO_EXIT_RUNTIME=0 \ -s EXIT_RUNTIME=1 \
-s ERROR_ON_UNDEFINED_SYMBOLS=1 \ -s ERROR_ON_UNDEFINED_SYMBOLS=1 \
-s EXTRA_EXPORTED_RUNTIME_METHODS=[\"UTF16ToString\",\"stringToUTF16\"] \ -s EXTRA_EXPORTED_RUNTIME_METHODS=[\"UTF16ToString\",\"stringToUTF16\"] \
--bind \ --bind \

View File

@ -284,8 +284,10 @@ createUnnamedFile(NativeFileHandle &file, QTemporaryFileName &tfn, quint32 mode,
return CreateUnnamedFileStatus::NotSupported; return CreateUnnamedFileStatus::NotSupported;
const char *p = "."; const char *p = ".";
int lastSlash = tfn.path.lastIndexOf('/'); QByteArray::size_type lastSlash = tfn.path.lastIndexOf('/');
if (lastSlash != -1) { if (lastSlash >= 0) {
if (lastSlash == 0)
lastSlash = 1;
tfn.path[lastSlash] = '\0'; tfn.path[lastSlash] = '\0';
p = tfn.path.data(); p = tfn.path.data();
} }

View File

@ -575,6 +575,16 @@ QMetaPropertyBuilder QMetaObjectBuilder::addProperty
return QMetaPropertyBuilder(this, index); return QMetaPropertyBuilder(this, index);
} }
#if QT_DEPRECATED_SINCE(5, 15)
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
static bool deprecatedIsEditable(const QMetaProperty &prototype)
{
return prototype.isEditable();
}
QT_WARNING_POP
#endif
/*! /*!
Adds a new property to this class that has the same information as Adds a new property to this class that has the same information as
\a prototype. This is used to clone the properties of an existing \a prototype. This is used to clone the properties of an existing
@ -592,7 +602,7 @@ QMetaPropertyBuilder QMetaObjectBuilder::addProperty(const QMetaProperty& protot
property.setDesignable(prototype.isDesignable()); property.setDesignable(prototype.isDesignable());
property.setScriptable(prototype.isScriptable()); property.setScriptable(prototype.isScriptable());
property.setStored(prototype.isStored()); property.setStored(prototype.isStored());
property.setEditable(prototype.isEditable()); property.setEditable(deprecatedIsEditable(prototype));
property.setUser(prototype.isUser()); property.setUser(prototype.isUser());
property.setStdCppSet(prototype.hasStdCppSet()); property.setStdCppSet(prototype.hasStdCppSet());
property.setEnumOrFlag(prototype.isEnumType()); property.setEnumOrFlag(prototype.isEnumType());

View File

@ -125,6 +125,8 @@ static QJsonDocument jsonFromCborMetaData(const char *raw, qsizetype size, QStri
return QJsonDocument(o); return QJsonDocument(o);
} }
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
QJsonDocument qJsonFromRawLibraryMetaData(const char *raw, qsizetype sectionSize, QString *errMsg) QJsonDocument qJsonFromRawLibraryMetaData(const char *raw, qsizetype sectionSize, QString *errMsg)
{ {
raw += metaDataSignatureLength(); raw += metaDataSignatureLength();
@ -148,6 +150,7 @@ QJsonDocument qJsonFromRawLibraryMetaData(const char *raw, qsizetype sectionSize
return jsonFromCborMetaData(raw, sectionSize, errMsg); return jsonFromCborMetaData(raw, sectionSize, errMsg);
} }
QT_WARNING_POP
class QFactoryLoaderPrivate : public QObjectPrivate class QFactoryLoaderPrivate : public QObjectPrivate
{ {

View File

@ -956,7 +956,7 @@ QCborContainerPrivate *QCborContainerPrivate::grow(QCborContainerPrivate *d, qsi
d = detach(d, index + 1); d = detach(d, index + 1);
Q_ASSERT(d); Q_ASSERT(d);
int j = d->elements.size(); int j = d->elements.size();
while (j < index) while (j++ < index)
d->append(Undefined()); d->append(Undefined());
return d; return d;
} }
@ -994,8 +994,12 @@ void QCborContainerPrivate::replaceAt_complex(Element &e, const QCborValue &valu
e = value.container->elements.at(value.n); e = value.container->elements.at(value.n);
// Copy string data, if any // Copy string data, if any
if (const ByteData *b = value.container->byteData(value.n)) if (const ByteData *b = value.container->byteData(value.n)) {
e.value = addByteData(b->byte(), b->len); if (this == value.container)
e.value = addByteData(b->toByteArray(), b->len);
else
e.value = addByteData(b->byte(), b->len);
}
if (disp == MoveContainer) if (disp == MoveContainer)
value.container->deref(); value.container->deref();
@ -2649,7 +2653,7 @@ void QCborValueRef::assign(QCborValueRef that, QCborValue &&other)
void QCborValueRef::assign(QCborValueRef that, const QCborValueRef other) void QCborValueRef::assign(QCborValueRef that, const QCborValueRef other)
{ {
// ### optimize? // ### optimize?
assign(that, other.concrete()); that = other.concrete();
} }
QCborValue QCborValueRef::concrete(QCborValueRef self) noexcept QCborValue QCborValueRef::concrete(QCborValueRef self) noexcept

View File

@ -452,9 +452,11 @@ QJsonValueRef QJsonObject::atImpl(T key)
bool keyExists = false; bool keyExists = false;
int index = indexOf(o, key, &keyExists); int index = indexOf(o, key, &keyExists);
if (!keyExists) { if (!keyExists) {
detach2(o->elements.length() / 2 + 1);
o->insertAt(index, key); o->insertAt(index, key);
o->insertAt(index + 1, QCborValue::fromJsonValue(QJsonValue())); o->insertAt(index + 1, QCborValue::fromJsonValue(QJsonValue()));
} }
// detaching will happen if and when this QJsonValueRef is assigned to
return QJsonValueRef(this, index / 2); return QJsonValueRef(this, index / 2);
} }
@ -1469,6 +1471,7 @@ QJsonValue QJsonObject::valueAt(int i) const
void QJsonObject::setValueAt(int i, const QJsonValue &val) void QJsonObject::setValueAt(int i, const QJsonValue &val)
{ {
Q_ASSERT(o && i >= 0 && 2 * i + 1 < o->elements.length()); Q_ASSERT(o && i >= 0 && 2 * i + 1 < o->elements.length());
detach2();
if (val.isUndefined()) { if (val.isUndefined()) {
o->removeAt(2 * i + 1); o->removeAt(2 * i + 1);
o->removeAt(2 * i); o->removeAt(2 * i);

View File

@ -271,30 +271,30 @@ Q_CORE_EXPORT QTextStream &ws(QTextStream &s);
#if QT_DEPRECATED_SINCE(5, 15) #if QT_DEPRECATED_SINCE(5, 15)
// This namespace only exists for 'using namespace' declarations. // This namespace only exists for 'using namespace' declarations.
namespace QTextStreamFunctions { namespace QTextStreamFunctions {
Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::bin") QTextStream &bin(QTextStream &s); Q_CORE_EXPORT QT_DEPRECATED_VERSION_X(5, 15, "Use Qt::bin") QTextStream &bin(QTextStream &s);
Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::oct") QTextStream &oct(QTextStream &s); Q_CORE_EXPORT QT_DEPRECATED_VERSION_X(5, 15, "Use Qt::oct") QTextStream &oct(QTextStream &s);
Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::dec") QTextStream &dec(QTextStream &s); Q_CORE_EXPORT QT_DEPRECATED_VERSION_X(5, 15, "Use Qt::dec") QTextStream &dec(QTextStream &s);
Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::hex") QTextStream &hex(QTextStream &s); Q_CORE_EXPORT QT_DEPRECATED_VERSION_X(5, 15, "Use Qt::hex") QTextStream &hex(QTextStream &s);
Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::showbase") QTextStream &showbase(QTextStream &s); Q_CORE_EXPORT QT_DEPRECATED_VERSION_X(5, 15, "Use Qt::showbase") QTextStream &showbase(QTextStream &s);
Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::forcesign") QTextStream &forcesign(QTextStream &s); Q_CORE_EXPORT QT_DEPRECATED_VERSION_X(5, 15, "Use Qt::forcesign") QTextStream &forcesign(QTextStream &s);
Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::forcepoint") QTextStream &forcepoint(QTextStream &s); Q_CORE_EXPORT QT_DEPRECATED_VERSION_X(5, 15, "Use Qt::forcepoint") QTextStream &forcepoint(QTextStream &s);
Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::noshowbase") QTextStream &noshowbase(QTextStream &s); Q_CORE_EXPORT QT_DEPRECATED_VERSION_X(5, 15, "Use Qt::noshowbase") QTextStream &noshowbase(QTextStream &s);
Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::noforcesign") QTextStream &noforcesign(QTextStream &s); Q_CORE_EXPORT QT_DEPRECATED_VERSION_X(5, 15, "Use Qt::noforcesign") QTextStream &noforcesign(QTextStream &s);
Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::noforcepoint") QTextStream &noforcepoint(QTextStream &s); Q_CORE_EXPORT QT_DEPRECATED_VERSION_X(5, 15, "Use Qt::noforcepoint") QTextStream &noforcepoint(QTextStream &s);
Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::uppercasebase") QTextStream &uppercasebase(QTextStream &s); Q_CORE_EXPORT QT_DEPRECATED_VERSION_X(5, 15, "Use Qt::uppercasebase") QTextStream &uppercasebase(QTextStream &s);
Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::uppercasedigits") QTextStream &uppercasedigits(QTextStream &s); Q_CORE_EXPORT QT_DEPRECATED_VERSION_X(5, 15, "Use Qt::uppercasedigits") QTextStream &uppercasedigits(QTextStream &s);
Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::lowercasebase") QTextStream &lowercasebase(QTextStream &s); Q_CORE_EXPORT QT_DEPRECATED_VERSION_X(5, 15, "Use Qt::lowercasebase") QTextStream &lowercasebase(QTextStream &s);
Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::lowercasedigits") QTextStream &lowercasedigits(QTextStream &s); Q_CORE_EXPORT QT_DEPRECATED_VERSION_X(5, 15, "Use Qt::lowercasedigits") QTextStream &lowercasedigits(QTextStream &s);
Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::fixed") QTextStream &fixed(QTextStream &s); Q_CORE_EXPORT QT_DEPRECATED_VERSION_X(5, 15, "Use Qt::fixed") QTextStream &fixed(QTextStream &s);
Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::scientific") QTextStream &scientific(QTextStream &s); Q_CORE_EXPORT QT_DEPRECATED_VERSION_X(5, 15, "Use Qt::scientific") QTextStream &scientific(QTextStream &s);
Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::left") QTextStream &left(QTextStream &s); Q_CORE_EXPORT QT_DEPRECATED_VERSION_X(5, 15, "Use Qt::left") QTextStream &left(QTextStream &s);
Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::right") QTextStream &right(QTextStream &s); Q_CORE_EXPORT QT_DEPRECATED_VERSION_X(5, 15, "Use Qt::right") QTextStream &right(QTextStream &s);
Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::center") QTextStream &center(QTextStream &s); Q_CORE_EXPORT QT_DEPRECATED_VERSION_X(5, 15, "Use Qt::center") QTextStream &center(QTextStream &s);
Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::endl") QTextStream &endl(QTextStream &s); Q_CORE_EXPORT QT_DEPRECATED_VERSION_X(5, 15, "Use Qt::endl") QTextStream &endl(QTextStream &s);
Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::flush") QTextStream &flush(QTextStream &s); Q_CORE_EXPORT QT_DEPRECATED_VERSION_X(5, 15, "Use Qt::flush") QTextStream &flush(QTextStream &s);
Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::reset") QTextStream &reset(QTextStream &s); Q_CORE_EXPORT QT_DEPRECATED_VERSION_X(5, 15, "Use Qt::reset") QTextStream &reset(QTextStream &s);
Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::bom") QTextStream &bom(QTextStream &s); Q_CORE_EXPORT QT_DEPRECATED_VERSION_X(5, 15, "Use Qt::bom") QTextStream &bom(QTextStream &s);
Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::ws") QTextStream &ws(QTextStream &s); Q_CORE_EXPORT QT_DEPRECATED_VERSION_X(5, 15, "Use Qt::ws") QTextStream &ws(QTextStream &s);
} // namespace QTextStreamFunctions } // namespace QTextStreamFunctions
QT_WARNING_PUSH QT_WARNING_PUSH

View File

@ -59,15 +59,16 @@ load(cmake_functions)
win32: CMAKE_WINDOWS_BUILD = True win32: CMAKE_WINDOWS_BUILD = True
qtConfig(angle) { qtConfig(angle) {
!mingw|qtConfig(debug_and_release): debug_suffix="d"
CMAKE_GL_INCDIRS = $$CMAKE_INCLUDE_DIR CMAKE_GL_INCDIRS = $$CMAKE_INCLUDE_DIR
CMAKE_ANGLE_EGL_DLL_RELEASE = libEGL.dll CMAKE_ANGLE_EGL_DLL_RELEASE = libEGL.dll
CMAKE_ANGLE_EGL_IMPLIB_RELEASE = libEGL.$${QMAKE_EXTENSION_STATICLIB} CMAKE_ANGLE_EGL_IMPLIB_RELEASE = libEGL.$${QMAKE_EXTENSION_STATICLIB}
CMAKE_ANGLE_GLES2_DLL_RELEASE = libGLESv2.dll CMAKE_ANGLE_GLES2_DLL_RELEASE = libGLESv2.dll
CMAKE_ANGLE_GLES2_IMPLIB_RELEASE = libGLESv2.$${QMAKE_EXTENSION_STATICLIB} CMAKE_ANGLE_GLES2_IMPLIB_RELEASE = libGLESv2.$${QMAKE_EXTENSION_STATICLIB}
CMAKE_ANGLE_EGL_DLL_DEBUG = libEGLd.dll CMAKE_ANGLE_EGL_DLL_DEBUG = libEGL$${debug_suffix}.dll
CMAKE_ANGLE_EGL_IMPLIB_DEBUG = libEGLd.$${QMAKE_EXTENSION_STATICLIB} CMAKE_ANGLE_EGL_IMPLIB_DEBUG = libEGL$${debug_suffix}.$${QMAKE_EXTENSION_STATICLIB}
CMAKE_ANGLE_GLES2_DLL_DEBUG = libGLESv2d.dll CMAKE_ANGLE_GLES2_DLL_DEBUG = libGLESv2$${debug_suffix}.dll
CMAKE_ANGLE_GLES2_IMPLIB_DEBUG = libGLESv2d.$${QMAKE_EXTENSION_STATICLIB} CMAKE_ANGLE_GLES2_IMPLIB_DEBUG = libGLESv2$${debug_suffix}.$${QMAKE_EXTENSION_STATICLIB}
CMAKE_QT_OPENGL_IMPLEMENTATION = GLESv2 CMAKE_QT_OPENGL_IMPLEMENTATION = GLESv2
} else { } else {

View File

@ -687,9 +687,8 @@ QList<QTouchEvent::TouchPoint>
states |= point->state; states |= point->state;
p.setState(point->state); p.setState(point->state);
const QPointF screenPos = point->area.center(); p.setScreenPos(QHighDpi::fromNativePixels(point->area.center(), window));
p.setScreenPos(QHighDpi::fromNativePixels(screenPos, window)); p.setEllipseDiameters(point->area.size());
p.setScreenRect(QHighDpi::fromNativePixels(point->area, window));
// The local pos and rect are not set, they will be calculated // The local pos and rect are not set, they will be calculated
// when the event gets processed by QGuiApplication. // when the event gets processed by QGuiApplication.
@ -750,7 +749,9 @@ QList<QWindowSystemInterface::TouchPoint>
p.id = pt.id(); p.id = pt.id();
p.flags = pt.flags(); p.flags = pt.flags();
p.normalPosition = QHighDpi::toNativeLocalPosition(pt.normalizedPos(), window); p.normalPosition = QHighDpi::toNativeLocalPosition(pt.normalizedPos(), window);
p.area = QHighDpi::toNativePixels(pt.screenRect(), window); QRectF area(QPointF(), pt.ellipseDiameters());
area.moveCenter(pt.screenPos());
p.area = QHighDpi::toNativePixels(area, window);
p.pressure = pt.pressure(); p.pressure = pt.pressure();
p.state = pt.state(); p.state = pt.state();
p.velocity = QHighDpi::toNativePixels(pt.velocity(), window); p.velocity = QHighDpi::toNativePixels(pt.velocity(), window);

View File

@ -103,17 +103,18 @@ QMinimalIntegration::QMinimalIntegration(const QStringList &parameters)
m_options |= DebugBackingStore | EnableFonts; m_options |= DebugBackingStore | EnableFonts;
} }
QMinimalScreen *mPrimaryScreen = new QMinimalScreen(); m_primaryScreen = new QMinimalScreen();
mPrimaryScreen->mGeometry = QRect(0, 0, 240, 320); m_primaryScreen->mGeometry = QRect(0, 0, 240, 320);
mPrimaryScreen->mDepth = 32; m_primaryScreen->mDepth = 32;
mPrimaryScreen->mFormat = QImage::Format_ARGB32_Premultiplied; m_primaryScreen->mFormat = QImage::Format_ARGB32_Premultiplied;
QWindowSystemInterface::handleScreenAdded(mPrimaryScreen); QWindowSystemInterface::handleScreenAdded(m_primaryScreen);
} }
QMinimalIntegration::~QMinimalIntegration() QMinimalIntegration::~QMinimalIntegration()
{ {
QWindowSystemInterface::handleScreenRemoved(m_primaryScreen);
delete m_fontDatabase; delete m_fontDatabase;
} }

View File

@ -88,6 +88,7 @@ public:
private: private:
mutable QPlatformFontDatabase *m_fontDatabase; mutable QPlatformFontDatabase *m_fontDatabase;
QMinimalScreen *m_primaryScreen;
unsigned m_options; unsigned m_options;
}; };

View File

@ -5915,10 +5915,6 @@ void QGraphicsScenePrivate::updateTouchPointsForItem(QGraphicsItem *item, QTouch
item->d_ptr->genericMapFromSceneTransform(static_cast<const QWidget *>(touchEvent->target())); item->d_ptr->genericMapFromSceneTransform(static_cast<const QWidget *>(touchEvent->target()));
for (auto &touchPoint : touchEvent->_touchPoints) { for (auto &touchPoint : touchEvent->_touchPoints) {
// Deprecated TouchPoint::setRect clobbers ellipseDiameters, restore
const QSizeF ellipseDiameters = touchPoint.ellipseDiameters();
touchPoint.setRect(mapFromScene.map(touchPoint.sceneRect()).boundingRect());
touchPoint.setEllipseDiameters(ellipseDiameters);
touchPoint.setPos(mapFromScene.map(touchPoint.scenePos())); touchPoint.setPos(mapFromScene.map(touchPoint.scenePos()));
touchPoint.setStartPos(mapFromScene.map(touchPoint.startScenePos())); touchPoint.setStartPos(mapFromScene.map(touchPoint.startScenePos()));
touchPoint.setLastPos(mapFromScene.map(touchPoint.lastScenePos())); touchPoint.setLastPos(mapFromScene.map(touchPoint.lastScenePos()));

View File

@ -3958,7 +3958,7 @@ bool QApplicationPrivate::updateTouchPointsForWidget(QWidget *widget, QTouchEven
QTouchEvent::TouchPoint &touchPoint = touchEvent->_touchPoints[i]; QTouchEvent::TouchPoint &touchPoint = touchEvent->_touchPoints[i];
// preserve the sub-pixel resolution // preserve the sub-pixel resolution
const QPointF screenPos = touchPoint.screenRect().center(); const QPointF screenPos = touchPoint.screenPos();
const QPointF delta = screenPos - screenPos.toPoint(); const QPointF delta = screenPos - screenPos.toPoint();
touchPoint.d->pos = widget->mapFromGlobal(screenPos.toPoint()) + delta; touchPoint.d->pos = widget->mapFromGlobal(screenPos.toPoint()) + delta;

View File

@ -385,6 +385,16 @@ int QComboBoxPrivate::computeWidthHint() const
return tmp.width(); return tmp.width();
} }
#if QT_DEPRECATED_SINCE(5, 15)
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
static constexpr QComboBox::SizeAdjustPolicy deprecatedAdjustToMinimumContentsLength()
{
return QComboBox::AdjustToMinimumContentsLength;
}
QT_WARNING_POP
#endif
QSize QComboBoxPrivate::recomputeSizeHint(QSize &sh) const QSize QComboBoxPrivate::recomputeSizeHint(QSize &sh) const
{ {
Q_Q(const QComboBox); Q_Q(const QComboBox);
@ -412,10 +422,11 @@ QSize QComboBoxPrivate::recomputeSizeHint(QSize &sh) const
} }
} }
break; break;
case QComboBox::AdjustToMinimumContentsLength: case deprecatedAdjustToMinimumContentsLength():
for (int i = 0; i < count && !hasIcon; ++i) for (int i = 0; i < count && !hasIcon; ++i)
hasIcon = !q->itemIcon(i).isNull(); hasIcon = !q->itemIcon(i).isNull();
default: break;
case QComboBox::AdjustToMinimumContentsLengthWithIcon:
; ;
} }
} else { } else {
@ -1742,7 +1753,7 @@ void QComboBox::setMinimumContentsLength(int characters)
d->minimumContentsLength = characters; d->minimumContentsLength = characters;
if (d->sizeAdjustPolicy == AdjustToContents if (d->sizeAdjustPolicy == AdjustToContents
|| d->sizeAdjustPolicy == AdjustToMinimumContentsLength || d->sizeAdjustPolicy == deprecatedAdjustToMinimumContentsLength()
|| d->sizeAdjustPolicy == AdjustToMinimumContentsLengthWithIcon) { || d->sizeAdjustPolicy == AdjustToMinimumContentsLengthWithIcon) {
d->sizeHint = QSize(); d->sizeHint = QSize();
d->adjustComboBoxSize(); d->adjustComboBoxSize();

View File

@ -1889,10 +1889,11 @@ void tst_QFileInfo::isWritable()
#if defined (Q_OS_QNX) // On QNX /etc is usually on a read-only filesystem #if defined (Q_OS_QNX) // On QNX /etc is usually on a read-only filesystem
QVERIFY(!QFileInfo("/etc/passwd").isWritable()); QVERIFY(!QFileInfo("/etc/passwd").isWritable());
#elif defined (Q_OS_UNIX) && !defined(Q_OS_VXWORKS) // VxWorks does not have users/groups #elif defined (Q_OS_UNIX) && !defined(Q_OS_VXWORKS) // VxWorks does not have users/groups
if (::getuid() == 0) for (const char *attempt : { "/etc/passwd", "/etc/machine-id", "/proc/version" }) {
QVERIFY(QFileInfo("/etc/passwd").isWritable()); if (access(attempt, F_OK) == -1)
else continue;
QVERIFY(!QFileInfo("/etc/passwd").isWritable()); QCOMPARE(QFileInfo(attempt).isWritable(), ::access(attempt, W_OK) == 0);
}
#endif #endif
} }

View File

@ -136,6 +136,10 @@ void tst_QSaveFile::retryTransactionalWrite()
{ {
#ifndef Q_OS_UNIX #ifndef Q_OS_UNIX
QSKIP("This test is Unix only"); QSKIP("This test is Unix only");
#else
// root can open the read-only file for writing...
if (geteuid() == 0)
QSKIP("This test does not work as the root user");
#endif #endif
QTemporaryDir dir; QTemporaryDir dir;
QVERIFY2(dir.isValid(), qPrintable(dir.errorString())); QVERIFY2(dir.isValid(), qPrintable(dir.errorString()));

View File

@ -517,6 +517,9 @@ void tst_QTemporaryFile::openOnRootDrives()
QTemporaryFile file(driveInfo.filePath() + "XXXXXX.txt"); QTemporaryFile file(driveInfo.filePath() + "XXXXXX.txt");
file.setAutoRemove(true); file.setAutoRemove(true);
QVERIFY(file.open()); QVERIFY(file.open());
QFileInfo fi(file.fileName());
QCOMPARE(fi.absoluteDir(), driveInfo.filePath());
} }
} }
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)

View File

@ -56,7 +56,9 @@ private Q_SLOTS:
void testObjectSimple(); void testObjectSimple();
void testObjectSmallKeys(); void testObjectSmallKeys();
void testObjectInsertCopies();
void testArraySimple(); void testArraySimple();
void testArrayInsertCopies();
void testValueObject(); void testValueObject();
void testValueArray(); void testValueArray();
void testObjectNested(); void testObjectNested();
@ -591,6 +593,75 @@ void tst_QtJson::testObjectSmallKeys()
QCOMPARE(data1.end() - data1.begin(), 3); QCOMPARE(data1.end() - data1.begin(), 3);
} }
void tst_QtJson::testObjectInsertCopies()
{
{
QJsonObject obj;
obj["prop1"] = "TEST";
QCOMPARE(obj.size(), 1);
QCOMPARE(obj.value("prop1"), "TEST");
obj["prop2"] = obj.value("prop1");
QCOMPARE(obj.size(), 2);
QCOMPARE(obj.value("prop1"), "TEST");
QCOMPARE(obj.value("prop2"), "TEST");
}
{
// see QTBUG-83366
QJsonObject obj;
obj["value"] = "TEST";
QCOMPARE(obj.size(), 1);
QCOMPARE(obj.value("value"), "TEST");
obj["prop2"] = obj.value("value");
QCOMPARE(obj.size(), 2);
QCOMPARE(obj.value("value"), "TEST");
QCOMPARE(obj.value("prop2"), "TEST");
}
{
QJsonObject obj;
obj["value"] = "TEST";
QCOMPARE(obj.size(), 1);
QCOMPARE(obj.value("value"), "TEST");
// same as previous, but this is a QJsonValueRef
QJsonValueRef rv = obj["prop2"];
rv = obj["value"];
QCOMPARE(obj.size(), 2);
QCOMPARE(obj.value("value"), "TEST");
QCOMPARE(obj.value("prop2"), "TEST");
}
{
QJsonObject obj;
obj["value"] = "TEST";
QCOMPARE(obj.size(), 1);
QCOMPARE(obj.value("value"), "TEST");
// same as previous, but this is a QJsonValueRef
QJsonValueRef rv = obj["value"];
obj["prop2"] = rv;
QCOMPARE(obj.size(), 2);
QCOMPARE(obj.value("value"), "TEST");
QEXPECT_FAIL("", "QTBUG-83398: design flaw: the obj[] call invalidates the QJsonValueRef", Continue);
QCOMPARE(obj.value("prop2"), "TEST");
}
{
QJsonObject obj;
obj["value"] = "TEST";
QCOMPARE(obj.size(), 1);
QCOMPARE(obj.value("value"), "TEST");
QJsonValueRef v = obj["value"];
QJsonObject obj2 = obj;
obj.insert("prop2", v);
QCOMPARE(obj.size(), 2);
QCOMPARE(obj.value("value"), "TEST");
QCOMPARE(obj.value("prop2"), "TEST");
QCOMPARE(obj2.size(), 1);
QCOMPARE(obj2.value("value"), "TEST");
}
}
void tst_QtJson::testArraySimple() void tst_QtJson::testArraySimple()
{ {
QJsonArray array; QJsonArray array;
@ -644,6 +715,32 @@ void tst_QtJson::testArraySimple()
QCOMPARE(array.at(1), QJsonValue(QLatin1String("test"))); QCOMPARE(array.at(1), QJsonValue(QLatin1String("test")));
} }
void tst_QtJson::testArrayInsertCopies()
{
{
QJsonArray array;
array.append("TEST");
QCOMPARE(array.size(), 1);
QCOMPARE(array.at(0), "TEST");
array.append(array.at(0));
QCOMPARE(array.size(), 2);
QCOMPARE(array.at(0), "TEST");
QCOMPARE(array.at(1), "TEST");
}
{
QJsonArray array;
array.append("TEST");
QCOMPARE(array.size(), 1);
QCOMPARE(array.at(0), "TEST");
array.prepend(array.at(0));
QCOMPARE(array.size(), 2);
QCOMPARE(array.at(0), "TEST");
QCOMPARE(array.at(1), "TEST");
}
}
void tst_QtJson::testValueObject() void tst_QtJson::testValueObject()
{ {
QJsonObject object; QJsonObject object;

View File

@ -65,6 +65,7 @@ private slots:
void arrayEmptyDetach(); void arrayEmptyDetach();
void arrayInitializerList(); void arrayInitializerList();
void arrayMutation(); void arrayMutation();
void arrayMutateWithCopies();
void arrayPrepend(); void arrayPrepend();
void arrayInsertRemove_data() { basics_data(); } void arrayInsertRemove_data() { basics_data(); }
void arrayInsertRemove(); void arrayInsertRemove();
@ -79,6 +80,7 @@ private slots:
void mapEmptyDetach(); void mapEmptyDetach();
void mapSimpleInitializerList(); void mapSimpleInitializerList();
void mapMutation(); void mapMutation();
void mapMutateWithCopies();
void mapStringValues(); void mapStringValues();
void mapStringKeys(); void mapStringKeys();
void mapInsertRemove_data() { basics_data(); } void mapInsertRemove_data() { basics_data(); }
@ -816,6 +818,59 @@ void tst_QCborValue::arrayMutation()
QCOMPARE(val[2].toArray().size(), 5); QCOMPARE(val[2].toArray().size(), 5);
} }
void tst_QCborValue::arrayMutateWithCopies()
{
{
QCborArray array;
array.append("TEST");
QCOMPARE(array.size(), 1);
QCOMPARE(array.at(0), "TEST");
array.append(array.at(0));
QCOMPARE(array.size(), 2);
QCOMPARE(array.at(0), "TEST");
QCOMPARE(array.at(1), "TEST");
}
{
QCborArray array;
array.append("TEST");
QCOMPARE(array.size(), 1);
QCOMPARE(array.at(0), "TEST");
// same as previous, but with prepend() not append()
array.prepend(array.at(0));
QCOMPARE(array.size(), 2);
QCOMPARE(array.at(0), "TEST");
QCOMPARE(array.at(1), "TEST");
}
{
QCborArray array;
array.append("TEST");
QCOMPARE(array.size(), 1);
QCOMPARE(array.at(0), "TEST");
// same as previous, but using a QCborValueRef
QCborValueRef rv = array[0];
array.prepend(rv);
QCOMPARE(array.size(), 2);
QCOMPARE(array.at(0), "TEST");
QCOMPARE(array.at(1), "TEST");
}
{
QCborArray array;
array.append("TEST");
QCOMPARE(array.size(), 1);
QCOMPARE(array.at(0), "TEST");
// same as previous, but now extending the array
QCborValueRef rv = array[0];
array[2] = rv;
QCOMPARE(array.size(), 3);
QCOMPARE(array.at(0), "TEST");
QCOMPARE(array.at(2), "TEST");
}
}
void tst_QCborValue::mapMutation() void tst_QCborValue::mapMutation()
{ {
QCborMap m; QCborMap m;
@ -923,6 +978,76 @@ void tst_QCborValue::mapMutation()
QCOMPARE(val[any][3].toMap().size(), 1); QCOMPARE(val[any][3].toMap().size(), 1);
} }
void tst_QCborValue::mapMutateWithCopies()
{
{
QCborMap map;
map[QLatin1String("prop1")] = "TEST";
QCOMPARE(map.size(), 1);
QCOMPARE(map.value("prop1"), "TEST");
map[QLatin1String("prop2")] = map.value("prop1");
QCOMPARE(map.size(), 2);
QCOMPARE(map.value("prop1"), "TEST");
QCOMPARE(map.value("prop2"), "TEST");
}
{
// see QTBUG-83366
QCborMap map;
map[QLatin1String("value")] = "TEST";
QCOMPARE(map.size(), 1);
QCOMPARE(map.value("value"), "TEST");
QCborValue v = map.value("value");
map[QLatin1String("prop2")] = v;
QCOMPARE(map.size(), 2);
QCOMPARE(map.value("value"), "TEST");
QCOMPARE(map.value("prop2"), "TEST");
}
{
QCborMap map;
map[QLatin1String("value")] = "TEST";
QCOMPARE(map.size(), 1);
QCOMPARE(map.value("value"), "TEST");
// same as previous, but this is a QJsonValueRef
QCborValueRef rv = map[QLatin1String("prop2")];
rv = map[QLatin1String("value")];
QCOMPARE(map.size(), 2);
QCOMPARE(map.value("value"), "TEST");
QCOMPARE(map.value("prop2"), "TEST");
}
{
QCborMap map;
map[QLatin1String("value")] = "TEST";
QCOMPARE(map.size(), 1);
QCOMPARE(map.value("value"), "TEST");
// same as previous, but now we call the operator[] that reallocates
// after we create the source QCborValueRef
QCborValueRef rv = map[QLatin1String("value")];
map[QLatin1String("prop2")] = rv;
QCOMPARE(map.size(), 2);
QCOMPARE(map.value("value"), "TEST");
QCOMPARE(map.value("prop2"), "TEST");
}
{
QCborMap map;
map[QLatin1String("value")] = "TEST";
QCOMPARE(map.size(), 1);
QCOMPARE(map.value("value"), "TEST");
QCborValueRef v = map[QLatin1String("value")];
QCborMap map2 = map;
map.insert(QLatin1String("prop2"), v);
QCOMPARE(map.size(), 2);
QCOMPARE(map.value("value"), "TEST");
QCOMPARE(map.value("prop2"), "TEST");
QCOMPARE(map2.size(), 1);
QCOMPARE(map2.value("value"), "TEST");
}
}
void tst_QCborValue::arrayPrepend() void tst_QCborValue::arrayPrepend()
{ {
QCborArray a; QCborArray a;

View File

@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of the $MODULE$ of the Qt Toolkit. ** This file is part of the $MODULE$ of the Qt Toolkit.
@ -656,9 +656,10 @@ void tst_QTouchEvent::basicRawEventTranslation()
QCOMPARE(touchBeginPoint.normalizedPos(), rawTouchPoint.normalizedPos()); QCOMPARE(touchBeginPoint.normalizedPos(), rawTouchPoint.normalizedPos());
QCOMPARE(touchBeginPoint.startNormalizedPos(), touchBeginPoint.normalizedPos()); QCOMPARE(touchBeginPoint.startNormalizedPos(), touchBeginPoint.normalizedPos());
QCOMPARE(touchBeginPoint.lastNormalizedPos(), touchBeginPoint.normalizedPos()); QCOMPARE(touchBeginPoint.lastNormalizedPos(), touchBeginPoint.normalizedPos());
QCOMPARE(touchBeginPoint.rect(), QRectF(pos, QSizeF(0, 0))); QCOMPARE(touchBeginPoint.pos(), pos);
QCOMPARE(touchBeginPoint.screenRect(), QRectF(rawTouchPoint.screenPos(), QSizeF(0, 0))); QCOMPARE(touchBeginPoint.screenPos(), rawTouchPoint.screenPos());
QCOMPARE(touchBeginPoint.sceneRect(), touchBeginPoint.screenRect()); QCOMPARE(touchBeginPoint.scenePos(), touchBeginPoint.scenePos());
QCOMPARE(touchBeginPoint.ellipseDiameters(), QSizeF(0, 0));
QCOMPARE(touchBeginPoint.pressure(), qreal(1.)); QCOMPARE(touchBeginPoint.pressure(), qreal(1.));
QCOMPARE(touchBeginPoint.velocity(), QVector2D()); QCOMPARE(touchBeginPoint.velocity(), QVector2D());
if (!QHighDpiScaling::isActive()) if (!QHighDpiScaling::isActive())
@ -691,9 +692,10 @@ void tst_QTouchEvent::basicRawEventTranslation()
QCOMPARE(touchUpdatePoint.normalizedPos(), rawTouchPoint.normalizedPos()); QCOMPARE(touchUpdatePoint.normalizedPos(), rawTouchPoint.normalizedPos());
QCOMPARE(touchUpdatePoint.startNormalizedPos(), touchBeginPoint.normalizedPos()); QCOMPARE(touchUpdatePoint.startNormalizedPos(), touchBeginPoint.normalizedPos());
QCOMPARE(touchUpdatePoint.lastNormalizedPos(), touchBeginPoint.normalizedPos()); QCOMPARE(touchUpdatePoint.lastNormalizedPos(), touchBeginPoint.normalizedPos());
QCOMPARE(touchUpdatePoint.rect(), QRectF(pos + delta, QSizeF(0, 0))); QCOMPARE(touchUpdatePoint.pos(), pos + delta);
QCOMPARE(touchUpdatePoint.screenRect(), QRectF(rawTouchPoint.screenPos(), QSizeF(0, 0))); QCOMPARE(touchUpdatePoint.screenPos(), rawTouchPoint.screenPos());
QCOMPARE(touchUpdatePoint.sceneRect(), touchUpdatePoint.screenRect()); QCOMPARE(touchUpdatePoint.scenePos(), touchUpdatePoint.scenePos());
QCOMPARE(touchUpdatePoint.ellipseDiameters(), QSizeF(0, 0));
QCOMPARE(touchUpdatePoint.pressure(), qreal(1.)); QCOMPARE(touchUpdatePoint.pressure(), qreal(1.));
// releasing the point translates to TouchEnd // releasing the point translates to TouchEnd
@ -723,9 +725,10 @@ void tst_QTouchEvent::basicRawEventTranslation()
QCOMPARE(touchEndPoint.normalizedPos(), rawTouchPoint.normalizedPos()); QCOMPARE(touchEndPoint.normalizedPos(), rawTouchPoint.normalizedPos());
QCOMPARE(touchEndPoint.startNormalizedPos(), touchBeginPoint.normalizedPos()); QCOMPARE(touchEndPoint.startNormalizedPos(), touchBeginPoint.normalizedPos());
QCOMPARE(touchEndPoint.lastNormalizedPos(), touchUpdatePoint.normalizedPos()); QCOMPARE(touchEndPoint.lastNormalizedPos(), touchUpdatePoint.normalizedPos());
QCOMPARE(touchEndPoint.rect(), QRectF(pos + delta + delta, QSizeF(0, 0))); QCOMPARE(touchEndPoint.pos(), pos + delta + delta);
QCOMPARE(touchEndPoint.screenRect(), QRectF(rawTouchPoint.screenPos(), QSizeF(0, 0))); QCOMPARE(touchEndPoint.screenPos(), rawTouchPoint.screenPos());
QCOMPARE(touchEndPoint.sceneRect(), touchEndPoint.screenRect()); QCOMPARE(touchEndPoint.scenePos(), touchEndPoint.scenePos());
QCOMPARE(touchEndPoint.ellipseDiameters(), QSizeF(0, 0));
QCOMPARE(touchEndPoint.pressure(), qreal(0.)); QCOMPARE(touchEndPoint.pressure(), qreal(0.));
} }
@ -800,9 +803,10 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchScreen()
QCOMPARE(leftTouchPoint.normalizedPos(), rawTouchPoints[0].normalizedPos()); QCOMPARE(leftTouchPoint.normalizedPos(), rawTouchPoints[0].normalizedPos());
QCOMPARE(leftTouchPoint.startNormalizedPos(), rawTouchPoints[0].normalizedPos()); QCOMPARE(leftTouchPoint.startNormalizedPos(), rawTouchPoints[0].normalizedPos());
QCOMPARE(leftTouchPoint.lastNormalizedPos(), rawTouchPoints[0].normalizedPos()); QCOMPARE(leftTouchPoint.lastNormalizedPos(), rawTouchPoints[0].normalizedPos());
QCOMPARE(leftTouchPoint.rect(), QRectF(leftPos, QSizeF(0, 0))); QCOMPARE(leftTouchPoint.pos(), leftPos);
QCOMPARE(leftTouchPoint.sceneRect(), QRectF(leftScreenPos, QSizeF(0, 0))); QCOMPARE(leftTouchPoint.scenePos(), leftScreenPos);
QCOMPARE(leftTouchPoint.screenRect(), QRectF(leftScreenPos, QSizeF(0, 0))); QCOMPARE(leftTouchPoint.screenPos(), leftScreenPos);
QCOMPARE(leftTouchPoint.ellipseDiameters(), QSizeF(0, 0));
QCOMPARE(leftTouchPoint.pressure(), qreal(1.)); QCOMPARE(leftTouchPoint.pressure(), qreal(1.));
QTouchEvent::TouchPoint rightTouchPoint = rightWidget.touchBeginPoints.first(); QTouchEvent::TouchPoint rightTouchPoint = rightWidget.touchBeginPoints.first();
@ -820,9 +824,10 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchScreen()
QCOMPARE(rightTouchPoint.normalizedPos(), rawTouchPoints[1].normalizedPos()); QCOMPARE(rightTouchPoint.normalizedPos(), rawTouchPoints[1].normalizedPos());
QCOMPARE(rightTouchPoint.startNormalizedPos(), rawTouchPoints[1].normalizedPos()); QCOMPARE(rightTouchPoint.startNormalizedPos(), rawTouchPoints[1].normalizedPos());
QCOMPARE(rightTouchPoint.lastNormalizedPos(), rawTouchPoints[1].normalizedPos()); QCOMPARE(rightTouchPoint.lastNormalizedPos(), rawTouchPoints[1].normalizedPos());
QCOMPARE(rightTouchPoint.rect(), QRectF(rightPos, QSizeF(0, 0))); QCOMPARE(rightTouchPoint.pos(), rightPos);
QCOMPARE(rightTouchPoint.sceneRect(), QRectF(rightScreenPos, QSizeF(0, 0))); QCOMPARE(rightTouchPoint.scenePos(), rightScreenPos);
QCOMPARE(rightTouchPoint.screenRect(), QRectF(rightScreenPos, QSizeF(0, 0))); QCOMPARE(rightTouchPoint.screenPos(), rightScreenPos);
QCOMPARE(rightTouchPoint.ellipseDiameters(), QSizeF(0, 0));
QCOMPARE(rightTouchPoint.pressure(), qreal(1.)); QCOMPARE(rightTouchPoint.pressure(), qreal(1.));
} }
@ -864,9 +869,10 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchScreen()
QCOMPARE(leftTouchPoint.normalizedPos(), rawTouchPoints[0].normalizedPos()); QCOMPARE(leftTouchPoint.normalizedPos(), rawTouchPoints[0].normalizedPos());
QCOMPARE(leftTouchPoint.startNormalizedPos(), rawTouchPoints[0].normalizedPos()); QCOMPARE(leftTouchPoint.startNormalizedPos(), rawTouchPoints[0].normalizedPos());
QCOMPARE(leftTouchPoint.lastNormalizedPos(), rawTouchPoints[0].normalizedPos()); QCOMPARE(leftTouchPoint.lastNormalizedPos(), rawTouchPoints[0].normalizedPos());
QCOMPARE(leftTouchPoint.rect(), QRectF(leftWidget.mapFromParent(centerPos.toPoint()), QSizeF(0, 0))); QCOMPARE(leftTouchPoint.pos(), leftWidget.mapFromParent(centerPos.toPoint()));
QCOMPARE(leftTouchPoint.sceneRect(), QRectF(centerScreenPos, QSizeF(0, 0))); QCOMPARE(leftTouchPoint.scenePos(), centerScreenPos);
QCOMPARE(leftTouchPoint.screenRect(), QRectF(centerScreenPos, QSizeF(0, 0))); QCOMPARE(leftTouchPoint.screenPos(), centerScreenPos);
QCOMPARE(leftTouchPoint.ellipseDiameters(), QSizeF(0, 0));
QCOMPARE(leftTouchPoint.pressure(), qreal(1.)); QCOMPARE(leftTouchPoint.pressure(), qreal(1.));
QTouchEvent::TouchPoint rightTouchPoint = rightWidget.touchUpdatePoints.first(); QTouchEvent::TouchPoint rightTouchPoint = rightWidget.touchUpdatePoints.first();
@ -884,9 +890,10 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchScreen()
QCOMPARE(rightTouchPoint.normalizedPos(), rawTouchPoints[1].normalizedPos()); QCOMPARE(rightTouchPoint.normalizedPos(), rawTouchPoints[1].normalizedPos());
QCOMPARE(rightTouchPoint.startNormalizedPos(), rawTouchPoints[1].normalizedPos()); QCOMPARE(rightTouchPoint.startNormalizedPos(), rawTouchPoints[1].normalizedPos());
QCOMPARE(rightTouchPoint.lastNormalizedPos(), rawTouchPoints[1].normalizedPos()); QCOMPARE(rightTouchPoint.lastNormalizedPos(), rawTouchPoints[1].normalizedPos());
QCOMPARE(rightTouchPoint.rect(), QRectF(rightWidget.mapFromParent(centerPos.toPoint()), QSizeF(0, 0))); QCOMPARE(rightTouchPoint.pos(), rightWidget.mapFromParent(centerPos.toPoint()));
QCOMPARE(rightTouchPoint.sceneRect(), QRectF(centerScreenPos, QSizeF(0, 0))); QCOMPARE(rightTouchPoint.scenePos(), centerScreenPos);
QCOMPARE(rightTouchPoint.screenRect(), QRectF(centerScreenPos, QSizeF(0, 0))); QCOMPARE(rightTouchPoint.screenPos(), centerScreenPos);
QCOMPARE(rightTouchPoint.ellipseDiameters(), QSizeF(0, 0));
QCOMPARE(rightTouchPoint.pressure(), qreal(1.)); QCOMPARE(rightTouchPoint.pressure(), qreal(1.));
} }
@ -928,9 +935,10 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchScreen()
QCOMPARE(leftTouchPoint.normalizedPos(), rawTouchPoints[0].normalizedPos()); QCOMPARE(leftTouchPoint.normalizedPos(), rawTouchPoints[0].normalizedPos());
QCOMPARE(leftTouchPoint.startNormalizedPos(), rawTouchPoints[0].normalizedPos()); QCOMPARE(leftTouchPoint.startNormalizedPos(), rawTouchPoints[0].normalizedPos());
QCOMPARE(leftTouchPoint.lastNormalizedPos(), rawTouchPoints[0].normalizedPos()); QCOMPARE(leftTouchPoint.lastNormalizedPos(), rawTouchPoints[0].normalizedPos());
QCOMPARE(leftTouchPoint.rect(), QRectF(leftWidget.mapFromParent(centerPos.toPoint()), QSizeF(0, 0))); QCOMPARE(leftTouchPoint.pos(), leftWidget.mapFromParent(centerPos.toPoint()));
QCOMPARE(leftTouchPoint.sceneRect(), QRectF(centerScreenPos, QSizeF(0, 0))); QCOMPARE(leftTouchPoint.scenePos(), centerScreenPos);
QCOMPARE(leftTouchPoint.screenRect(), QRectF(centerScreenPos, QSizeF(0, 0))); QCOMPARE(leftTouchPoint.screenPos(), centerScreenPos);
QCOMPARE(leftTouchPoint.ellipseDiameters(), QSizeF(0, 0));
QCOMPARE(leftTouchPoint.pressure(), qreal(0.)); QCOMPARE(leftTouchPoint.pressure(), qreal(0.));
QTouchEvent::TouchPoint rightTouchPoint = rightWidget.touchEndPoints.first(); QTouchEvent::TouchPoint rightTouchPoint = rightWidget.touchEndPoints.first();
@ -948,9 +956,10 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchScreen()
QCOMPARE(rightTouchPoint.normalizedPos(), rawTouchPoints[1].normalizedPos()); QCOMPARE(rightTouchPoint.normalizedPos(), rawTouchPoints[1].normalizedPos());
QCOMPARE(rightTouchPoint.startNormalizedPos(), rawTouchPoints[1].normalizedPos()); QCOMPARE(rightTouchPoint.startNormalizedPos(), rawTouchPoints[1].normalizedPos());
QCOMPARE(rightTouchPoint.lastNormalizedPos(), rawTouchPoints[1].normalizedPos()); QCOMPARE(rightTouchPoint.lastNormalizedPos(), rawTouchPoints[1].normalizedPos());
QCOMPARE(rightTouchPoint.rect(), QRectF(rightWidget.mapFromParent(centerPos.toPoint()), QSizeF(0, 0))); QCOMPARE(rightTouchPoint.pos(), rightWidget.mapFromParent(centerPos.toPoint()));
QCOMPARE(rightTouchPoint.sceneRect(), QRectF(centerScreenPos, QSizeF(0, 0))); QCOMPARE(rightTouchPoint.scenePos(), centerScreenPos);
QCOMPARE(rightTouchPoint.screenRect(), QRectF(centerScreenPos, QSizeF(0, 0))); QCOMPARE(rightTouchPoint.screenPos(), centerScreenPos);
QCOMPARE(rightTouchPoint.ellipseDiameters(), QSizeF(0, 0));
QCOMPARE(rightTouchPoint.pressure(), qreal(0.)); QCOMPARE(rightTouchPoint.pressure(), qreal(0.));
} }
} }
@ -1177,9 +1186,10 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchPad()
QCOMPARE(leftTouchPoint.normalizedPos(), rawTouchPoints[0].normalizedPos()); QCOMPARE(leftTouchPoint.normalizedPos(), rawTouchPoints[0].normalizedPos());
QCOMPARE(leftTouchPoint.startNormalizedPos(), rawTouchPoints[0].normalizedPos()); QCOMPARE(leftTouchPoint.startNormalizedPos(), rawTouchPoints[0].normalizedPos());
QCOMPARE(leftTouchPoint.lastNormalizedPos(), rawTouchPoints[0].normalizedPos()); QCOMPARE(leftTouchPoint.lastNormalizedPos(), rawTouchPoints[0].normalizedPos());
QCOMPARE(leftTouchPoint.rect(), QRectF(leftPos, QSizeF(0, 0))); QCOMPARE(leftTouchPoint.pos(), leftPos);
QCOMPARE(leftTouchPoint.sceneRect(), QRectF(leftScreenPos, QSizeF(0, 0))); QCOMPARE(leftTouchPoint.scenePos(), leftScreenPos);
QCOMPARE(leftTouchPoint.screenRect(), QRectF(leftScreenPos, QSizeF(0, 0))); QCOMPARE(leftTouchPoint.screenPos(), leftScreenPos);
QCOMPARE(leftTouchPoint.ellipseDiameters(), QSizeF(0, 0));
QCOMPARE(leftTouchPoint.pressure(), qreal(1.)); QCOMPARE(leftTouchPoint.pressure(), qreal(1.));
QTouchEvent::TouchPoint rightTouchPoint = leftWidget.touchBeginPoints.at(1); QTouchEvent::TouchPoint rightTouchPoint = leftWidget.touchBeginPoints.at(1);
@ -1197,9 +1207,10 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchPad()
QCOMPARE(rightTouchPoint.normalizedPos(), rawTouchPoints[1].normalizedPos()); QCOMPARE(rightTouchPoint.normalizedPos(), rawTouchPoints[1].normalizedPos());
QCOMPARE(rightTouchPoint.startNormalizedPos(), rawTouchPoints[1].normalizedPos()); QCOMPARE(rightTouchPoint.startNormalizedPos(), rawTouchPoints[1].normalizedPos());
QCOMPARE(rightTouchPoint.lastNormalizedPos(), rawTouchPoints[1].normalizedPos()); QCOMPARE(rightTouchPoint.lastNormalizedPos(), rawTouchPoints[1].normalizedPos());
QCOMPARE(rightTouchPoint.rect(), QRectF(leftWidget.mapFromGlobal(rightScreenPos.toPoint()), QSizeF(0, 0))); QCOMPARE(rightTouchPoint.pos(), rightWidget.mapFromParent(rightScreenPos.toPoint()));
QCOMPARE(rightTouchPoint.sceneRect(), QRectF(rightScreenPos, QSizeF(0, 0))); QCOMPARE(rightTouchPoint.scenePos(), rightScreenPos);
QCOMPARE(rightTouchPoint.screenRect(), QRectF(rightScreenPos, QSizeF(0, 0))); QCOMPARE(rightTouchPoint.screenPos(), rightScreenPos);
QCOMPARE(rightTouchPoint.ellipseDiameters(), QSizeF(0, 0));
QCOMPARE(rightTouchPoint.pressure(), qreal(1.)); QCOMPARE(rightTouchPoint.pressure(), qreal(1.));
} }
@ -1241,9 +1252,10 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchPad()
QCOMPARE(leftTouchPoint.normalizedPos(), rawTouchPoints[0].normalizedPos()); QCOMPARE(leftTouchPoint.normalizedPos(), rawTouchPoints[0].normalizedPos());
QCOMPARE(leftTouchPoint.startNormalizedPos(), rawTouchPoints[0].normalizedPos()); QCOMPARE(leftTouchPoint.startNormalizedPos(), rawTouchPoints[0].normalizedPos());
QCOMPARE(leftTouchPoint.lastNormalizedPos(), rawTouchPoints[0].normalizedPos()); QCOMPARE(leftTouchPoint.lastNormalizedPos(), rawTouchPoints[0].normalizedPos());
QCOMPARE(leftTouchPoint.rect(), QRectF(leftWidget.mapFromParent(centerPos.toPoint()), QSizeF(0, 0))); QCOMPARE(leftTouchPoint.pos(), leftWidget.mapFromParent(centerPos.toPoint()));
QCOMPARE(leftTouchPoint.sceneRect(), QRectF(centerScreenPos, QSizeF(0, 0))); QCOMPARE(leftTouchPoint.scenePos(), centerScreenPos);
QCOMPARE(leftTouchPoint.screenRect(), QRectF(centerScreenPos, QSizeF(0, 0))); QCOMPARE(leftTouchPoint.screenPos(), centerScreenPos);
QCOMPARE(leftTouchPoint.ellipseDiameters(), QSizeF(0, 0));
QCOMPARE(leftTouchPoint.pressure(), qreal(1.)); QCOMPARE(leftTouchPoint.pressure(), qreal(1.));
QTouchEvent::TouchPoint rightTouchPoint = leftWidget.touchUpdatePoints.at(1); QTouchEvent::TouchPoint rightTouchPoint = leftWidget.touchUpdatePoints.at(1);
@ -1261,9 +1273,10 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchPad()
QCOMPARE(rightTouchPoint.normalizedPos(), rawTouchPoints[1].normalizedPos()); QCOMPARE(rightTouchPoint.normalizedPos(), rawTouchPoints[1].normalizedPos());
QCOMPARE(rightTouchPoint.startNormalizedPos(), rawTouchPoints[1].normalizedPos()); QCOMPARE(rightTouchPoint.startNormalizedPos(), rawTouchPoints[1].normalizedPos());
QCOMPARE(rightTouchPoint.lastNormalizedPos(), rawTouchPoints[1].normalizedPos()); QCOMPARE(rightTouchPoint.lastNormalizedPos(), rawTouchPoints[1].normalizedPos());
QCOMPARE(rightTouchPoint.rect(), QRectF(leftWidget.mapFromParent(centerPos.toPoint()), QSizeF(0, 0))); QCOMPARE(rightTouchPoint.pos(), leftWidget.mapFromParent(centerPos.toPoint()));
QCOMPARE(rightTouchPoint.sceneRect(), QRectF(centerScreenPos, QSizeF(0, 0))); QCOMPARE(rightTouchPoint.scenePos(), centerScreenPos);
QCOMPARE(rightTouchPoint.screenRect(), QRectF(centerScreenPos, QSizeF(0, 0))); QCOMPARE(rightTouchPoint.screenPos(), centerScreenPos);
QCOMPARE(rightTouchPoint.ellipseDiameters(), QSizeF(0, 0));
QCOMPARE(rightTouchPoint.pressure(), qreal(1.)); QCOMPARE(rightTouchPoint.pressure(), qreal(1.));
} }
@ -1305,9 +1318,10 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchPad()
QCOMPARE(leftTouchPoint.normalizedPos(), rawTouchPoints[0].normalizedPos()); QCOMPARE(leftTouchPoint.normalizedPos(), rawTouchPoints[0].normalizedPos());
QCOMPARE(leftTouchPoint.startNormalizedPos(), rawTouchPoints[0].normalizedPos()); QCOMPARE(leftTouchPoint.startNormalizedPos(), rawTouchPoints[0].normalizedPos());
QCOMPARE(leftTouchPoint.lastNormalizedPos(), rawTouchPoints[0].normalizedPos()); QCOMPARE(leftTouchPoint.lastNormalizedPos(), rawTouchPoints[0].normalizedPos());
QCOMPARE(leftTouchPoint.rect(), QRectF(leftWidget.mapFromParent(centerPos.toPoint()), QSizeF(0, 0))); QCOMPARE(leftTouchPoint.pos(), leftWidget.mapFromParent(centerPos.toPoint()));
QCOMPARE(leftTouchPoint.sceneRect(), QRectF(centerScreenPos, QSizeF(0, 0))); QCOMPARE(leftTouchPoint.scenePos(), centerScreenPos);
QCOMPARE(leftTouchPoint.screenRect(), QRectF(centerScreenPos, QSizeF(0, 0))); QCOMPARE(leftTouchPoint.screenPos(), centerScreenPos);
QCOMPARE(leftTouchPoint.ellipseDiameters(), QSizeF(0, 0));
QCOMPARE(leftTouchPoint.pressure(), qreal(0.)); QCOMPARE(leftTouchPoint.pressure(), qreal(0.));
QTouchEvent::TouchPoint rightTouchPoint = leftWidget.touchEndPoints.at(1); QTouchEvent::TouchPoint rightTouchPoint = leftWidget.touchEndPoints.at(1);
@ -1325,9 +1339,10 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchPad()
QCOMPARE(rightTouchPoint.normalizedPos(), rawTouchPoints[1].normalizedPos()); QCOMPARE(rightTouchPoint.normalizedPos(), rawTouchPoints[1].normalizedPos());
QCOMPARE(rightTouchPoint.startNormalizedPos(), rawTouchPoints[1].normalizedPos()); QCOMPARE(rightTouchPoint.startNormalizedPos(), rawTouchPoints[1].normalizedPos());
QCOMPARE(rightTouchPoint.lastNormalizedPos(), rawTouchPoints[1].normalizedPos()); QCOMPARE(rightTouchPoint.lastNormalizedPos(), rawTouchPoints[1].normalizedPos());
QCOMPARE(rightTouchPoint.rect(), QRectF(leftWidget.mapFromParent(centerPos.toPoint()), QSizeF(0, 0))); QCOMPARE(rightTouchPoint.pos(), leftWidget.mapFromParent(centerPos.toPoint()));
QCOMPARE(rightTouchPoint.sceneRect(), QRectF(centerScreenPos, QSizeF(0, 0))); QCOMPARE(rightTouchPoint.scenePos(), centerScreenPos);
QCOMPARE(rightTouchPoint.screenRect(), QRectF(centerScreenPos, QSizeF(0, 0))); QCOMPARE(rightTouchPoint.screenPos(), centerScreenPos);
QCOMPARE(rightTouchPoint.ellipseDiameters(), QSizeF(0, 0));
QCOMPARE(rightTouchPoint.pressure(), qreal(0.)); QCOMPARE(rightTouchPoint.pressure(), qreal(0.));
} }
} }
@ -1858,13 +1873,13 @@ void tst_QTouchEvent::testMultiDevice()
tp.id = 0; tp.id = 0;
tp.state = Qt::TouchPointPressed; tp.state = Qt::TouchPointPressed;
const QPoint screenOrigin = w.screen()->geometry().topLeft(); const QPoint screenOrigin = w.screen()->geometry().topLeft();
const QRect area0(120, 120, 20, 20); const QRectF area0(120, 120, 20, 20);
tp.area = QHighDpi::toNative(area0, QHighDpiScaling::factor(&w), screenOrigin); tp.area = QHighDpi::toNative(area0, QHighDpiScaling::factor(&w), screenOrigin);
pointsOne.append(tp); pointsOne.append(tp);
pointsTwo.append(tp); pointsTwo.append(tp);
tp.id = 1; tp.id = 1;
const QRect area1(140, 140, 20, 20); const QRectF area1(140, 140, 20, 20);
tp.area = QHighDpi::toNative(area1, QHighDpiScaling::factor(&w), screenOrigin); tp.area = QHighDpi::toNative(area1, QHighDpiScaling::factor(&w), screenOrigin);
pointsTwo.append(tp); pointsTwo.append(tp);
@ -1880,12 +1895,14 @@ void tst_QTouchEvent::testMultiDevice()
QCOMPARE(filter.d.value(touchScreenDevice).points.count(), 1); QCOMPARE(filter.d.value(touchScreenDevice).points.count(), 1);
QCOMPARE(filter.d.value(deviceTwo).points.count(), 2); QCOMPARE(filter.d.value(deviceTwo).points.count(), 2);
QCOMPARE(filter.d.value(touchScreenDevice).points.at(0).screenRect(), QRectF(area0)); QCOMPARE(filter.d.value(touchScreenDevice).points.at(0).screenPos(), area0.center());
QCOMPARE(filter.d.value(touchScreenDevice).points.at(0).ellipseDiameters(), area0.size());
QCOMPARE(filter.d.value(touchScreenDevice).points.at(0).state(), pointsOne[0].state); QCOMPARE(filter.d.value(touchScreenDevice).points.at(0).state(), pointsOne[0].state);
QCOMPARE(filter.d.value(deviceTwo).points.at(0).screenRect(), QRectF(area0)); QCOMPARE(filter.d.value(deviceTwo).points.at(0).screenPos(), area0.center());
QCOMPARE(filter.d.value(deviceTwo).points.at(0).ellipseDiameters(), area0.size());
QCOMPARE(filter.d.value(deviceTwo).points.at(0).state(), pointsTwo[0].state); QCOMPARE(filter.d.value(deviceTwo).points.at(0).state(), pointsTwo[0].state);
QCOMPARE(filter.d.value(deviceTwo).points.at(1).screenRect(), QRectF(area1)); QCOMPARE(filter.d.value(deviceTwo).points.at(1).screenPos(), area1.center());
QCOMPARE(filter.d.value(deviceTwo).points.at(1).state(), pointsTwo[1].state); QCOMPARE(filter.d.value(deviceTwo).points.at(1).state(), pointsTwo[1].state);
} }

View File

@ -6,10 +6,3 @@ INCLUDEPATH += $$QNETWORK_SRC
win32: QMAKE_USE += ws2_32 win32: QMAKE_USE += ws2_32
unix:qtConfig(reduce_exports) {
SOURCES += $$QNETWORK_SRC/socket/qnativesocketengine_unix.cpp
SOURCES += $$QNETWORK_SRC/socket/qnativesocketengine.cpp
HEADERS += $$QNETWORK_SRC/socket/qnativesocketengine_p.h
SOURCES += $$QNETWORK_SRC/socket/qabstractsocketengine.cpp
HEADERS += $$QNETWORK_SRC/socket/qabstractsocketengine_p.h
}