diff options
author | Sergio Ahumada <sergio.ahumada@digia.com> | 2013-07-24 15:09:38 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-07-24 15:09:38 +0200 |
commit | 509ed01c85c926387f6573dd1b5fe6611fa08118 (patch) | |
tree | cdc2b8a7df4c9778176a1e3341d018971f769daa /src | |
parent | 288e50227dd5af7cdaba7e4b54a61c539021f1e0 (diff) | |
parent | 084c5b3db794af1ce86b2b17455d9be5e64baebe (diff) |
Merge "Merge remote-tracking branch 'origin/stable' into dev" into refs/staging/dev
Diffstat (limited to 'src')
41 files changed, 266 insertions, 124 deletions
diff --git a/src/corelib/Qt5CoreMacros.cmake b/src/corelib/Qt5CoreMacros.cmake index b6124b40cd..f549fead59 100644 --- a/src/corelib/Qt5CoreMacros.cmake +++ b/src/corelib/Qt5CoreMacros.cmake @@ -244,6 +244,8 @@ if (NOT CMAKE_VERSION VERSION_LESS 2.8.9) set_property(TARGET ${_target} APPEND PROPERTY INCLUDE_DIRECTORIES ${Qt5${_module}_INCLUDE_DIRS}) set_property(TARGET ${_target} APPEND PROPERTY COMPILE_DEFINITIONS ${Qt5${_module}_COMPILE_DEFINITIONS}) set_property(TARGET ${_target} APPEND PROPERTY COMPILE_DEFINITIONS_RELEASE QT_NO_DEBUG) + set_property(TARGET ${_target} APPEND PROPERTY COMPILE_DEFINITIONS_RELWITHDEBINFO QT_NO_DEBUG) + set_property(TARGET ${_target} APPEND PROPERTY COMPILE_DEFINITIONS_MINSIZEREL QT_NO_DEBUG) if (Qt5_POSITION_INDEPENDENT_CODE) set_property(TARGET ${_target} PROPERTY POSITION_INDEPENDENT_CODE ${Qt5_POSITION_INDEPENDENT_CODE}) diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp index 4ed7b00e53..766e48358d 100644 --- a/src/corelib/codecs/qtextcodec.cpp +++ b/src/corelib/codecs/qtextcodec.cpp @@ -600,9 +600,6 @@ QTextCodec* QTextCodec::codecForMib(int mib) */ QList<QByteArray> QTextCodec::availableCodecs() { -#ifdef QT_USE_ICU - return QIcuCodec::availableCodecs(); -#else QMutexLocker locker(textCodecsMutex()); QCoreGlobalData *globalData = QCoreGlobalData::instance(); @@ -616,8 +613,11 @@ QList<QByteArray> QTextCodec::availableCodecs() codecs += globalData->allCodecs.at(i)->aliases(); } - return codecs; +#ifdef QT_USE_ICU + codecs += QIcuCodec::availableCodecs(); #endif + + return codecs; } /*! diff --git a/src/corelib/io/qlockfile_unix.cpp b/src/corelib/io/qlockfile_unix.cpp index db81d65565..1676b71133 100644 --- a/src/corelib/io/qlockfile_unix.cpp +++ b/src/corelib/io/qlockfile_unix.cpp @@ -86,8 +86,10 @@ int QLockFilePrivate::checkFcntlWorksAfterFlock() if (!file.open()) return 0; const int fd = file.d_func()->engine()->handle(); +#if defined(LOCK_EX) && defined(LOCK_NB) if (flock(fd, LOCK_EX | LOCK_NB) == -1) // other threads, and other processes on a local fs return 0; +#endif struct flock flockData; flockData.l_type = F_WRLCK; flockData.l_whence = SEEK_SET; @@ -121,8 +123,10 @@ static bool fcntlWorksAfterFlock() static bool setNativeLocks(int fd) { +#if defined(LOCK_EX) && defined(LOCK_NB) if (flock(fd, LOCK_EX | LOCK_NB) == -1) // other threads, and other processes on a local fs return false; +#endif struct flock flockData; flockData.l_type = F_WRLCK; flockData.l_whence = SEEK_SET; diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index b1861d8038..1be108d0a7 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -727,9 +727,11 @@ void QProcessPrivate::Channel::clear() \fn void QProcess::finished(int exitCode, QProcess::ExitStatus exitStatus) This signal is emitted when the process finishes. \a exitCode is the exit - code of the process, and \a exitStatus is the exit status. After the - process has finished, the buffers in QProcess are still intact. You can - still read any data that the process may have written before it finished. + code of the process (only valid for normal exits), and \a exitStatus is + the exit status. + After the process has finished, the buffers in QProcess are still intact. + You can still read any data that the process may have written before it + finished. \sa exitStatus() */ @@ -1959,7 +1961,7 @@ void QProcess::start(const QString &program, const QStringList &arguments, OpenM d->program = program; d->arguments = arguments; - open(mode); + d->start(mode); } /*! @@ -1975,7 +1977,17 @@ void QProcess::start(const QString &program, const QStringList &arguments, OpenM */ void QProcess::start(OpenMode mode) { - open(mode); + Q_D(QProcess); + if (d->processState != NotRunning) { + qWarning("QProcess::start: Process is already running"); + return; + } + if (d->program.isEmpty()) { + qWarning("QProcess::start: program not set"); + return; + } + + d->start(mode); } /*! @@ -2008,34 +2020,39 @@ bool QProcess::open(OpenMode mode) return false; } + d->start(mode); + return true; +} + +void QProcessPrivate::start(QIODevice::OpenMode mode) +{ + Q_Q(QProcess); #if defined QPROCESS_DEBUG qDebug() << "QProcess::start(" << program << ',' << arguments << ',' << mode << ')'; #endif - d->outputReadBuffer.clear(); - d->errorReadBuffer.clear(); + outputReadBuffer.clear(); + errorReadBuffer.clear(); - if (d->stdinChannel.type != QProcessPrivate::Channel::Normal) - mode &= ~WriteOnly; // not open for writing - if (d->stdoutChannel.type != QProcessPrivate::Channel::Normal && - (d->stderrChannel.type != QProcessPrivate::Channel::Normal || - d->processChannelMode == MergedChannels)) - mode &= ~ReadOnly; // not open for reading + if (stdinChannel.type != QProcessPrivate::Channel::Normal) + mode &= ~QIODevice::WriteOnly; // not open for writing + if (stdoutChannel.type != QProcessPrivate::Channel::Normal && + (stderrChannel.type != QProcessPrivate::Channel::Normal || + processChannelMode == QProcess::MergedChannels)) + mode &= ~QIODevice::ReadOnly; // not open for reading if (mode == 0) - mode = Unbuffered; - QIODevice::open(mode); - - d->stdinChannel.closed = false; - d->stdoutChannel.closed = false; - d->stderrChannel.closed = false; + mode = QIODevice::Unbuffered; + q->QIODevice::open(mode); - d->exitCode = 0; - d->exitStatus = NormalExit; - d->processError = QProcess::UnknownError; - d->errorString.clear(); - d->startProcess(); + stdinChannel.closed = false; + stdoutChannel.closed = false; + stderrChannel.closed = false; - return true; + exitCode = 0; + exitStatus = QProcess::NormalExit; + processError = QProcess::UnknownError; + errorString.clear(); + startProcess(); } @@ -2219,6 +2236,8 @@ void QProcess::kill() /*! Returns the exit code of the last process that finished. + + This value is not valid unless exitStatus() returns NormalExit. */ int QProcess::exitCode() const { diff --git a/src/corelib/io/qprocess_p.h b/src/corelib/io/qprocess_p.h index 2a2cc9fb84..e96cb42f94 100644 --- a/src/corelib/io/qprocess_p.h +++ b/src/corelib/io/qprocess_p.h @@ -346,6 +346,7 @@ public: QWinEventNotifier *processFinishedNotifier; #endif + void start(QIODevice::OpenMode mode); void startProcess(); #if defined(Q_OS_UNIX) && !defined(Q_OS_QNX) void execChild(const char *workingDirectory, char **path, char **argv, char **envp); diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp index bcc3fe0b0d..f16025752e 100644 --- a/src/corelib/io/qprocess_win.cpp +++ b/src/corelib/io/qprocess_win.cpp @@ -630,8 +630,9 @@ bool QProcessPrivate::drainOutputPipes() if (!stdoutReader && !stderrReader) return false; - bool readyReadEmitted = false; + bool someReadyReadEmitted = false; forever { + bool readyReadEmitted = false; bool readOperationActive = false; if (stdoutReader) { readyReadEmitted |= stdoutReader->waitForReadyRead(0); @@ -641,12 +642,13 @@ bool QProcessPrivate::drainOutputPipes() readyReadEmitted |= stderrReader->waitForReadyRead(0); readOperationActive |= stderrReader->isReadOperationActive(); } + someReadyReadEmitted |= readyReadEmitted; if (!readOperationActive || !readyReadEmitted) break; Sleep(100); } - return readyReadEmitted; + return someReadyReadEmitted; } bool QProcessPrivate::waitForReadyRead(int msecs) diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp index f152dec5e6..4162e843a7 100644 --- a/src/corelib/itemmodels/qabstractitemmodel.cpp +++ b/src/corelib/itemmodels/qabstractitemmodel.cpp @@ -1911,8 +1911,8 @@ Qt::DropActions QAbstractItemModel::supportedDropActions() const /*! Returns the actions supported by the data in this model. - The default implementation returns supportedDropActions() unless specific - values have been set with setSupportedDragActions(). + The default implementation returns supportedDropActions(). Reimplement + this function if you wish to support additional actions. supportedDragActions() is used by QAbstractItemView::startDrag() as the default values when a drag occurs. @@ -1941,6 +1941,8 @@ void QAbstractItemModel::doSetSupportedDragActions(Qt::DropActions actions) \obsolete \fn void QAbstractItemModel::setSupportedDragActions(Qt::DropActions actions) + This function is obsolete. Reimplement supportedDragActions() instead. + Sets the supported drag \a actions for the items in the model. \sa supportedDragActions(), {Using drag and drop with item views} diff --git a/src/corelib/plugin/qfactoryloader.cpp b/src/corelib/plugin/qfactoryloader.cpp index c617325e9e..3c8e00519b 100644 --- a/src/corelib/plugin/qfactoryloader.cpp +++ b/src/corelib/plugin/qfactoryloader.cpp @@ -137,7 +137,8 @@ void QFactoryLoader::update() // // ### FIXME find a proper solution // - const bool isLoadingDebugAndReleaseCocoa = plugins.contains("libqcocoa_debug.dylib") && plugins.contains("libqcocoa.dylib"); + const bool isLoadingDebugAndReleaseCocoa = plugins.contains(QStringLiteral("libqcocoa_debug.dylib")) + && plugins.contains(QStringLiteral("libqcocoa.dylib")); #endif for (int j = 0; j < plugins.count(); ++j) { QString fileName = QDir::cleanPath(path + QLatin1Char('/') + plugins.at(j)); diff --git a/src/corelib/statemachine/qsignaleventgenerator_p.h b/src/corelib/statemachine/qsignaleventgenerator_p.h index 4ed43c4edb..160a24e7a3 100644 --- a/src/corelib/statemachine/qsignaleventgenerator_p.h +++ b/src/corelib/statemachine/qsignaleventgenerator_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ +** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtCore module of the Qt Toolkit. ** diff --git a/src/dbus/qdbusabstractinterface.cpp b/src/dbus/qdbusabstractinterface.cpp index 53def1beb6..0b584963ee 100644 --- a/src/dbus/qdbusabstractinterface.cpp +++ b/src/dbus/qdbusabstractinterface.cpp @@ -288,7 +288,8 @@ QDBusAbstractInterface::QDBusAbstractInterface(QDBusAbstractInterfacePrivate &d, if (d.isValid && d.connection.isConnected() && !d.service.isEmpty() - && !d.service.startsWith(QLatin1Char(':'))) + && !d.service.startsWith(QLatin1Char(':')) + && d.connectionPrivate()->mode != QDBusConnectionPrivate::PeerMode) d_func()->connection.connect(QLatin1String(DBUS_SERVICE_DBUS), // service QString(), // path QLatin1String(DBUS_INTERFACE_DBUS), // interface @@ -313,7 +314,8 @@ QDBusAbstractInterface::QDBusAbstractInterface(const QString &service, const QSt if (d_func()->isValid && d_func()->connection.isConnected() && !service.isEmpty() - && !service.startsWith(QLatin1Char(':'))) + && !service.startsWith(QLatin1Char(':')) + && d_func()->connectionPrivate()->mode != QDBusConnectionPrivate::PeerMode) d_func()->connection.connect(QLatin1String(DBUS_SERVICE_DBUS), // service QString(), // path QLatin1String(DBUS_INTERFACE_DBUS), // interface @@ -340,7 +342,13 @@ QDBusAbstractInterface::~QDBusAbstractInterface() */ bool QDBusAbstractInterface::isValid() const { - return !d_func()->currentOwner.isEmpty(); + Q_D(const QDBusAbstractInterface); + /* We don't retrieve the owner name for peer connections */ + if (d->connectionPrivate() && d->connectionPrivate()->mode == QDBusConnectionPrivate::PeerMode) { + return d->isValid; + } else { + return !d->currentOwner.isEmpty(); + } } /*! diff --git a/src/dbus/qdbusxmlgenerator.cpp b/src/dbus/qdbusxmlgenerator.cpp index fcdf43da4d..c724ac573a 100644 --- a/src/dbus/qdbusxmlgenerator.cpp +++ b/src/dbus/qdbusxmlgenerator.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ +** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtDBus module of the Qt Toolkit. ** diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index a8a4ad1937..e1d0b1c01f 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -210,6 +210,11 @@ static inline void clearFontUnlocked() QGuiApplicationPrivate::app_font = 0; } +static inline bool isPopupWindow(const QWindow *w) +{ + return (w->flags() & Qt::WindowType_Mask) == Qt::Popup; +} + /*! \class QGuiApplication \brief The QGuiApplication class manages the GUI application's control @@ -477,26 +482,33 @@ QWindow *QGuiApplication::modalWindow() return QGuiApplicationPrivate::self->modalWindowList.first(); } -void QGuiApplicationPrivate::updateBlockedStatus(QWindow *window) +static void updateBlockedStatusRecursion(QWindow *window, bool shouldBeBlocked) { - bool shouldBeBlocked = false; - if ((window->type() & Qt::Popup) != Qt::Popup && !self->modalWindowList.isEmpty()) - shouldBeBlocked = self->isWindowBlocked(window); - - if (shouldBeBlocked != window->d_func()->blockedByModalWindow) { + QWindowPrivate *p = qt_window_private(window); + if (p->blockedByModalWindow != shouldBeBlocked) { + p->blockedByModalWindow = shouldBeBlocked; QEvent e(shouldBeBlocked ? QEvent::WindowBlocked : QEvent::WindowUnblocked); - - window->d_func()->blockedByModalWindow = shouldBeBlocked; QGuiApplication::sendEvent(window, &e); + foreach (QObject *c, window->children()) + if (c->isWindowType()) + updateBlockedStatusRecursion(static_cast<QWindow *>(c), shouldBeBlocked); } } +void QGuiApplicationPrivate::updateBlockedStatus(QWindow *window) +{ + bool shouldBeBlocked = false; + if (!isPopupWindow(window) && !self->modalWindowList.isEmpty()) + shouldBeBlocked = self->isWindowBlocked(window); + updateBlockedStatusRecursion(window, shouldBeBlocked); +} + void QGuiApplicationPrivate::showModalWindow(QWindow *modal) { self->modalWindowList.prepend(modal); // Send leave for currently entered window if it should be blocked - if (currentMouseWindow && (currentMouseWindow->type() & Qt::Popup) != Qt::Popup) { + if (currentMouseWindow && !isPopupWindow(currentMouseWindow)) { bool shouldBeBlocked = self->isWindowBlocked(currentMouseWindow); if (shouldBeBlocked) { // Remove the new window from modalWindowList temporarily so leave can go through diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index 392407d86d..9ef19715ed 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -871,6 +871,10 @@ QRegion QWindow::mask() const void QWindow::requestActivate() { Q_D(QWindow); + if (flags() & Qt::WindowDoesNotAcceptFocus) { + qWarning() << "requestActivate() called for " << this << " which has Qt::WindowDoesNotAcceptFocus set."; + return; + } if (d->platformWindow) d->platformWindow->requestActivateWindow(); } diff --git a/src/network/socket/qlocalsocket.cpp b/src/network/socket/qlocalsocket.cpp index 1ce6568364..f516b932e7 100644 --- a/src/network/socket/qlocalsocket.cpp +++ b/src/network/socket/qlocalsocket.cpp @@ -71,6 +71,22 @@ QT_BEGIN_NAMESPACE */ /*! + \fn void QLocalSocket::connectToServer(OpenMode openMode) + \since 5.1 + + Attempts to make a connection to serverName(). + setServerName() must be called before you open the connection. + Alternatively you can use connectToServer(const QString &name, OpenMode openMode); + + The socket is opened in the given \a openMode and first enters ConnectingState. + If a connection is established, QLocalSocket enters ConnectedState and emits connected(). + + After calling this function, the socket can emit error() to signal that an error occurred. + + \sa state(), serverName(), waitForConnected() +*/ + +/*! \fn void QLocalSocket::open(OpenMode openMode) Equivalent to connectToServer(OpenMode mode). @@ -352,23 +368,10 @@ QLocalSocket::~QLocalSocket() #endif } -/*! - \since 5.1 - - Attempts to make a connection to serverName(). - setServerName() must be called before you open the connection. - Alternatively you can use connectToServer(const QString &name, OpenMode openMode); - - The socket is opened in the given \a openMode and first enters ConnectingState. - If a connection is established, QLocalSocket enters ConnectedState and emits connected(). - - After calling this function, the socket can emit error() to signal that an error occurred. - - \sa state(), serverName(), waitForConnected() -*/ -void QLocalSocket::connectToServer(OpenMode openMode) +bool QLocalSocket::open(OpenMode openMode) { - open(openMode); + connectToServer(openMode); + return isOpen(); } /*! \overload @@ -385,7 +388,7 @@ void QLocalSocket::connectToServer(OpenMode openMode) void QLocalSocket::connectToServer(const QString &name, OpenMode openMode) { setServerName(name); - open(openMode); + connectToServer(openMode); } /*! diff --git a/src/network/socket/qlocalsocket_tcp.cpp b/src/network/socket/qlocalsocket_tcp.cpp index 31aaa6e1c5..0bf0cc0654 100644 --- a/src/network/socket/qlocalsocket_tcp.cpp +++ b/src/network/socket/qlocalsocket_tcp.cpp @@ -214,13 +214,13 @@ void QLocalSocketPrivate::errorOccurred(QLocalSocket::LocalSocketError error, co q->emit stateChanged(state); } -bool QLocalSocket::open(OpenMode openMode) +void QLocalSocket::connectToServer(OpenMode openMode) { Q_D(QLocalSocket); if (state() == ConnectedState || state() == ConnectingState) { setErrorString(tr("Trying to connect while connection is in progress")); emit error(QLocalSocket::OperationError); - return false; + return; } d->errorString.clear(); @@ -230,7 +230,7 @@ bool QLocalSocket::open(OpenMode openMode) if (d->serverName.isEmpty()) { d->errorOccurred(ServerNotFoundError, QLatin1String("QLocalSocket::connectToServer")); - return false; + return; } const QLatin1String prefix("QLocalServer/"); @@ -245,11 +245,10 @@ bool QLocalSocket::open(OpenMode openMode) if (!ok) { d->errorOccurred(ServerNotFoundError, QLatin1String("QLocalSocket::connectToServer")); - return false; + return; } d->tcpSocket->connectToHost(QHostAddress::LocalHost, port, openMode); QIODevice::open(openMode); - return true; } bool QLocalSocket::setSocketDescriptor(qintptr socketDescriptor, @@ -425,7 +424,7 @@ bool QLocalSocket::waitForDisconnected(int msecs) { Q_D(QLocalSocket); if (state() == UnconnectedState) { - qWarning() << "QLocalSocket::waitForDisconnected() is not allowed in UnconnectedState"; + qWarning("QLocalSocket::waitForDisconnected() is not allowed in UnconnectedState"); return false; } return (d->tcpSocket->waitForDisconnected(msecs)); diff --git a/src/network/socket/qlocalsocket_unix.cpp b/src/network/socket/qlocalsocket_unix.cpp index 67182e57b0..4af584b345 100644 --- a/src/network/socket/qlocalsocket_unix.cpp +++ b/src/network/socket/qlocalsocket_unix.cpp @@ -221,14 +221,14 @@ void QLocalSocketPrivate::errorOccurred(QLocalSocket::LocalSocketError error, co q->emit stateChanged(state); } -bool QLocalSocket::open(OpenMode openMode) +void QLocalSocket::connectToServer(OpenMode openMode) { Q_D(QLocalSocket); if (state() == ConnectedState || state() == ConnectingState) { QString errorString = d->generateErrorString(QLocalSocket::OperationError, QLatin1String("QLocalSocket::connectToserver")); setErrorString(errorString); emit error(QLocalSocket::OperationError); - return false; + return; } d->errorString.clear(); @@ -239,14 +239,14 @@ bool QLocalSocket::open(OpenMode openMode) if (d->serverName.isEmpty()) { d->errorOccurred(ServerNotFoundError, QLatin1String("QLocalSocket::connectToServer")); - return false; + return; } // create the socket if (-1 == (d->connectingSocket = qt_safe_socket(PF_UNIX, SOCK_STREAM, 0))) { d->errorOccurred(UnsupportedSocketOperationError, QLatin1String("QLocalSocket::connectToServer")); - return false; + return; } // set non blocking so we can try to connect and it won't wait int flags = fcntl(d->connectingSocket, F_GETFL, 0); @@ -254,14 +254,14 @@ bool QLocalSocket::open(OpenMode openMode) || -1 == (fcntl(d->connectingSocket, F_SETFL, flags | O_NONBLOCK))) { d->errorOccurred(UnknownSocketError, QLatin1String("QLocalSocket::connectToServer")); - return false; + return; } // _q_connectToSocket does the actual connecting d->connectingName = d->serverName; d->connectingOpenMode = openMode; d->_q_connectToSocket(); - return true; + return; } /*! @@ -560,7 +560,7 @@ bool QLocalSocket::waitForDisconnected(int msecs) { Q_D(QLocalSocket); if (state() == UnconnectedState) { - qWarning() << "QLocalSocket::waitForDisconnected() is not allowed in UnconnectedState"; + qWarning("QLocalSocket::waitForDisconnected() is not allowed in UnconnectedState"); return false; } return (d->unixSocket.waitForDisconnected(msecs)); diff --git a/src/network/socket/qlocalsocket_win.cpp b/src/network/socket/qlocalsocket_win.cpp index cdfa18377d..96c6c0f6ea 100644 --- a/src/network/socket/qlocalsocket_win.cpp +++ b/src/network/socket/qlocalsocket_win.cpp @@ -128,13 +128,13 @@ void QLocalSocketPrivate::destroyPipeHandles() } } -bool QLocalSocket::open(OpenMode openMode) +void QLocalSocket::connectToServer(OpenMode openMode) { Q_D(QLocalSocket); if (state() == ConnectedState || state() == ConnectingState) { setErrorString(tr("Trying to connect while connection is in progress")); emit error(QLocalSocket::OperationError); - return false; + return; } d->error = QLocalSocket::UnknownSocketError; @@ -147,7 +147,7 @@ bool QLocalSocket::open(OpenMode openMode) d->state = UnconnectedState; emit error(d->error); emit stateChanged(d->state); - return false; + return; } QString pipePath = QLatin1String("\\\\.\\pipe\\"); @@ -184,7 +184,7 @@ bool QLocalSocket::open(OpenMode openMode) if (localSocket == INVALID_HANDLE_VALUE) { d->setErrorString(QLatin1String("QLocalSocket::connectToServer")); d->fullServerName = QString(); - return false; + return; } // we have a valid handle @@ -192,7 +192,6 @@ bool QLocalSocket::open(OpenMode openMode) d->handle = localSocket; emit connected(); } - return true; } // This is reading from the buffer @@ -379,8 +378,10 @@ bool QLocalSocket::waitForConnected(int msecs) bool QLocalSocket::waitForDisconnected(int msecs) { Q_D(QLocalSocket); - if (state() == UnconnectedState) + if (state() == UnconnectedState) { + qWarning("QLocalSocket::waitForDisconnected() is not allowed in UnconnectedState"); return false; + } if (!openMode().testFlag(QIODevice::ReadOnly)) { qWarning("QLocalSocket::waitForDisconnected isn't supported for write only pipes."); return false; diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp index 8ad2395a7f..ec4730a022 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols.cpp +++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp @@ -67,7 +67,7 @@ #if defined(Q_OS_UNIX) #include <QtCore/qdir.h> #endif -#if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID_NO_SDK) +#if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID) #include <link.h> #endif @@ -389,7 +389,7 @@ static bool libGreaterThan(const QString &lhs, const QString &rhs) return true; } -#if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID_NO_SDK) +#if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID) static int dlIterateCallback(struct dl_phdr_info *info, size_t size, void *data) { if (size < sizeof (info->dlpi_addr) + sizeof (info->dlpi_name)) @@ -420,7 +420,7 @@ static QStringList libraryPathList() paths << QLatin1String("/lib64") << QLatin1String("/usr/lib64") << QLatin1String("/usr/local/lib64"); paths << QLatin1String("/lib32") << QLatin1String("/usr/lib32") << QLatin1String("/usr/local/lib32"); -#if defined(Q_OS_ANDROID_NO_SDK) +#if defined(Q_OS_ANDROID) paths << QLatin1String("/system/lib"); #elif defined(Q_OS_LINUX) // discover paths of already loaded libraries diff --git a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm index b1d9e4ebce..13b4085252 100644 --- a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm @@ -142,6 +142,11 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSFontPanelDelegate); mDialogIsExecuting = false; mResultSet = false; +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 + if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7) + [mFontPanel setRestorable:NO]; +#endif + [mFontPanel setTitle:QCFString::toNSString(helper->options()->windowTitle())]; if (mHelper->options()->testOption(QFontDialogOptions::NoButtons)) { diff --git a/src/plugins/platforms/qnx/qqnxwindow.cpp b/src/plugins/platforms/qnx/qqnxwindow.cpp index e14f18b2c5..2bd5cfd801 100644 --- a/src/plugins/platforms/qnx/qqnxwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxwindow.cpp @@ -135,7 +135,7 @@ QQnxWindow::QQnxWindow(QWindow *window, screen_context_t context) if (result != 0) qFatal("QQnxWindow: failed to set window swap interval, errno=%d", errno); - if (window->flags() && Qt::WindowDoesNotAcceptFocus) { + if (window->flags() & Qt::WindowDoesNotAcceptFocus) { errno = 0; val = SCREEN_SENSITIVITY_NO_FOCUS; result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_SENSITIVITY, &val); diff --git a/src/plugins/platforms/windows/qwindowsfontengine.cpp b/src/plugins/platforms/windows/qwindowsfontengine.cpp index 792e79df19..33ddcaffc5 100644 --- a/src/plugins/platforms/windows/qwindowsfontengine.cpp +++ b/src/plugins/platforms/windows/qwindowsfontengine.cpp @@ -1128,11 +1128,10 @@ QWindowsNativeImage *QWindowsFontEngine::drawGDIGlyph(HFONT font, glyph_t glyph, } #else // else wince unsigned int options = 0; -#ifdef DEBUG - Q_ASSERT(!has_transformation); -#else - Q_UNUSED(has_transformation); -#endif + if (has_transformation) { + qWarning() << "QWindowsFontEngine is unable to apply transformations other than translations for fonts on Windows CE." + << "If you need them anyway, start your application with -platform windows:fontengine=freetype."; + } #endif // wince QWindowsNativeImage *ni = new QWindowsNativeImage(iw + 2 * margin + 4, ih + 2 * margin + 4, diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index c3ec949eef..dc51dbfc88 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -808,8 +808,12 @@ QWindowsWindow::QWindowsWindow(QWindow *aWindow, const WindowData &data) : const Qt::WindowType type = aWindow->type(); if (type == Qt::Desktop) return; // No further handling for Qt::Desktop - if (aWindow->surfaceType() == QWindow::OpenGLSurface) + if (aWindow->surfaceType() == QWindow::OpenGLSurface) { setFlag(OpenGLSurface); +#ifdef QT_OPENGL_ES_2 + setFlag(OpenGL_ES2); +#endif + } if (aWindow->isTopLevel()) { switch (type) { case Qt::Window: @@ -1233,9 +1237,16 @@ void QWindowsWindow::handleGeometryChange() //Prevent recursive resizes for Windows CE if (testFlag(WithinSetStyle)) return; + const QRect previousGeometry = m_data.geometry; m_data.geometry = geometry_sys(); QPlatformWindow::setGeometry(m_data.geometry); QWindowSystemInterface::handleGeometryChange(window(), m_data.geometry); + // QTBUG-32121: OpenGL/normal windows (with exception of ANGLE) do not receive + // expose events when shrinking, synthesize. + if (!testFlag(OpenGL_ES2) && isExposed() + && !(m_data.geometry.width() > previousGeometry.width() || m_data.geometry.height() > previousGeometry.height())) { + fireExpose(QRegion(m_data.geometry), true); + } if (testFlag(SynchronousGeometryChangeEvent)) QWindowSystemInterface::flushWindowSystemEvents(); diff --git a/src/plugins/platforms/windows/qwindowswindow.h b/src/plugins/platforms/windows/qwindowswindow.h index 07f3976d87..996542f92a 100644 --- a/src/plugins/platforms/windows/qwindowswindow.h +++ b/src/plugins/platforms/windows/qwindowswindow.h @@ -124,18 +124,19 @@ public: WithinSetParent = 0x2, FrameDirty = 0x4, //! Frame outdated by setStyle, recalculate in next query. OpenGLSurface = 0x10, - OpenGLDoubleBuffered = 0x20, - OpenGlPixelFormatInitialized = 0x40, - BlockedByModal = 0x80, - SizeGripOperation = 0x100, - FrameStrutEventsEnabled = 0x200, - SynchronousGeometryChangeEvent = 0x400, - WithinSetStyle = 0x800, - WithinDestroy = 0x1000, - TouchRegistered = 0x2000, - AlertState = 0x4000, - Exposed = 0x08000, - WithinCreate = 0x10000 + OpenGL_ES2 = 0x20, + OpenGLDoubleBuffered = 0x40, + OpenGlPixelFormatInitialized = 0x80, + BlockedByModal = 0x100, + SizeGripOperation = 0x200, + FrameStrutEventsEnabled = 0x400, + SynchronousGeometryChangeEvent = 0x800, + WithinSetStyle = 0x1000, + WithinDestroy = 0x2000, + TouchRegistered = 0x4000, + AlertState = 0x8000, + Exposed = 0x10000, + WithinCreate = 0x20000 }; struct WindowData diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 40e35acd5e..c4dd58667d 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -1232,6 +1232,7 @@ static const char * xcb_atomnames = { // ICCCM window state "WM_STATE\0" "WM_CHANGE_STATE\0" + "WM_CLASS\0" // Session management "WM_CLIENT_LEADER\0" diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 1662e862f1..8f568c6c25 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -102,6 +102,7 @@ namespace QXcbAtom { // ICCCM window state WM_STATE, WM_CHANGE_STATE, + WM_CLASS, // Session management WM_CLIENT_LEADER, diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index 1c170d44e6..46077e2c3f 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -389,4 +389,48 @@ QVariant QXcbIntegration::styleHint(QPlatformIntegration::StyleHint hint) const return QPlatformIntegration::styleHint(hint); } +static QString argv0BaseName() +{ + QString result; + const QStringList arguments = QCoreApplication::arguments(); + if (!arguments.isEmpty() && !arguments.front().isEmpty()) { + result = arguments.front(); + const int lastSlashPos = result.lastIndexOf(QLatin1Char('/')); + if (lastSlashPos != -1) + result.remove(0, lastSlashPos + 1); + } + return result; +} + +static const char resourceNameVar[] = "RESOURCE_NAME"; + +QByteArray QXcbIntegration::wmClass() const +{ + if (m_wmClass.isEmpty()) { + // Instance name according to ICCCM 4.1.2.5 + QString name; + if (name.isEmpty() && qEnvironmentVariableIsSet(resourceNameVar)) + name = QString::fromLocal8Bit(qgetenv(resourceNameVar)); + if (name.isEmpty()) + name = argv0BaseName(); + + // Note: QCoreApplication::applicationName() cannot be called from the QGuiApplication constructor, + // hence this delayed initialization. + QString className = QCoreApplication::applicationName(); + if (className.isEmpty()) { + className = argv0BaseName(); + if (!className.isEmpty() && className.at(0).isLower()) + className[0] = className.at(0).toUpper(); + } + + if (!name.isEmpty() && !className.isEmpty()) { + m_wmClass = name.toLocal8Bit(); + m_wmClass.append('\0'); + m_wmClass.append(className.toLocal8Bit()); + m_wmClass.append('\0'); + } + } + return m_wmClass; +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/xcb/qxcbintegration.h b/src/plugins/platforms/xcb/qxcbintegration.h index cc39fb1462..b884b3b7f2 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.h +++ b/src/plugins/platforms/xcb/qxcbintegration.h @@ -99,6 +99,8 @@ public: QXcbConnection *defaultConnection() const { return m_connections.first(); } + QByteArray wmClass() const; + private: QList<QXcbConnection *> m_connections; @@ -115,6 +117,8 @@ private: QScopedPointer<QPlatformServices> m_services; friend class QXcbConnection; // access QPlatformIntegration::screenAdded() + + mutable QByteArray m_wmClass; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp index 7d832a1c08..9e9fd2914f 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp @@ -95,12 +95,9 @@ QXcbNativeInterface::QXcbNativeInterface() : void QXcbNativeInterface::beep() // For QApplication::beep() { -#ifdef XCB_USE_XLIB - ::Display *display = (::Display *)nativeResourceForScreen(QByteArrayLiteral("display"), QGuiApplication::primaryScreen()); - XBell(display, 0); -#else - fputc(7, stdout); -#endif + QPlatformScreen *screen = QGuiApplication::primaryScreen()->handle(); + xcb_connection_t *connection = static_cast<QXcbScreen *>(screen)->xcb_connection(); + xcb_bell(connection, 0); } void *QXcbNativeInterface::nativeResourceForIntegration(const QByteArray &resourceString) diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 3a19788316..0325338a13 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -379,6 +379,13 @@ void QXcbWindow::create() m_syncValue.hi = 0; m_syncValue.lo = 0; + const QByteArray wmClass = static_cast<QXcbIntegration *>(QGuiApplicationPrivate::platformIntegration())->wmClass(); + if (!wmClass.isEmpty()) { + Q_XCB_CALL(xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, + m_window, atom(QXcbAtom::WM_CLASS), + XCB_ATOM_STRING, 8, wmClass.size(), wmClass.constData())); + } + if (m_usingSyncProtocol) { m_syncCounter = xcb_generate_id(xcb_connection()); Q_XCB_CALL(xcb_sync_create_counter(xcb_connection(), m_syncCounter, m_syncValue)); @@ -1636,7 +1643,8 @@ void QXcbWindow::handleButtonPressEvent(const xcb_button_press_event_t *event) { if (window() != QGuiApplication::focusWindow()) { QWindow *w = static_cast<QWindowPrivate *>(QObjectPrivate::get(window()))->eventReceiver(); - w->requestActivate(); + if (!(w->flags() & Qt::WindowDoesNotAcceptFocus)) + w->requestActivate(); } updateNetWmUserTime(event->time); diff --git a/src/testlib/qbenchmarkperfevents.cpp b/src/testlib/qbenchmarkperfevents.cpp index e3034d1f94..acc11b09ac 100644 --- a/src/testlib/qbenchmarkperfevents.cpp +++ b/src/testlib/qbenchmarkperfevents.cpp @@ -130,7 +130,17 @@ static void initPerf() static int perf_event_open(perf_event_attr *attr, pid_t pid, int cpu, int group_fd, unsigned long flags) { +#ifdef SYS_perf_event_open return syscall(SYS_perf_event_open, attr, pid, cpu, group_fd, flags); +#else + Q_UNUSED(attr); + Q_UNUSED(pid); + Q_UNUSED(cpu); + Q_UNUSED(group_fd); + Q_UNUSED(flags); + errno = ENOSYS; + return -1; +#endif } bool QBenchmarkPerfEventsMeasurer::isAvailable() diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp index 44eb4f65e8..4757fdad93 100644 --- a/src/tools/moc/generator.cpp +++ b/src/tools/moc/generator.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). ** Copyright (C) 2013 Olivier Goffart <ogoffart@woboq.com> -** Contact: http://www.qt-project.org/ +** Contact: http://www.qt-project.org/legal ** ** This file is part of the tools applications of the Qt Toolkit. ** diff --git a/src/tools/moc/generator.h b/src/tools/moc/generator.h index aece7152b3..203c856b7c 100644 --- a/src/tools/moc/generator.h +++ b/src/tools/moc/generator.h @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ +** Contact: http://www.qt-project.org/legal ** ** This file is part of the tools applications of the Qt Toolkit. ** diff --git a/src/tools/qdoc/ditaxmlgenerator.cpp b/src/tools/qdoc/ditaxmlgenerator.cpp index fcd1dd33c2..56eb145485 100644 --- a/src/tools/qdoc/ditaxmlgenerator.cpp +++ b/src/tools/qdoc/ditaxmlgenerator.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ +** Contact: http://www.qt-project.org/legal ** ** This file is part of the tools applications of the Qt Toolkit. ** diff --git a/src/tools/qdoc/ditaxmlgenerator.h b/src/tools/qdoc/ditaxmlgenerator.h index a55ccf81c8..a58504d7c7 100644 --- a/src/tools/qdoc/ditaxmlgenerator.h +++ b/src/tools/qdoc/ditaxmlgenerator.h @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ +** Contact: http://www.qt-project.org/legal ** ** This file is part of the tools applications of the Qt Toolkit. ** diff --git a/src/tools/qdoc/doc.cpp b/src/tools/qdoc/doc.cpp index 9378726c13..4d6b0b1a2c 100644 --- a/src/tools/qdoc/doc.cpp +++ b/src/tools/qdoc/doc.cpp @@ -1060,7 +1060,7 @@ void DocParser::parse(const QString& source, } if (!inTableHeader && !inTableRow) { - location().warning(tr("Missing '\\%1' or '\\%1' before '\\%3'") + location().warning(tr("Missing '\\%1' or '\\%2' before '\\%3'") .arg(cmdName(CMD_HEADER)) .arg(cmdName(CMD_ROW)) .arg(cmdName(CMD_LI))); @@ -1182,7 +1182,7 @@ void DocParser::parse(const QString& source, leavePara(); p1 = getRestOfLine(); if (p1.isEmpty()) - location().warning(tr("Missing format name after '\\%1") + location().warning(tr("Missing format name after '\\%1'") .arg(cmdName(CMD_RAW))); append(Atom::FormatIf, p1); append(Atom::RawString, untabifyEtc(getUntilEnd(cmd))); diff --git a/src/tools/qdoc/generator.cpp b/src/tools/qdoc/generator.cpp index e60764eaba..f9601f8281 100644 --- a/src/tools/qdoc/generator.cpp +++ b/src/tools/qdoc/generator.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ +** Contact: http://www.qt-project.org/legal ** ** This file is part of the tools applications of the Qt Toolkit. ** diff --git a/src/tools/qdoc/generator.h b/src/tools/qdoc/generator.h index ba80e50abd..4657f71e1d 100644 --- a/src/tools/qdoc/generator.h +++ b/src/tools/qdoc/generator.h @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ +** Contact: http://www.qt-project.org/legal ** ** This file is part of the tools applications of the Qt Toolkit. ** diff --git a/src/tools/qdoc/htmlgenerator.cpp b/src/tools/qdoc/htmlgenerator.cpp index c5b7527a8b..d5a1647c5a 100644 --- a/src/tools/qdoc/htmlgenerator.cpp +++ b/src/tools/qdoc/htmlgenerator.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ +** Contact: http://www.qt-project.org/legal ** ** This file is part of the tools applications of the Qt Toolkit. ** diff --git a/src/tools/qdoc/htmlgenerator.h b/src/tools/qdoc/htmlgenerator.h index 15e97588ee..54747cd6d6 100644 --- a/src/tools/qdoc/htmlgenerator.h +++ b/src/tools/qdoc/htmlgenerator.h @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ +** Contact: http://www.qt-project.org/legal ** ** This file is part of the tools applications of the Qt Toolkit. ** diff --git a/src/widgets/graphicsview/qgraphicsproxywidget.cpp b/src/widgets/graphicsview/qgraphicsproxywidget.cpp index 1898ecba68..0ed0b0ec3f 100644 --- a/src/widgets/graphicsview/qgraphicsproxywidget.cpp +++ b/src/widgets/graphicsview/qgraphicsproxywidget.cpp @@ -356,6 +356,9 @@ QWidget *QGraphicsProxyWidgetPrivate::findFocusChild(QWidget *child, bool next) } } + if (!child) + return 0; + QWidget *oldChild = child; uint focus_flag = qt_tab_all_widgets() ? Qt::TabFocus : Qt::StrongFocus; do { diff --git a/src/widgets/graphicsview/qgraphicssceneindex.cpp b/src/widgets/graphicsview/qgraphicssceneindex.cpp index 4b1c990578..398e72e4c3 100644 --- a/src/widgets/graphicsview/qgraphicssceneindex.cpp +++ b/src/widgets/graphicsview/qgraphicssceneindex.cpp @@ -151,7 +151,7 @@ public: itemd->sceneTransform.dy()) : itemd->sceneTransform.mapRect(brect); keep = sceneBoundingRect.intersects(QRectF(scenePoint, QSizeF(1, 1))); - if (keep) { + if (keep && (mode == Qt::ContainsItemShape || mode == Qt::IntersectsItemShape)) { QPointF p = itemd->sceneTransformTranslateOnly ? QPointF(scenePoint.x() - itemd->sceneTransform.dx(), scenePoint.y() - itemd->sceneTransform.dy()) |