Merge remote-tracking branch 'origin/5.6' into 5.7
Change-Id: I13c7ea6a74eb98606cf45702ae068101943bec6a
This commit is contained in:
commit
487844fc62
6
configure
vendored
6
configure
vendored
@ -3945,8 +3945,8 @@ if true; then ###[ '!' -f "$outpath/bin/qmake" ];
|
||||
fi
|
||||
case `basename "$PLATFORM"` in
|
||||
win32-g++*)
|
||||
EXTRA_CFLAGS="-DUNICODE"
|
||||
EXTRA_CXXFLAGS="-DUNICODE"
|
||||
EXTRA_CFLAGS="$EXTRA_CFLAGS -DUNICODE"
|
||||
EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS -DUNICODE"
|
||||
EXTRA_OBJS="qfilesystemengine_win.o \
|
||||
qfilesystemiterator_win.o \
|
||||
qfsfileengine_win.o \
|
||||
@ -3961,7 +3961,7 @@ if true; then ###[ '!' -f "$outpath/bin/qmake" ];
|
||||
\"\$(SOURCE_PATH)/src/corelib/tools/qlocale_win.cpp\" \
|
||||
\"\$(SOURCE_PATH)/src/corelib/plugin/qsystemlibrary.cpp\" \
|
||||
\"\$(SOURCE_PATH)/tools/shared/windows/registry.cpp\""
|
||||
EXTRA_LFLAGS="-static -s -lole32 -luuid -ladvapi32 -lkernel32"
|
||||
EXTRA_LFLAGS="$EXTRA_LFLAGS -static -s -lole32 -luuid -ladvapi32 -lkernel32"
|
||||
EXEEXT=".exe"
|
||||
;;
|
||||
*)
|
||||
|
@ -9,4 +9,6 @@
|
||||
QMAKE_LIBS = ucrt.lib $$QMAKE_LIBS
|
||||
}
|
||||
|
||||
equals(TEMPLATE, "vcapp"): CONFIG += windeployqt
|
||||
|
||||
load(default_pre)
|
||||
|
@ -399,7 +399,7 @@ public class QtActivity extends Activity
|
||||
@Override
|
||||
public boolean onKeyUp(int keyCode, KeyEvent event)
|
||||
{
|
||||
if (QtApplication.m_delegateObject != null && QtApplication.onKeyDown != null)
|
||||
if (QtApplication.m_delegateObject != null && QtApplication.onKeyUp != null)
|
||||
return (Boolean) QtApplication.invokeDelegateMethod(QtApplication.onKeyUp, keyCode, event);
|
||||
else
|
||||
return super.onKeyUp(keyCode, event);
|
||||
|
@ -115,6 +115,7 @@ public:
|
||||
qint64 write(const char *data, qint64 maxlen);
|
||||
void stop();
|
||||
bool waitForWrite(int msecs);
|
||||
bool isWriteOperationActive() const { return writeSequenceStarted; }
|
||||
qint64 bytesToWrite() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
|
@ -337,7 +337,7 @@ public:
|
||||
QT_ASCII_CAST_WARN int indexOf(const QString &s, int from = 0) const;
|
||||
QT_ASCII_CAST_WARN int lastIndexOf(const QString &s, int from = -1) const;
|
||||
#endif
|
||||
#ifndef QT_NO_CAST_FROM_ASCII
|
||||
#if !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII)
|
||||
inline QT_ASCII_CAST_WARN bool operator==(const QString &s2) const;
|
||||
inline QT_ASCII_CAST_WARN bool operator!=(const QString &s2) const;
|
||||
inline QT_ASCII_CAST_WARN bool operator<(const QString &s2) const;
|
||||
|
@ -634,18 +634,18 @@ QList<QFontDatabase::WritingSystem> QRawFont::supportedWritingSystems() const
|
||||
if (d->isValid()) {
|
||||
QByteArray os2Table = fontTable("OS/2");
|
||||
if (os2Table.size() > 86) {
|
||||
char *data = os2Table.data();
|
||||
quint32 *bigEndianUnicodeRanges = reinterpret_cast<quint32 *>(data + 42);
|
||||
quint32 *bigEndianCodepageRanges = reinterpret_cast<quint32 *>(data + 78);
|
||||
const uchar * const data = reinterpret_cast<const uchar *>(os2Table.constData());
|
||||
const uchar * const bigEndianUnicodeRanges = data + 42;
|
||||
const uchar * const bigEndianCodepageRanges = data + 78;
|
||||
|
||||
quint32 unicodeRanges[4];
|
||||
quint32 codepageRanges[2];
|
||||
|
||||
for (int i=0; i<4; ++i) {
|
||||
if (i < 2)
|
||||
codepageRanges[i] = qFromBigEndian(bigEndianCodepageRanges[i]);
|
||||
unicodeRanges[i] = qFromBigEndian(bigEndianUnicodeRanges[i]);
|
||||
}
|
||||
for (size_t i = 0; i < sizeof unicodeRanges / sizeof *unicodeRanges; ++i)
|
||||
unicodeRanges[i] = qFromBigEndian<quint32>(bigEndianUnicodeRanges + i * sizeof(quint32));
|
||||
|
||||
for (size_t i = 0; i < sizeof codepageRanges / sizeof *codepageRanges; ++i)
|
||||
codepageRanges[i] = qFromBigEndian<quint32>(bigEndianCodepageRanges + i * sizeof(quint32));
|
||||
|
||||
QSupportedWritingSystems ws = QPlatformFontDatabase::writingSystemsFromTrueTypeBits(unicodeRanges, codepageRanges);
|
||||
for (int i = 0; i < QFontDatabase::WritingSystemsCount; ++i) {
|
||||
|
@ -184,7 +184,7 @@ QLocalServer::SocketOptions QLocalServer::socketOptions() const
|
||||
|
||||
/*!
|
||||
Stop listening for incoming connections. Existing connections are not
|
||||
effected, but any new connections will be refused.
|
||||
affected, but any new connections will be refused.
|
||||
|
||||
\sa isListening(), listen()
|
||||
*/
|
||||
|
@ -130,7 +130,7 @@ private:
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_stateChanged(QAbstractSocket::SocketState))
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_error(QAbstractSocket::SocketError))
|
||||
#elif defined(Q_OS_WIN)
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_canWrite())
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_bytesWritten(qint64))
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_pipeClosed())
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_winError(ulong, const QString &))
|
||||
#else
|
||||
|
@ -61,6 +61,7 @@
|
||||
#if defined(QT_LOCALSOCKET_TCP)
|
||||
# include "qtcpsocket.h"
|
||||
#elif defined(Q_OS_WIN)
|
||||
# include <private/qringbuffer_p.h>
|
||||
# include "private/qwindowspipereader_p.h"
|
||||
# include "private/qwindowspipewriter_p.h"
|
||||
# include <qwineventnotifier.h>
|
||||
@ -129,10 +130,12 @@ public:
|
||||
~QLocalSocketPrivate();
|
||||
void destroyPipeHandles();
|
||||
void setErrorString(const QString &function);
|
||||
void _q_canWrite();
|
||||
void startNextWrite();
|
||||
void _q_bytesWritten(qint64 bytes);
|
||||
void _q_pipeClosed();
|
||||
void _q_winError(ulong windowsError, const QString &function);
|
||||
HANDLE handle;
|
||||
QRingBuffer writeBuffer;
|
||||
QWindowsPipeWriter *pipeWriter;
|
||||
QWindowsPipeReader *pipeReader;
|
||||
QLocalSocket::LocalSocketError error;
|
||||
|
@ -213,15 +213,21 @@ qint64 QLocalSocket::readData(char *data, qint64 maxSize)
|
||||
}
|
||||
}
|
||||
|
||||
qint64 QLocalSocket::writeData(const char *data, qint64 maxSize)
|
||||
qint64 QLocalSocket::writeData(const char *data, qint64 len)
|
||||
{
|
||||
Q_D(QLocalSocket);
|
||||
if (len == 0)
|
||||
return 0;
|
||||
char *dest = d->writeBuffer.reserve(len);
|
||||
memcpy(dest, data, len);
|
||||
if (!d->pipeWriter) {
|
||||
d->pipeWriter = new QWindowsPipeWriter(d->handle, this);
|
||||
connect(d->pipeWriter, SIGNAL(canWrite()), this, SLOT(_q_canWrite()));
|
||||
connect(d->pipeWriter, SIGNAL(bytesWritten(qint64)), this, SIGNAL(bytesWritten(qint64)));
|
||||
QObjectPrivate::connect(d->pipeWriter, &QWindowsPipeWriter::bytesWritten,
|
||||
d, &QLocalSocketPrivate::_q_bytesWritten);
|
||||
}
|
||||
return d->pipeWriter->write(data, maxSize);
|
||||
if (!d->pipeWriter->isWriteOperationActive())
|
||||
d->startNextWrite();
|
||||
return len;
|
||||
}
|
||||
|
||||
void QLocalSocket::abort()
|
||||
@ -230,6 +236,7 @@ void QLocalSocket::abort()
|
||||
if (d->pipeWriter) {
|
||||
delete d->pipeWriter;
|
||||
d->pipeWriter = 0;
|
||||
d->writeBuffer.clear();
|
||||
}
|
||||
close();
|
||||
}
|
||||
@ -272,7 +279,7 @@ qint64 QLocalSocket::bytesAvailable() const
|
||||
qint64 QLocalSocket::bytesToWrite() const
|
||||
{
|
||||
Q_D(const QLocalSocket);
|
||||
return (d->pipeWriter) ? d->pipeWriter->bytesToWrite() : 0;
|
||||
return d->writeBuffer.size();
|
||||
}
|
||||
|
||||
bool QLocalSocket::canReadLine() const
|
||||
@ -304,9 +311,12 @@ void QLocalSocket::close()
|
||||
bool QLocalSocket::flush()
|
||||
{
|
||||
Q_D(QLocalSocket);
|
||||
if (d->pipeWriter)
|
||||
return d->pipeWriter->waitForWrite(0);
|
||||
return false;
|
||||
bool written = false;
|
||||
if (d->pipeWriter) {
|
||||
while (d->pipeWriter->waitForWrite(0))
|
||||
written = true;
|
||||
}
|
||||
return written;
|
||||
}
|
||||
|
||||
void QLocalSocket::disconnectFromServer()
|
||||
@ -319,10 +329,11 @@ void QLocalSocket::disconnectFromServer()
|
||||
// It must be destroyed before close() to prevent an infinite loop.
|
||||
delete d->pipeWriter;
|
||||
d->pipeWriter = 0;
|
||||
d->writeBuffer.clear();
|
||||
}
|
||||
|
||||
flush();
|
||||
if (d->pipeWriter && d->pipeWriter->bytesToWrite() != 0) {
|
||||
if (bytesToWrite() != 0) {
|
||||
d->state = QLocalSocket::ClosingState;
|
||||
emit stateChanged(d->state);
|
||||
} else {
|
||||
@ -351,11 +362,24 @@ bool QLocalSocket::setSocketDescriptor(qintptr socketDescriptor,
|
||||
return true;
|
||||
}
|
||||
|
||||
void QLocalSocketPrivate::_q_canWrite()
|
||||
void QLocalSocketPrivate::startNextWrite()
|
||||
{
|
||||
Q_Q(QLocalSocket);
|
||||
if (state == QLocalSocket::ClosingState)
|
||||
q->close();
|
||||
if (writeBuffer.isEmpty()) {
|
||||
if (state == QLocalSocket::ClosingState)
|
||||
q->close();
|
||||
} else {
|
||||
Q_ASSERT(pipeWriter);
|
||||
pipeWriter->write(writeBuffer.readPointer(), writeBuffer.nextDataBlockSize());
|
||||
}
|
||||
}
|
||||
|
||||
void QLocalSocketPrivate::_q_bytesWritten(qint64 bytes)
|
||||
{
|
||||
Q_Q(QLocalSocket);
|
||||
writeBuffer.free(bytes);
|
||||
startNextWrite();
|
||||
emit q->bytesWritten(bytes);
|
||||
}
|
||||
|
||||
qintptr QLocalSocket::socketDescriptor() const
|
||||
|
@ -10,6 +10,8 @@ HEADERS = qminimalintegration.h \
|
||||
|
||||
OTHER_FILES += minimal.json
|
||||
|
||||
CONFIG += qpa/genericunixfontdatabase
|
||||
|
||||
PLUGIN_TYPE = platforms
|
||||
PLUGIN_CLASS_NAME = QMinimalIntegrationPlugin
|
||||
!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = -
|
||||
|
@ -43,7 +43,14 @@
|
||||
#include <QtGui/private/qpixmap_raster_p.h>
|
||||
#include <QtGui/private/qguiapplication_p.h>
|
||||
#include <qpa/qplatformwindow.h>
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
#include <QtPlatformSupport/private/qbasicfontdatabase_p.h>
|
||||
#elif defined(QT_NO_FONTCONFIG)
|
||||
#include <qpa/qplatformfontdatabase.h>
|
||||
#else
|
||||
#include <QtPlatformSupport/private/qgenericunixfontdatabase_p.h>
|
||||
#endif
|
||||
|
||||
#if !defined(Q_OS_WIN)
|
||||
#include <QtPlatformSupport/private/qgenericunixeventdispatcher_p.h>
|
||||
@ -68,7 +75,7 @@ static inline unsigned parseOptions(const QStringList ¶mList)
|
||||
}
|
||||
|
||||
QMinimalIntegration::QMinimalIntegration(const QStringList ¶meters)
|
||||
: m_dummyFontDatabase(0)
|
||||
: m_fontDatabase(0)
|
||||
, m_options(parseOptions(parameters))
|
||||
{
|
||||
if (qEnvironmentVariableIsSet(debugBackingStoreEnvironmentVariable)
|
||||
@ -87,7 +94,7 @@ QMinimalIntegration::QMinimalIntegration(const QStringList ¶meters)
|
||||
|
||||
QMinimalIntegration::~QMinimalIntegration()
|
||||
{
|
||||
delete m_dummyFontDatabase;
|
||||
delete m_fontDatabase;
|
||||
}
|
||||
|
||||
bool QMinimalIntegration::hasCapability(QPlatformIntegration::Capability cap) const
|
||||
@ -110,11 +117,17 @@ public:
|
||||
|
||||
QPlatformFontDatabase *QMinimalIntegration::fontDatabase() const
|
||||
{
|
||||
if (m_options & EnableFonts)
|
||||
if (m_options & EnableFonts) {
|
||||
#ifndef QT_NO_FONTCONFIG
|
||||
if (!m_fontDatabase)
|
||||
m_fontDatabase = new QGenericUnixFontDatabase;
|
||||
#else
|
||||
return QPlatformIntegration::fontDatabase();
|
||||
if (!m_dummyFontDatabase)
|
||||
m_dummyFontDatabase = new DummyFontDatabase;
|
||||
return m_dummyFontDatabase;
|
||||
#endif
|
||||
}
|
||||
if (!m_fontDatabase)
|
||||
m_fontDatabase = new DummyFontDatabase;
|
||||
return m_fontDatabase;
|
||||
}
|
||||
|
||||
QPlatformWindow *QMinimalIntegration::createPlatformWindow(QWindow *window) const
|
||||
|
@ -85,7 +85,7 @@ public:
|
||||
static QMinimalIntegration *instance();
|
||||
|
||||
private:
|
||||
mutable QPlatformFontDatabase *m_dummyFontDatabase;
|
||||
mutable QPlatformFontDatabase *m_fontDatabase;
|
||||
unsigned m_options;
|
||||
};
|
||||
|
||||
|
@ -782,7 +782,13 @@ void QAbstractItemView::setSelectionModel(QItemSelectionModel *selectionModel)
|
||||
return;
|
||||
}
|
||||
|
||||
QItemSelection oldSelection;
|
||||
QModelIndex oldCurrentIndex;
|
||||
|
||||
if (d->selectionModel) {
|
||||
oldSelection = d->selectionModel->selection();
|
||||
oldCurrentIndex = d->selectionModel->currentIndex();
|
||||
|
||||
disconnect(d->selectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
|
||||
this, SLOT(selectionChanged(QItemSelection,QItemSelection)));
|
||||
disconnect(d->selectionModel, SIGNAL(currentChanged(QModelIndex,QModelIndex)),
|
||||
@ -796,6 +802,9 @@ void QAbstractItemView::setSelectionModel(QItemSelectionModel *selectionModel)
|
||||
this, SLOT(selectionChanged(QItemSelection,QItemSelection)));
|
||||
connect(d->selectionModel, SIGNAL(currentChanged(QModelIndex,QModelIndex)),
|
||||
this, SLOT(currentChanged(QModelIndex,QModelIndex)));
|
||||
|
||||
selectionChanged(d->selectionModel->selection(), oldSelection);
|
||||
currentChanged(d->selectionModel->currentIndex(), oldCurrentIndex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -162,11 +162,29 @@ QObject *QWidgetWindow::focusObject() const
|
||||
return widget;
|
||||
}
|
||||
|
||||
static inline bool shouldBePropagatedToWidget(QEvent *event)
|
||||
{
|
||||
switch (event->type()) {
|
||||
// Handing show events to widgets would cause them to be triggered twice
|
||||
case QEvent::Show:
|
||||
case QEvent::Hide:
|
||||
case QEvent::Timer:
|
||||
case QEvent::DynamicPropertyChange:
|
||||
case QEvent::ChildAdded:
|
||||
case QEvent::ChildRemoved:
|
||||
return false;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool QWidgetWindow::event(QEvent *event)
|
||||
{
|
||||
if (m_widget->testAttribute(Qt::WA_DontShowOnScreen)) {
|
||||
// \a event is uninteresting for QWidgetWindow, the event was probably
|
||||
// generated before WA_DontShowOnScreen was set
|
||||
if (!shouldBePropagatedToWidget(event))
|
||||
return true;
|
||||
return QCoreApplication::sendEvent(m_widget, event);
|
||||
}
|
||||
|
||||
@ -291,10 +309,6 @@ bool QWidgetWindow::event(QEvent *event)
|
||||
return true;
|
||||
#endif // QT_NO_CONTEXTMENU
|
||||
|
||||
// Handing show events to widgets (see below) here would cause them to be triggered twice
|
||||
case QEvent::Show:
|
||||
case QEvent::Hide:
|
||||
return QWindow::event(event);
|
||||
case QEvent::WindowBlocked:
|
||||
qt_button_down = 0;
|
||||
break;
|
||||
@ -309,7 +323,7 @@ bool QWidgetWindow::event(QEvent *event)
|
||||
break;
|
||||
}
|
||||
|
||||
if (QCoreApplication::sendEvent(m_widget, event) && event->type() != QEvent::Timer)
|
||||
if (shouldBePropagatedToWidget(event) && QCoreApplication::sendEvent(m_widget, event))
|
||||
return true;
|
||||
|
||||
return QWindow::event(event);
|
||||
|
@ -1538,13 +1538,7 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio
|
||||
QRect r = option->rect;
|
||||
painter->fillRect(r, highlight);
|
||||
painter->setPen(QPen(highlightOutline));
|
||||
const QLine lines[4] = {
|
||||
QLine(QPoint(r.left() + 1, r.bottom()), QPoint(r.right() - 1, r.bottom())),
|
||||
QLine(QPoint(r.left() + 1, r.top()), QPoint(r.right() - 1, r.top())),
|
||||
QLine(QPoint(r.left(), r.top()), QPoint(r.left(), r.bottom())),
|
||||
QLine(QPoint(r.right() , r.top()), QPoint(r.right(), r.bottom())),
|
||||
};
|
||||
painter->drawLines(lines, 4);
|
||||
painter->drawRect(QRectF(r).adjusted(0.5, 0.5, -0.5, -0.5));
|
||||
}
|
||||
bool checkable = menuItem->checkType != QStyleOptionMenuItem::NotCheckable;
|
||||
bool checked = menuItem->checked;
|
||||
|
@ -659,6 +659,7 @@ void QTextBrowserPrivate::init()
|
||||
#ifndef QT_NO_CURSOR
|
||||
viewport->setCursor(oldCursor);
|
||||
#endif
|
||||
q->setAttribute(Qt::WA_InputMethodEnabled, !q->isReadOnly());
|
||||
q->setUndoRedoEnabled(false);
|
||||
viewport->setMouseTracking(true);
|
||||
QObject::connect(q->document(), SIGNAL(contentsChanged()), q, SLOT(_q_documentModified()));
|
||||
|
@ -24,7 +24,7 @@ ios: SUBDIRS = corelib gui
|
||||
wince: SUBDIRS -= printsupport
|
||||
cross_compile: SUBDIRS -= tools cmake installed_cmake
|
||||
!qtHaveModule(opengl): SUBDIRS -= opengl
|
||||
!qtHaveModule(gui): SUBDIRS -= gui cmake
|
||||
!qtHaveModule(gui): SUBDIRS -= gui cmake installed_cmake
|
||||
!qtHaveModule(widgets): SUBDIRS -= widgets
|
||||
!qtHaveModule(printsupport): SUBDIRS -= printsupport
|
||||
!qtHaveModule(concurrent): SUBDIRS -= concurrent
|
||||
|
@ -174,9 +174,6 @@ private Q_SLOTS:
|
||||
void fetchAndSub_data() { addData(); }
|
||||
void fetchAndSub();
|
||||
|
||||
void addSub_data() { addData(); }
|
||||
void addSub();
|
||||
|
||||
void fetchAndOr_data() { addData(); }
|
||||
void fetchAndOr();
|
||||
|
||||
@ -656,96 +653,6 @@ void tst_QAtomicIntegerXX::fetchAndSub()
|
||||
}
|
||||
}
|
||||
|
||||
void tst_QAtomicIntegerXX::addSub()
|
||||
{
|
||||
QFETCH(LargeInt, value);
|
||||
QAtomicInteger<T> atomic(value);
|
||||
|
||||
// note: this test has undefined behavior for signed max and min
|
||||
T parcel1 = 42;
|
||||
T parcel2 = T(0-parcel1);
|
||||
T newValue1 = T(value) + parcel1;
|
||||
T newValue2 = T(value) - parcel1;
|
||||
|
||||
QCOMPARE(atomic.fetchAndAddRelaxed(parcel1), T(value));
|
||||
QCOMPARE(atomic.load(), newValue1);
|
||||
QCOMPARE(atomic.fetchAndSubRelaxed(parcel1), newValue1);
|
||||
QCOMPARE(atomic.load(), T(value));
|
||||
QCOMPARE(atomic.fetchAndSubRelaxed(parcel1), T(value));
|
||||
QCOMPARE(atomic.load(), newValue2);
|
||||
QCOMPARE(atomic.fetchAndAddRelaxed(parcel1), newValue2);
|
||||
QCOMPARE(atomic.load(), T(value));
|
||||
QCOMPARE(atomic.fetchAndAddRelaxed(parcel2), T(value));
|
||||
QCOMPARE(atomic.load(), newValue2);
|
||||
QCOMPARE(atomic.fetchAndSubRelaxed(parcel2), newValue2);
|
||||
QCOMPARE(atomic.load(), T(value));
|
||||
QCOMPARE(atomic.fetchAndSubRelaxed(parcel2), T(value));
|
||||
QCOMPARE(atomic.load(), newValue1);
|
||||
QCOMPARE(atomic.fetchAndAddRelaxed(parcel2), newValue1);
|
||||
QCOMPARE(atomic.load(), T(value));
|
||||
|
||||
QCOMPARE(atomic.fetchAndAddAcquire(parcel1), T(value));
|
||||
QCOMPARE(atomic.load(), newValue1);
|
||||
QCOMPARE(atomic.fetchAndSubAcquire(parcel1), newValue1);
|
||||
QCOMPARE(atomic.load(), T(value));
|
||||
QCOMPARE(atomic.fetchAndSubAcquire(parcel1), T(value));
|
||||
QCOMPARE(atomic.load(), newValue2);
|
||||
QCOMPARE(atomic.fetchAndAddAcquire(parcel1), newValue2);
|
||||
QCOMPARE(atomic.load(), T(value));
|
||||
QCOMPARE(atomic.fetchAndAddAcquire(parcel2), T(value));
|
||||
QCOMPARE(atomic.load(), newValue2);
|
||||
QCOMPARE(atomic.fetchAndSubAcquire(parcel2), newValue2);
|
||||
QCOMPARE(atomic.load(), T(value));
|
||||
QCOMPARE(atomic.fetchAndSubAcquire(parcel2), T(value));
|
||||
QCOMPARE(atomic.load(), newValue1);
|
||||
QCOMPARE(atomic.fetchAndAddAcquire(parcel2), newValue1);
|
||||
QCOMPARE(atomic.load(), T(value));
|
||||
|
||||
QCOMPARE(atomic.fetchAndAddRelease(parcel1), T(value));
|
||||
QCOMPARE(atomic.load(), newValue1);
|
||||
QCOMPARE(atomic.fetchAndSubRelease(parcel1), newValue1);
|
||||
QCOMPARE(atomic.load(), T(value));
|
||||
QCOMPARE(atomic.fetchAndSubRelease(parcel1), T(value));
|
||||
QCOMPARE(atomic.load(), newValue2);
|
||||
QCOMPARE(atomic.fetchAndAddRelease(parcel1), newValue2);
|
||||
QCOMPARE(atomic.load(), T(value));
|
||||
QCOMPARE(atomic.fetchAndAddRelease(parcel2), T(value));
|
||||
QCOMPARE(atomic.load(), newValue2);
|
||||
QCOMPARE(atomic.fetchAndSubRelease(parcel2), newValue2);
|
||||
QCOMPARE(atomic.load(), T(value));
|
||||
QCOMPARE(atomic.fetchAndSubRelease(parcel2), T(value));
|
||||
QCOMPARE(atomic.load(), newValue1);
|
||||
QCOMPARE(atomic.fetchAndAddRelease(parcel2), newValue1);
|
||||
QCOMPARE(atomic.load(), T(value));
|
||||
|
||||
QCOMPARE(atomic.fetchAndAddOrdered(parcel1), T(value));
|
||||
QCOMPARE(atomic.load(), newValue1);
|
||||
QCOMPARE(atomic.fetchAndSubOrdered(parcel1), newValue1);
|
||||
QCOMPARE(atomic.load(), T(value));
|
||||
QCOMPARE(atomic.fetchAndSubOrdered(parcel1), T(value));
|
||||
QCOMPARE(atomic.load(), newValue2);
|
||||
QCOMPARE(atomic.fetchAndAddOrdered(parcel1), newValue2);
|
||||
QCOMPARE(atomic.load(), T(value));
|
||||
QCOMPARE(atomic.fetchAndAddOrdered(parcel2), T(value));
|
||||
QCOMPARE(atomic.load(), newValue2);
|
||||
QCOMPARE(atomic.fetchAndSubOrdered(parcel2), newValue2);
|
||||
QCOMPARE(atomic.load(), T(value));
|
||||
QCOMPARE(atomic.fetchAndSubOrdered(parcel2), T(value));
|
||||
QCOMPARE(atomic.load(), newValue1);
|
||||
QCOMPARE(atomic.fetchAndAddOrdered(parcel2), newValue1);
|
||||
QCOMPARE(atomic.load(), T(value));
|
||||
|
||||
// operator+= and operator-=
|
||||
QCOMPARE(atomic += parcel1, newValue1);
|
||||
QCOMPARE(atomic -= parcel1, T(value));
|
||||
QCOMPARE(atomic -= parcel1, newValue2);
|
||||
QCOMPARE(atomic += parcel1, T(value));
|
||||
QCOMPARE(atomic += parcel2, newValue2);
|
||||
QCOMPARE(atomic -= parcel2, T(value));
|
||||
QCOMPARE(atomic -= parcel2, newValue1);
|
||||
QCOMPARE(atomic += parcel2, T(value));
|
||||
}
|
||||
|
||||
void tst_QAtomicIntegerXX::fetchAndOr()
|
||||
{
|
||||
QFETCH(LargeInt, value);
|
||||
|
@ -97,7 +97,10 @@ private slots:
|
||||
|
||||
void multiConnect();
|
||||
void writeOnlySocket();
|
||||
|
||||
void writeToClientAndDisconnect_data();
|
||||
void writeToClientAndDisconnect();
|
||||
|
||||
void debug();
|
||||
void bytesWrittenSignal();
|
||||
void syncDisconnectNotify();
|
||||
@ -1026,8 +1029,16 @@ void tst_QLocalSocket::writeOnlySocket()
|
||||
QCOMPARE(client.state(), QLocalSocket::ConnectedState);
|
||||
}
|
||||
|
||||
void tst_QLocalSocket::writeToClientAndDisconnect_data()
|
||||
{
|
||||
QTest::addColumn<int>("chunks");
|
||||
QTest::newRow("one chunk") << 1;
|
||||
QTest::newRow("several chunks") << 20;
|
||||
}
|
||||
|
||||
void tst_QLocalSocket::writeToClientAndDisconnect()
|
||||
{
|
||||
QFETCH(int, chunks);
|
||||
QLocalServer server;
|
||||
QLocalSocket client;
|
||||
QSignalSpy readChannelFinishedSpy(&client, SIGNAL(readChannelFinished()));
|
||||
@ -1041,14 +1052,17 @@ void tst_QLocalSocket::writeToClientAndDisconnect()
|
||||
|
||||
char buffer[100];
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
QCOMPARE(clientSocket->write(buffer, sizeof(buffer)), (qint64)sizeof(buffer));
|
||||
clientSocket->waitForBytesWritten();
|
||||
for (int i = 0; i < chunks; ++i)
|
||||
QCOMPARE(clientSocket->write(buffer, sizeof(buffer)), qint64(sizeof(buffer)));
|
||||
while (clientSocket->bytesToWrite())
|
||||
QVERIFY(clientSocket->waitForBytesWritten());
|
||||
clientSocket->close();
|
||||
server.close();
|
||||
|
||||
client.waitForDisconnected();
|
||||
QCOMPARE(readChannelFinishedSpy.count(), 1);
|
||||
QCOMPARE(client.read(buffer, sizeof(buffer)), (qint64)sizeof(buffer));
|
||||
const QByteArray received = client.readAll();
|
||||
QCOMPARE(received.size(), qint64(sizeof(buffer) * chunks));
|
||||
QCOMPARE(client.state(), QLocalSocket::UnconnectedState);
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,10 @@ SUBDIRS=\
|
||||
windowsmobile \
|
||||
toolsupport \
|
||||
|
||||
!qtHaveModule(gui): SUBDIRS -= \
|
||||
qcomplextext \
|
||||
qprocess_and_guieventloop \
|
||||
|
||||
!qtHaveModule(widgets): SUBDIRS -= \
|
||||
gestures \
|
||||
lancelot \
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include <qabstractitemview.h>
|
||||
#include <qstandarditemmodel.h>
|
||||
#include <qapplication.h>
|
||||
#include <qevent.h>
|
||||
#include <qlistview.h>
|
||||
#include <qlistwidget.h>
|
||||
#include <qtableview.h>
|
||||
@ -248,6 +249,8 @@ private slots:
|
||||
void shiftSelectionAfterChangingModelContents();
|
||||
void QTBUG48968_reentrant_updateEditorGeometries();
|
||||
void QTBUG50102_SH_ItemView_ScrollMode();
|
||||
void QTBUG50535_update_on_new_selection_model();
|
||||
void testSelectionModelInSyncWithView();
|
||||
};
|
||||
|
||||
class MyAbstractItemDelegate : public QAbstractItemDelegate
|
||||
@ -2067,6 +2070,111 @@ void tst_QAbstractItemView::QTBUG50102_SH_ItemView_ScrollMode()
|
||||
QCOMPARE(view.horizontalScrollMode(), styleScrollMode);
|
||||
}
|
||||
|
||||
void tst_QAbstractItemView::QTBUG50535_update_on_new_selection_model()
|
||||
{
|
||||
QStandardItemModel model;
|
||||
for (int i = 0; i < 10; ++i)
|
||||
model.appendRow(new QStandardItem(QStringLiteral("%1").arg(i)));
|
||||
|
||||
class ListView : public QListView
|
||||
{
|
||||
public:
|
||||
ListView()
|
||||
: m_paintEventsCount(0)
|
||||
{
|
||||
}
|
||||
|
||||
int m_paintEventsCount;
|
||||
|
||||
protected:
|
||||
bool viewportEvent(QEvent *event) Q_DECL_OVERRIDE
|
||||
{
|
||||
if (event->type() == QEvent::Paint)
|
||||
++m_paintEventsCount;
|
||||
return QListView::viewportEvent(event);
|
||||
}
|
||||
};
|
||||
|
||||
// keep the current/selected row in the "low range", i.e. be sure it's visible, otherwise we
|
||||
// don't get updates and the test fails.
|
||||
|
||||
ListView view;
|
||||
view.setModel(&model);
|
||||
view.selectionModel()->setCurrentIndex(model.index(1, 0), QItemSelectionModel::SelectCurrent);
|
||||
view.show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&view));
|
||||
|
||||
|
||||
QItemSelectionModel selectionModel(&model);
|
||||
selectionModel.setCurrentIndex(model.index(2, 0), QItemSelectionModel::Current);
|
||||
|
||||
int oldPaintEventsCount = view.m_paintEventsCount;
|
||||
view.setSelectionModel(&selectionModel);
|
||||
QTRY_VERIFY(view.m_paintEventsCount > oldPaintEventsCount);
|
||||
|
||||
|
||||
QItemSelectionModel selectionModel2(&model);
|
||||
selectionModel2.select(model.index(0, 0), QItemSelectionModel::ClearAndSelect);
|
||||
selectionModel2.setCurrentIndex(model.index(1, 0), QItemSelectionModel::Current);
|
||||
|
||||
oldPaintEventsCount = view.m_paintEventsCount;
|
||||
view.setSelectionModel(&selectionModel2);
|
||||
QTRY_VERIFY(view.m_paintEventsCount > oldPaintEventsCount);
|
||||
}
|
||||
|
||||
void tst_QAbstractItemView::testSelectionModelInSyncWithView()
|
||||
{
|
||||
QStandardItemModel model;
|
||||
for (int i = 0; i < 10; ++i)
|
||||
model.appendRow(new QStandardItem(QStringLiteral("%1").arg(i)));
|
||||
|
||||
class ListView : public QListView
|
||||
{
|
||||
public:
|
||||
using QListView::selectedIndexes;
|
||||
};
|
||||
|
||||
ListView view;
|
||||
QVERIFY(!view.selectionModel());
|
||||
|
||||
view.setModel(&model);
|
||||
QVERIFY(view.selectionModel());
|
||||
QVERIFY(view.selectedIndexes().isEmpty());
|
||||
QVERIFY(view.selectionModel()->selection().isEmpty());
|
||||
|
||||
view.setCurrentIndex(model.index(0, 0));
|
||||
QCOMPARE(view.currentIndex(), model.index(0, 0));
|
||||
QCOMPARE(view.selectionModel()->currentIndex(), model.index(0, 0));
|
||||
|
||||
view.selectionModel()->setCurrentIndex(model.index(1, 0), QItemSelectionModel::SelectCurrent);
|
||||
QCOMPARE(view.currentIndex(), model.index(1, 0));
|
||||
QCOMPARE(view.selectedIndexes(), QModelIndexList() << model.index(1, 0));
|
||||
QCOMPARE(view.selectionModel()->currentIndex(), model.index(1, 0));
|
||||
QCOMPARE(view.selectionModel()->selection().indexes(), QModelIndexList() << model.index(1, 0));
|
||||
|
||||
view.show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&view));
|
||||
|
||||
QItemSelectionModel selectionModel(&model);
|
||||
selectionModel.setCurrentIndex(model.index(2, 0), QItemSelectionModel::Current);
|
||||
|
||||
view.setSelectionModel(&selectionModel);
|
||||
QCOMPARE(view.currentIndex(), model.index(2, 0));
|
||||
QCOMPARE(view.selectedIndexes(), QModelIndexList());
|
||||
QCOMPARE(view.selectionModel()->currentIndex(), model.index(2, 0));
|
||||
QCOMPARE(view.selectionModel()->selection().indexes(), QModelIndexList());
|
||||
|
||||
|
||||
QItemSelectionModel selectionModel2(&model);
|
||||
selectionModel2.select(model.index(0, 0), QItemSelectionModel::ClearAndSelect);
|
||||
selectionModel2.setCurrentIndex(model.index(1, 0), QItemSelectionModel::Current);
|
||||
|
||||
view.setSelectionModel(&selectionModel2);
|
||||
QCOMPARE(view.currentIndex(), model.index(1, 0));
|
||||
QCOMPARE(view.selectedIndexes(), QModelIndexList() << model.index(0, 0));
|
||||
QCOMPARE(view.selectionModel()->currentIndex(), model.index(1, 0));
|
||||
QCOMPARE(view.selectionModel()->selection().indexes(), QModelIndexList() << model.index(0, 0));
|
||||
}
|
||||
|
||||
QTEST_MAIN(tst_QAbstractItemView)
|
||||
#include "tst_qabstractitemview.moc"
|
||||
|
@ -83,6 +83,7 @@ private slots:
|
||||
void clearHistory();
|
||||
void sourceInsideLoadResource();
|
||||
void textInteractionFlags_vs_readOnly();
|
||||
void inputMethodAttribute_vs_readOnly();
|
||||
void anchorsWithSelfBuiltHtml();
|
||||
void relativeNonLocalUrls();
|
||||
void adjacentAnchors();
|
||||
@ -438,6 +439,16 @@ void tst_QTextBrowser::textInteractionFlags_vs_readOnly()
|
||||
QCOMPARE(browser->textInteractionFlags(), Qt::TextBrowserInteraction);
|
||||
}
|
||||
|
||||
void tst_QTextBrowser::inputMethodAttribute_vs_readOnly()
|
||||
{
|
||||
QVERIFY(browser->isReadOnly());
|
||||
QVERIFY(!browser->testAttribute(Qt::WA_InputMethodEnabled));
|
||||
browser->setReadOnly(false);
|
||||
QVERIFY(browser->testAttribute(Qt::WA_InputMethodEnabled));
|
||||
browser->setReadOnly(true);
|
||||
QVERIFY(!browser->testAttribute(Qt::WA_InputMethodEnabled));
|
||||
}
|
||||
|
||||
void tst_QTextBrowser::anchorsWithSelfBuiltHtml()
|
||||
{
|
||||
browser->setHtml("<p>Hello <a href=\"#anchor\">Link</a>"
|
||||
|
Loading…
Reference in New Issue
Block a user