Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/5.6' into 5.7
Browse files Browse the repository at this point in the history
Change-Id: I13c7ea6a74eb98606cf45702ae068101943bec6a
  • Loading branch information
Simon Hausmann committed Mar 24, 2016
2 parents 4ed048d + 6cacd19 commit 487844f
Show file tree
Hide file tree
Showing 23 changed files with 251 additions and 144 deletions.
6 changes: 3 additions & 3 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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"
;;
*)
Expand Down
2 changes: 2 additions & 0 deletions mkspecs/features/winrt/default_pre.prf
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@
QMAKE_LIBS = ucrt.lib $$QMAKE_LIBS
}

equals(TEMPLATE, "vcapp"): CONFIG += windeployqt

load(default_pre)
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ public boolean super_onKeyMultiple(int keyCode, int repeatCount, KeyEvent event)
@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);
Expand Down
1 change: 1 addition & 0 deletions src/corelib/io/qwindowspipewriter_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ class Q_CORE_EXPORT QWindowsPipeWriter : public QObject
qint64 write(const char *data, qint64 maxlen);
void stop();
bool waitForWrite(int msecs);
bool isWriteOperationActive() const { return writeSequenceStarted; }
qint64 bytesToWrite() const;

Q_SIGNALS:
Expand Down
2 changes: 1 addition & 1 deletion src/corelib/tools/qbytearray.h
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ class Q_CORE_EXPORT QByteArray
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;
Expand Down
16 changes: 8 additions & 8 deletions src/gui/text/qrawfont.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/network/socket/qlocalserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
*/
Expand Down
2 changes: 1 addition & 1 deletion src/network/socket/qlocalsocket.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class Q_NETWORK_EXPORT QLocalSocket : public QIODevice
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
Expand Down
5 changes: 4 additions & 1 deletion src/network/socket/qlocalsocket_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -129,10 +130,12 @@ class QLocalSocketPrivate : public QIODevicePrivate
~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;
Expand Down
48 changes: 36 additions & 12 deletions src/network/socket/qlocalsocket_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -230,6 +236,7 @@ void QLocalSocket::abort()
if (d->pipeWriter) {
delete d->pipeWriter;
d->pipeWriter = 0;
d->writeBuffer.clear();
}
close();
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand All @@ -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 {
Expand Down Expand Up @@ -351,11 +362,24 @@ bool QLocalSocket::setSocketDescriptor(qintptr socketDescriptor,
return true;
}

void QLocalSocketPrivate::_q_canWrite()
void QLocalSocketPrivate::startNextWrite()
{
Q_Q(QLocalSocket);
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);
if (state == QLocalSocket::ClosingState)
q->close();
writeBuffer.free(bytes);
startNextWrite();
emit q->bytesWritten(bytes);
}

qintptr QLocalSocket::socketDescriptor() const
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/platforms/minimal/minimal.pro
Original file line number Diff line number Diff line change
Expand Up @@ -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 = -
Expand Down
25 changes: 19 additions & 6 deletions src/plugins/platforms/minimal/qminimalintegration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -68,7 +75,7 @@ static inline unsigned parseOptions(const QStringList &paramList)
}

QMinimalIntegration::QMinimalIntegration(const QStringList &parameters)
: m_dummyFontDatabase(0)
: m_fontDatabase(0)
, m_options(parseOptions(parameters))
{
if (qEnvironmentVariableIsSet(debugBackingStoreEnvironmentVariable)
Expand All @@ -87,7 +94,7 @@ QMinimalIntegration::QMinimalIntegration(const QStringList &parameters)

QMinimalIntegration::~QMinimalIntegration()
{
delete m_dummyFontDatabase;
delete m_fontDatabase;
}

bool QMinimalIntegration::hasCapability(QPlatformIntegration::Capability cap) const
Expand All @@ -110,11 +117,17 @@ class DummyFontDatabase : public QPlatformFontDatabase

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
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/platforms/minimal/qminimalintegration.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class QMinimalIntegration : public QPlatformIntegration
static QMinimalIntegration *instance();

private:
mutable QPlatformFontDatabase *m_dummyFontDatabase;
mutable QPlatformFontDatabase *m_fontDatabase;
unsigned m_options;
};

Expand Down
9 changes: 9 additions & 0 deletions src/widgets/itemviews/qabstractitemview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand All @@ -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);
}
}

Expand Down
24 changes: 19 additions & 5 deletions src/widgets/kernel/qwidgetwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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;
Expand All @@ -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);
Expand Down
8 changes: 1 addition & 7 deletions src/widgets/styles/qfusionstyle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/widgets/widgets/qtextbrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
Expand Down
2 changes: 1 addition & 1 deletion tests/auto/auto.pro
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit 487844f

Please sign in to comment.