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
|
fi
|
||||||
case `basename "$PLATFORM"` in
|
case `basename "$PLATFORM"` in
|
||||||
win32-g++*)
|
win32-g++*)
|
||||||
EXTRA_CFLAGS="-DUNICODE"
|
EXTRA_CFLAGS="$EXTRA_CFLAGS -DUNICODE"
|
||||||
EXTRA_CXXFLAGS="-DUNICODE"
|
EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS -DUNICODE"
|
||||||
EXTRA_OBJS="qfilesystemengine_win.o \
|
EXTRA_OBJS="qfilesystemengine_win.o \
|
||||||
qfilesystemiterator_win.o \
|
qfilesystemiterator_win.o \
|
||||||
qfsfileengine_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/tools/qlocale_win.cpp\" \
|
||||||
\"\$(SOURCE_PATH)/src/corelib/plugin/qsystemlibrary.cpp\" \
|
\"\$(SOURCE_PATH)/src/corelib/plugin/qsystemlibrary.cpp\" \
|
||||||
\"\$(SOURCE_PATH)/tools/shared/windows/registry.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"
|
EXEEXT=".exe"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
@ -9,4 +9,6 @@
|
|||||||
QMAKE_LIBS = ucrt.lib $$QMAKE_LIBS
|
QMAKE_LIBS = ucrt.lib $$QMAKE_LIBS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
equals(TEMPLATE, "vcapp"): CONFIG += windeployqt
|
||||||
|
|
||||||
load(default_pre)
|
load(default_pre)
|
||||||
|
@ -399,7 +399,7 @@ public class QtActivity extends Activity
|
|||||||
@Override
|
@Override
|
||||||
public boolean onKeyUp(int keyCode, KeyEvent event)
|
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);
|
return (Boolean) QtApplication.invokeDelegateMethod(QtApplication.onKeyUp, keyCode, event);
|
||||||
else
|
else
|
||||||
return super.onKeyUp(keyCode, event);
|
return super.onKeyUp(keyCode, event);
|
||||||
|
@ -115,6 +115,7 @@ public:
|
|||||||
qint64 write(const char *data, qint64 maxlen);
|
qint64 write(const char *data, qint64 maxlen);
|
||||||
void stop();
|
void stop();
|
||||||
bool waitForWrite(int msecs);
|
bool waitForWrite(int msecs);
|
||||||
|
bool isWriteOperationActive() const { return writeSequenceStarted; }
|
||||||
qint64 bytesToWrite() const;
|
qint64 bytesToWrite() const;
|
||||||
|
|
||||||
Q_SIGNALS:
|
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 indexOf(const QString &s, int from = 0) const;
|
||||||
QT_ASCII_CAST_WARN int lastIndexOf(const QString &s, int from = -1) const;
|
QT_ASCII_CAST_WARN int lastIndexOf(const QString &s, int from = -1) const;
|
||||||
#endif
|
#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;
|
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()) {
|
if (d->isValid()) {
|
||||||
QByteArray os2Table = fontTable("OS/2");
|
QByteArray os2Table = fontTable("OS/2");
|
||||||
if (os2Table.size() > 86) {
|
if (os2Table.size() > 86) {
|
||||||
char *data = os2Table.data();
|
const uchar * const data = reinterpret_cast<const uchar *>(os2Table.constData());
|
||||||
quint32 *bigEndianUnicodeRanges = reinterpret_cast<quint32 *>(data + 42);
|
const uchar * const bigEndianUnicodeRanges = data + 42;
|
||||||
quint32 *bigEndianCodepageRanges = reinterpret_cast<quint32 *>(data + 78);
|
const uchar * const bigEndianCodepageRanges = data + 78;
|
||||||
|
|
||||||
quint32 unicodeRanges[4];
|
quint32 unicodeRanges[4];
|
||||||
quint32 codepageRanges[2];
|
quint32 codepageRanges[2];
|
||||||
|
|
||||||
for (int i=0; i<4; ++i) {
|
for (size_t i = 0; i < sizeof unicodeRanges / sizeof *unicodeRanges; ++i)
|
||||||
if (i < 2)
|
unicodeRanges[i] = qFromBigEndian<quint32>(bigEndianUnicodeRanges + i * sizeof(quint32));
|
||||||
codepageRanges[i] = qFromBigEndian(bigEndianCodepageRanges[i]);
|
|
||||||
unicodeRanges[i] = qFromBigEndian(bigEndianUnicodeRanges[i]);
|
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);
|
QSupportedWritingSystems ws = QPlatformFontDatabase::writingSystemsFromTrueTypeBits(unicodeRanges, codepageRanges);
|
||||||
for (int i = 0; i < QFontDatabase::WritingSystemsCount; ++i) {
|
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
|
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()
|
\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_stateChanged(QAbstractSocket::SocketState))
|
||||||
Q_PRIVATE_SLOT(d_func(), void _q_error(QAbstractSocket::SocketError))
|
Q_PRIVATE_SLOT(d_func(), void _q_error(QAbstractSocket::SocketError))
|
||||||
#elif defined(Q_OS_WIN)
|
#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_pipeClosed())
|
||||||
Q_PRIVATE_SLOT(d_func(), void _q_winError(ulong, const QString &))
|
Q_PRIVATE_SLOT(d_func(), void _q_winError(ulong, const QString &))
|
||||||
#else
|
#else
|
||||||
|
@ -61,6 +61,7 @@
|
|||||||
#if defined(QT_LOCALSOCKET_TCP)
|
#if defined(QT_LOCALSOCKET_TCP)
|
||||||
# include "qtcpsocket.h"
|
# include "qtcpsocket.h"
|
||||||
#elif defined(Q_OS_WIN)
|
#elif defined(Q_OS_WIN)
|
||||||
|
# include <private/qringbuffer_p.h>
|
||||||
# include "private/qwindowspipereader_p.h"
|
# include "private/qwindowspipereader_p.h"
|
||||||
# include "private/qwindowspipewriter_p.h"
|
# include "private/qwindowspipewriter_p.h"
|
||||||
# include <qwineventnotifier.h>
|
# include <qwineventnotifier.h>
|
||||||
@ -129,10 +130,12 @@ public:
|
|||||||
~QLocalSocketPrivate();
|
~QLocalSocketPrivate();
|
||||||
void destroyPipeHandles();
|
void destroyPipeHandles();
|
||||||
void setErrorString(const QString &function);
|
void setErrorString(const QString &function);
|
||||||
void _q_canWrite();
|
void startNextWrite();
|
||||||
|
void _q_bytesWritten(qint64 bytes);
|
||||||
void _q_pipeClosed();
|
void _q_pipeClosed();
|
||||||
void _q_winError(ulong windowsError, const QString &function);
|
void _q_winError(ulong windowsError, const QString &function);
|
||||||
HANDLE handle;
|
HANDLE handle;
|
||||||
|
QRingBuffer writeBuffer;
|
||||||
QWindowsPipeWriter *pipeWriter;
|
QWindowsPipeWriter *pipeWriter;
|
||||||
QWindowsPipeReader *pipeReader;
|
QWindowsPipeReader *pipeReader;
|
||||||
QLocalSocket::LocalSocketError error;
|
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);
|
Q_D(QLocalSocket);
|
||||||
|
if (len == 0)
|
||||||
|
return 0;
|
||||||
|
char *dest = d->writeBuffer.reserve(len);
|
||||||
|
memcpy(dest, data, len);
|
||||||
if (!d->pipeWriter) {
|
if (!d->pipeWriter) {
|
||||||
d->pipeWriter = new QWindowsPipeWriter(d->handle, this);
|
d->pipeWriter = new QWindowsPipeWriter(d->handle, this);
|
||||||
connect(d->pipeWriter, SIGNAL(canWrite()), this, SLOT(_q_canWrite()));
|
QObjectPrivate::connect(d->pipeWriter, &QWindowsPipeWriter::bytesWritten,
|
||||||
connect(d->pipeWriter, SIGNAL(bytesWritten(qint64)), this, SIGNAL(bytesWritten(qint64)));
|
d, &QLocalSocketPrivate::_q_bytesWritten);
|
||||||
}
|
}
|
||||||
return d->pipeWriter->write(data, maxSize);
|
if (!d->pipeWriter->isWriteOperationActive())
|
||||||
|
d->startNextWrite();
|
||||||
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QLocalSocket::abort()
|
void QLocalSocket::abort()
|
||||||
@ -230,6 +236,7 @@ void QLocalSocket::abort()
|
|||||||
if (d->pipeWriter) {
|
if (d->pipeWriter) {
|
||||||
delete d->pipeWriter;
|
delete d->pipeWriter;
|
||||||
d->pipeWriter = 0;
|
d->pipeWriter = 0;
|
||||||
|
d->writeBuffer.clear();
|
||||||
}
|
}
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
@ -272,7 +279,7 @@ qint64 QLocalSocket::bytesAvailable() const
|
|||||||
qint64 QLocalSocket::bytesToWrite() const
|
qint64 QLocalSocket::bytesToWrite() const
|
||||||
{
|
{
|
||||||
Q_D(const QLocalSocket);
|
Q_D(const QLocalSocket);
|
||||||
return (d->pipeWriter) ? d->pipeWriter->bytesToWrite() : 0;
|
return d->writeBuffer.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QLocalSocket::canReadLine() const
|
bool QLocalSocket::canReadLine() const
|
||||||
@ -304,9 +311,12 @@ void QLocalSocket::close()
|
|||||||
bool QLocalSocket::flush()
|
bool QLocalSocket::flush()
|
||||||
{
|
{
|
||||||
Q_D(QLocalSocket);
|
Q_D(QLocalSocket);
|
||||||
if (d->pipeWriter)
|
bool written = false;
|
||||||
return d->pipeWriter->waitForWrite(0);
|
if (d->pipeWriter) {
|
||||||
return false;
|
while (d->pipeWriter->waitForWrite(0))
|
||||||
|
written = true;
|
||||||
|
}
|
||||||
|
return written;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QLocalSocket::disconnectFromServer()
|
void QLocalSocket::disconnectFromServer()
|
||||||
@ -319,10 +329,11 @@ void QLocalSocket::disconnectFromServer()
|
|||||||
// It must be destroyed before close() to prevent an infinite loop.
|
// It must be destroyed before close() to prevent an infinite loop.
|
||||||
delete d->pipeWriter;
|
delete d->pipeWriter;
|
||||||
d->pipeWriter = 0;
|
d->pipeWriter = 0;
|
||||||
|
d->writeBuffer.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
flush();
|
flush();
|
||||||
if (d->pipeWriter && d->pipeWriter->bytesToWrite() != 0) {
|
if (bytesToWrite() != 0) {
|
||||||
d->state = QLocalSocket::ClosingState;
|
d->state = QLocalSocket::ClosingState;
|
||||||
emit stateChanged(d->state);
|
emit stateChanged(d->state);
|
||||||
} else {
|
} else {
|
||||||
@ -351,11 +362,24 @@ bool QLocalSocket::setSocketDescriptor(qintptr socketDescriptor,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QLocalSocketPrivate::_q_canWrite()
|
void QLocalSocketPrivate::startNextWrite()
|
||||||
{
|
{
|
||||||
Q_Q(QLocalSocket);
|
Q_Q(QLocalSocket);
|
||||||
if (state == QLocalSocket::ClosingState)
|
if (writeBuffer.isEmpty()) {
|
||||||
q->close();
|
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
|
qintptr QLocalSocket::socketDescriptor() const
|
||||||
|
@ -10,6 +10,8 @@ HEADERS = qminimalintegration.h \
|
|||||||
|
|
||||||
OTHER_FILES += minimal.json
|
OTHER_FILES += minimal.json
|
||||||
|
|
||||||
|
CONFIG += qpa/genericunixfontdatabase
|
||||||
|
|
||||||
PLUGIN_TYPE = platforms
|
PLUGIN_TYPE = platforms
|
||||||
PLUGIN_CLASS_NAME = QMinimalIntegrationPlugin
|
PLUGIN_CLASS_NAME = QMinimalIntegrationPlugin
|
||||||
!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = -
|
!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = -
|
||||||
|
@ -43,7 +43,14 @@
|
|||||||
#include <QtGui/private/qpixmap_raster_p.h>
|
#include <QtGui/private/qpixmap_raster_p.h>
|
||||||
#include <QtGui/private/qguiapplication_p.h>
|
#include <QtGui/private/qguiapplication_p.h>
|
||||||
#include <qpa/qplatformwindow.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>
|
#include <qpa/qplatformfontdatabase.h>
|
||||||
|
#else
|
||||||
|
#include <QtPlatformSupport/private/qgenericunixfontdatabase_p.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !defined(Q_OS_WIN)
|
#if !defined(Q_OS_WIN)
|
||||||
#include <QtPlatformSupport/private/qgenericunixeventdispatcher_p.h>
|
#include <QtPlatformSupport/private/qgenericunixeventdispatcher_p.h>
|
||||||
@ -68,7 +75,7 @@ static inline unsigned parseOptions(const QStringList ¶mList)
|
|||||||
}
|
}
|
||||||
|
|
||||||
QMinimalIntegration::QMinimalIntegration(const QStringList ¶meters)
|
QMinimalIntegration::QMinimalIntegration(const QStringList ¶meters)
|
||||||
: m_dummyFontDatabase(0)
|
: m_fontDatabase(0)
|
||||||
, m_options(parseOptions(parameters))
|
, m_options(parseOptions(parameters))
|
||||||
{
|
{
|
||||||
if (qEnvironmentVariableIsSet(debugBackingStoreEnvironmentVariable)
|
if (qEnvironmentVariableIsSet(debugBackingStoreEnvironmentVariable)
|
||||||
@ -87,7 +94,7 @@ QMinimalIntegration::QMinimalIntegration(const QStringList ¶meters)
|
|||||||
|
|
||||||
QMinimalIntegration::~QMinimalIntegration()
|
QMinimalIntegration::~QMinimalIntegration()
|
||||||
{
|
{
|
||||||
delete m_dummyFontDatabase;
|
delete m_fontDatabase;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QMinimalIntegration::hasCapability(QPlatformIntegration::Capability cap) const
|
bool QMinimalIntegration::hasCapability(QPlatformIntegration::Capability cap) const
|
||||||
@ -110,11 +117,17 @@ public:
|
|||||||
|
|
||||||
QPlatformFontDatabase *QMinimalIntegration::fontDatabase() const
|
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();
|
return QPlatformIntegration::fontDatabase();
|
||||||
if (!m_dummyFontDatabase)
|
#endif
|
||||||
m_dummyFontDatabase = new DummyFontDatabase;
|
}
|
||||||
return m_dummyFontDatabase;
|
if (!m_fontDatabase)
|
||||||
|
m_fontDatabase = new DummyFontDatabase;
|
||||||
|
return m_fontDatabase;
|
||||||
}
|
}
|
||||||
|
|
||||||
QPlatformWindow *QMinimalIntegration::createPlatformWindow(QWindow *window) const
|
QPlatformWindow *QMinimalIntegration::createPlatformWindow(QWindow *window) const
|
||||||
|
@ -85,7 +85,7 @@ public:
|
|||||||
static QMinimalIntegration *instance();
|
static QMinimalIntegration *instance();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
mutable QPlatformFontDatabase *m_dummyFontDatabase;
|
mutable QPlatformFontDatabase *m_fontDatabase;
|
||||||
unsigned m_options;
|
unsigned m_options;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -782,7 +782,13 @@ void QAbstractItemView::setSelectionModel(QItemSelectionModel *selectionModel)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QItemSelection oldSelection;
|
||||||
|
QModelIndex oldCurrentIndex;
|
||||||
|
|
||||||
if (d->selectionModel) {
|
if (d->selectionModel) {
|
||||||
|
oldSelection = d->selectionModel->selection();
|
||||||
|
oldCurrentIndex = d->selectionModel->currentIndex();
|
||||||
|
|
||||||
disconnect(d->selectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
|
disconnect(d->selectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
|
||||||
this, SLOT(selectionChanged(QItemSelection,QItemSelection)));
|
this, SLOT(selectionChanged(QItemSelection,QItemSelection)));
|
||||||
disconnect(d->selectionModel, SIGNAL(currentChanged(QModelIndex,QModelIndex)),
|
disconnect(d->selectionModel, SIGNAL(currentChanged(QModelIndex,QModelIndex)),
|
||||||
@ -796,6 +802,9 @@ void QAbstractItemView::setSelectionModel(QItemSelectionModel *selectionModel)
|
|||||||
this, SLOT(selectionChanged(QItemSelection,QItemSelection)));
|
this, SLOT(selectionChanged(QItemSelection,QItemSelection)));
|
||||||
connect(d->selectionModel, SIGNAL(currentChanged(QModelIndex,QModelIndex)),
|
connect(d->selectionModel, SIGNAL(currentChanged(QModelIndex,QModelIndex)),
|
||||||
this, SLOT(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;
|
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)
|
bool QWidgetWindow::event(QEvent *event)
|
||||||
{
|
{
|
||||||
if (m_widget->testAttribute(Qt::WA_DontShowOnScreen)) {
|
if (m_widget->testAttribute(Qt::WA_DontShowOnScreen)) {
|
||||||
// \a event is uninteresting for QWidgetWindow, the event was probably
|
// \a event is uninteresting for QWidgetWindow, the event was probably
|
||||||
// generated before WA_DontShowOnScreen was set
|
// generated before WA_DontShowOnScreen was set
|
||||||
|
if (!shouldBePropagatedToWidget(event))
|
||||||
|
return true;
|
||||||
return QCoreApplication::sendEvent(m_widget, event);
|
return QCoreApplication::sendEvent(m_widget, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -291,10 +309,6 @@ bool QWidgetWindow::event(QEvent *event)
|
|||||||
return true;
|
return true;
|
||||||
#endif // QT_NO_CONTEXTMENU
|
#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:
|
case QEvent::WindowBlocked:
|
||||||
qt_button_down = 0;
|
qt_button_down = 0;
|
||||||
break;
|
break;
|
||||||
@ -309,7 +323,7 @@ bool QWidgetWindow::event(QEvent *event)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (QCoreApplication::sendEvent(m_widget, event) && event->type() != QEvent::Timer)
|
if (shouldBePropagatedToWidget(event) && QCoreApplication::sendEvent(m_widget, event))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return QWindow::event(event);
|
return QWindow::event(event);
|
||||||
|
@ -1538,13 +1538,7 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio
|
|||||||
QRect r = option->rect;
|
QRect r = option->rect;
|
||||||
painter->fillRect(r, highlight);
|
painter->fillRect(r, highlight);
|
||||||
painter->setPen(QPen(highlightOutline));
|
painter->setPen(QPen(highlightOutline));
|
||||||
const QLine lines[4] = {
|
painter->drawRect(QRectF(r).adjusted(0.5, 0.5, -0.5, -0.5));
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
bool checkable = menuItem->checkType != QStyleOptionMenuItem::NotCheckable;
|
bool checkable = menuItem->checkType != QStyleOptionMenuItem::NotCheckable;
|
||||||
bool checked = menuItem->checked;
|
bool checked = menuItem->checked;
|
||||||
|
@ -659,6 +659,7 @@ void QTextBrowserPrivate::init()
|
|||||||
#ifndef QT_NO_CURSOR
|
#ifndef QT_NO_CURSOR
|
||||||
viewport->setCursor(oldCursor);
|
viewport->setCursor(oldCursor);
|
||||||
#endif
|
#endif
|
||||||
|
q->setAttribute(Qt::WA_InputMethodEnabled, !q->isReadOnly());
|
||||||
q->setUndoRedoEnabled(false);
|
q->setUndoRedoEnabled(false);
|
||||||
viewport->setMouseTracking(true);
|
viewport->setMouseTracking(true);
|
||||||
QObject::connect(q->document(), SIGNAL(contentsChanged()), q, SLOT(_q_documentModified()));
|
QObject::connect(q->document(), SIGNAL(contentsChanged()), q, SLOT(_q_documentModified()));
|
||||||
|
@ -24,7 +24,7 @@ ios: SUBDIRS = corelib gui
|
|||||||
wince: SUBDIRS -= printsupport
|
wince: SUBDIRS -= printsupport
|
||||||
cross_compile: SUBDIRS -= tools cmake installed_cmake
|
cross_compile: SUBDIRS -= tools cmake installed_cmake
|
||||||
!qtHaveModule(opengl): SUBDIRS -= opengl
|
!qtHaveModule(opengl): SUBDIRS -= opengl
|
||||||
!qtHaveModule(gui): SUBDIRS -= gui cmake
|
!qtHaveModule(gui): SUBDIRS -= gui cmake installed_cmake
|
||||||
!qtHaveModule(widgets): SUBDIRS -= widgets
|
!qtHaveModule(widgets): SUBDIRS -= widgets
|
||||||
!qtHaveModule(printsupport): SUBDIRS -= printsupport
|
!qtHaveModule(printsupport): SUBDIRS -= printsupport
|
||||||
!qtHaveModule(concurrent): SUBDIRS -= concurrent
|
!qtHaveModule(concurrent): SUBDIRS -= concurrent
|
||||||
|
@ -174,9 +174,6 @@ private Q_SLOTS:
|
|||||||
void fetchAndSub_data() { addData(); }
|
void fetchAndSub_data() { addData(); }
|
||||||
void fetchAndSub();
|
void fetchAndSub();
|
||||||
|
|
||||||
void addSub_data() { addData(); }
|
|
||||||
void addSub();
|
|
||||||
|
|
||||||
void fetchAndOr_data() { addData(); }
|
void fetchAndOr_data() { addData(); }
|
||||||
void fetchAndOr();
|
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()
|
void tst_QAtomicIntegerXX::fetchAndOr()
|
||||||
{
|
{
|
||||||
QFETCH(LargeInt, value);
|
QFETCH(LargeInt, value);
|
||||||
|
@ -97,7 +97,10 @@ private slots:
|
|||||||
|
|
||||||
void multiConnect();
|
void multiConnect();
|
||||||
void writeOnlySocket();
|
void writeOnlySocket();
|
||||||
|
|
||||||
|
void writeToClientAndDisconnect_data();
|
||||||
void writeToClientAndDisconnect();
|
void writeToClientAndDisconnect();
|
||||||
|
|
||||||
void debug();
|
void debug();
|
||||||
void bytesWrittenSignal();
|
void bytesWrittenSignal();
|
||||||
void syncDisconnectNotify();
|
void syncDisconnectNotify();
|
||||||
@ -1026,8 +1029,16 @@ void tst_QLocalSocket::writeOnlySocket()
|
|||||||
QCOMPARE(client.state(), QLocalSocket::ConnectedState);
|
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()
|
void tst_QLocalSocket::writeToClientAndDisconnect()
|
||||||
{
|
{
|
||||||
|
QFETCH(int, chunks);
|
||||||
QLocalServer server;
|
QLocalServer server;
|
||||||
QLocalSocket client;
|
QLocalSocket client;
|
||||||
QSignalSpy readChannelFinishedSpy(&client, SIGNAL(readChannelFinished()));
|
QSignalSpy readChannelFinishedSpy(&client, SIGNAL(readChannelFinished()));
|
||||||
@ -1041,14 +1052,17 @@ void tst_QLocalSocket::writeToClientAndDisconnect()
|
|||||||
|
|
||||||
char buffer[100];
|
char buffer[100];
|
||||||
memset(buffer, 0, sizeof(buffer));
|
memset(buffer, 0, sizeof(buffer));
|
||||||
QCOMPARE(clientSocket->write(buffer, sizeof(buffer)), (qint64)sizeof(buffer));
|
for (int i = 0; i < chunks; ++i)
|
||||||
clientSocket->waitForBytesWritten();
|
QCOMPARE(clientSocket->write(buffer, sizeof(buffer)), qint64(sizeof(buffer)));
|
||||||
|
while (clientSocket->bytesToWrite())
|
||||||
|
QVERIFY(clientSocket->waitForBytesWritten());
|
||||||
clientSocket->close();
|
clientSocket->close();
|
||||||
server.close();
|
server.close();
|
||||||
|
|
||||||
client.waitForDisconnected();
|
client.waitForDisconnected();
|
||||||
QCOMPARE(readChannelFinishedSpy.count(), 1);
|
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);
|
QCOMPARE(client.state(), QLocalSocket::UnconnectedState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,6 +24,10 @@ SUBDIRS=\
|
|||||||
windowsmobile \
|
windowsmobile \
|
||||||
toolsupport \
|
toolsupport \
|
||||||
|
|
||||||
|
!qtHaveModule(gui): SUBDIRS -= \
|
||||||
|
qcomplextext \
|
||||||
|
qprocess_and_guieventloop \
|
||||||
|
|
||||||
!qtHaveModule(widgets): SUBDIRS -= \
|
!qtHaveModule(widgets): SUBDIRS -= \
|
||||||
gestures \
|
gestures \
|
||||||
lancelot \
|
lancelot \
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include <qabstractitemview.h>
|
#include <qabstractitemview.h>
|
||||||
#include <qstandarditemmodel.h>
|
#include <qstandarditemmodel.h>
|
||||||
#include <qapplication.h>
|
#include <qapplication.h>
|
||||||
|
#include <qevent.h>
|
||||||
#include <qlistview.h>
|
#include <qlistview.h>
|
||||||
#include <qlistwidget.h>
|
#include <qlistwidget.h>
|
||||||
#include <qtableview.h>
|
#include <qtableview.h>
|
||||||
@ -248,6 +249,8 @@ private slots:
|
|||||||
void shiftSelectionAfterChangingModelContents();
|
void shiftSelectionAfterChangingModelContents();
|
||||||
void QTBUG48968_reentrant_updateEditorGeometries();
|
void QTBUG48968_reentrant_updateEditorGeometries();
|
||||||
void QTBUG50102_SH_ItemView_ScrollMode();
|
void QTBUG50102_SH_ItemView_ScrollMode();
|
||||||
|
void QTBUG50535_update_on_new_selection_model();
|
||||||
|
void testSelectionModelInSyncWithView();
|
||||||
};
|
};
|
||||||
|
|
||||||
class MyAbstractItemDelegate : public QAbstractItemDelegate
|
class MyAbstractItemDelegate : public QAbstractItemDelegate
|
||||||
@ -2067,6 +2070,111 @@ void tst_QAbstractItemView::QTBUG50102_SH_ItemView_ScrollMode()
|
|||||||
QCOMPARE(view.horizontalScrollMode(), styleScrollMode);
|
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)
|
QTEST_MAIN(tst_QAbstractItemView)
|
||||||
#include "tst_qabstractitemview.moc"
|
#include "tst_qabstractitemview.moc"
|
||||||
|
@ -83,6 +83,7 @@ private slots:
|
|||||||
void clearHistory();
|
void clearHistory();
|
||||||
void sourceInsideLoadResource();
|
void sourceInsideLoadResource();
|
||||||
void textInteractionFlags_vs_readOnly();
|
void textInteractionFlags_vs_readOnly();
|
||||||
|
void inputMethodAttribute_vs_readOnly();
|
||||||
void anchorsWithSelfBuiltHtml();
|
void anchorsWithSelfBuiltHtml();
|
||||||
void relativeNonLocalUrls();
|
void relativeNonLocalUrls();
|
||||||
void adjacentAnchors();
|
void adjacentAnchors();
|
||||||
@ -438,6 +439,16 @@ void tst_QTextBrowser::textInteractionFlags_vs_readOnly()
|
|||||||
QCOMPARE(browser->textInteractionFlags(), Qt::TextBrowserInteraction);
|
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()
|
void tst_QTextBrowser::anchorsWithSelfBuiltHtml()
|
||||||
{
|
{
|
||||||
browser->setHtml("<p>Hello <a href=\"#anchor\">Link</a>"
|
browser->setHtml("<p>Hello <a href=\"#anchor\">Link</a>"
|
||||||
|
Loading…
Reference in New Issue
Block a user