summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/corelib/Qt5CoreConfigExtras.cmake.in4
-rw-r--r--src/corelib/global/qconfig-nacl.h4
-rw-r--r--src/corelib/global/qfeatures.h5
-rw-r--r--src/corelib/global/qfeatures.txt20
-rw-r--r--src/corelib/io/qprocess_unix.cpp15
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp65
-rw-r--r--src/corelib/kernel/qcoreapplication.h1
-rw-r--r--src/corelib/kernel/qcoreapplication_p.h2
-rw-r--r--src/corelib/kernel/qeventdispatcher_blackberry.cpp37
-rw-r--r--src/corelib/thread/qmutex.cpp12
-rw-r--r--src/corelib/thread/qthread.cpp14
-rw-r--r--src/gui/accessible/qaccessible2.cpp288
-rw-r--r--src/gui/accessible/qaccessible2.h8
-rw-r--r--src/gui/kernel/qguiapplication.cpp19
-rw-r--r--src/gui/kernel/qkeymapper_qpa.cpp7
-rw-r--r--src/gui/kernel/qkeysequence.h5
-rw-r--r--src/gui/kernel/qplatformintegration.cpp14
-rw-r--r--src/gui/kernel/qplatformintegration.h2
-rw-r--r--src/gui/kernel/qplatformwindow.cpp9
-rw-r--r--src/gui/kernel/qplatformwindow.h2
-rw-r--r--src/gui/kernel/qscreen.h33
-rw-r--r--src/gui/kernel/qwindow.cpp5
-rw-r--r--src/gui/opengl/qopengl.h4
-rw-r--r--src/gui/opengl/qopengles2ext.h1
-rw-r--r--src/gui/opengl/qopenglext.h1
-rw-r--r--src/gui/opengl/qopenglfunctions.h2
-rw-r--r--src/gui/painting/qt_mips_asm_dsp.h4
-rw-r--r--src/gui/text/qfont.cpp60
-rw-r--r--src/gui/text/qglyphrun.cpp10
-rw-r--r--src/gui/text/qrawfont.cpp70
-rw-r--r--src/gui/text/qrawfont.h10
-rw-r--r--src/gui/text/qtextengine.cpp26
-rw-r--r--src/gui/text/qtextformat.cpp4
-rw-r--r--src/gui/text/qtextobject.cpp11
-rw-r--r--src/network/access/qnetworkdiskcache.cpp2
-rw-r--r--src/network/kernel/qnetworkfunctions_wince.h4
-rw-r--r--src/opengl/qglfunctions.h5
-rw-r--r--src/platformsupport/fbconvenience/qfbwindow.cpp3
-rw-r--r--src/platformsupport/fbconvenience/qfbwindow_p.h2
-rw-r--r--src/platformsupport/linuxaccessibility/atspiadaptor.cpp14
-rw-r--r--src/plugins/accessible/widgets/itemviews.cpp2
-rw-r--r--src/plugins/accessible/widgets/qaccessiblewidgets.cpp2
-rw-r--r--src/plugins/accessible/widgets/simplewidgets.cpp13
-rw-r--r--src/plugins/platforms/cocoa/qcocoanativeinterface.h3
-rw-r--r--src/plugins/platforms/cocoa/qcocoanativeinterface.mm24
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.h2
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm3
-rw-r--r--src/plugins/platforms/directfb/qdirectfbwindow.cpp3
-rw-r--r--src/plugins/platforms/directfb/qdirectfbwindow.h2
-rw-r--r--src/plugins/platforms/qnx/qqnxbuffer.cpp2
-rw-r--r--src/plugins/platforms/qnx/qqnxbuffer.h4
-rw-r--r--src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp10
-rw-r--r--src/plugins/platforms/qnx/qqnxscreen.cpp2
-rw-r--r--src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp2
-rw-r--r--src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.cpp4
-rw-r--r--src/plugins/platforms/windows/qtwindowsglobal.h6
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.cpp7
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.h2
-rw-r--r--src/plugins/platforms/windows/qwindowsinputcontext.cpp6
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.cpp5
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.h1
-rw-r--r--src/plugins/platforms/windows/qwindowskeymapper.cpp26
-rw-r--r--src/plugins/platforms/windows/qwindowskeymapper.h2
-rw-r--r--src/plugins/platforms/windows/qwindowsscreen.cpp3
-rw-r--r--src/plugins/platforms/windows/qwindowsscreen.h2
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp3
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.h2
-rw-r--r--src/plugins/platforms/xcb/qxcbclipboard.cpp3
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.cpp53
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.h3
-rw-r--r--src/plugins/platforms/xcb/qxcbdrag.cpp63
-rw-r--r--src/plugins/platforms/xcb/qxcbdrag.h7
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp4
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.h2
-rw-r--r--src/plugins/printsupport/cups/qcupsprintersupport_p.h1
-rw-r--r--src/printsupport/kernel/qcups.cpp2
-rw-r--r--src/printsupport/kernel/qprintengine_win.cpp17
-rw-r--r--src/sql/kernel/qsql.qdoc12
-rw-r--r--src/sql/models/qsqltablemodel.h6
-rw-r--r--src/testlib/doc/src/qttestlib-manual.qdoc8
-rw-r--r--src/tools/moc/preprocessor.cpp21
-rw-r--r--src/tools/qdoc/location.cpp5
-rw-r--r--src/tools/uic/qclass_lib_map.h4
-rw-r--r--src/widgets/dialogs/qfiledialog.ui184
-rw-r--r--src/widgets/doc/src/modelview.qdoc23
-rw-r--r--src/widgets/itemviews/qabstractitemview.cpp70
-rw-r--r--src/widgets/itemviews/qlistview.cpp2
-rw-r--r--src/widgets/kernel/qapplication_qpa.cpp7
-rw-r--r--src/widgets/kernel/qwidget.cpp4
-rw-r--r--src/widgets/styles/qcommonstyle.cpp62
-rw-r--r--src/widgets/styles/qgtkstyle.cpp1
-rw-r--r--src/widgets/styles/qmacstyle_mac.mm26
-rw-r--r--src/widgets/styles/qmacstyle_mac_p.h8
-rw-r--r--src/widgets/styles/qmotifstyle_p.h82
-rw-r--r--src/widgets/widgets/qcombobox.cpp9
-rw-r--r--src/widgets/widgets/qdockwidget.cpp2
96 files changed, 946 insertions, 692 deletions
diff --git a/src/corelib/Qt5CoreConfigExtras.cmake.in b/src/corelib/Qt5CoreConfigExtras.cmake.in
index e5f7e14d82..0df27039d0 100644
--- a/src/corelib/Qt5CoreConfigExtras.cmake.in
+++ b/src/corelib/Qt5CoreConfigExtras.cmake.in
@@ -44,9 +44,9 @@ set(Qt5Core_MOC_EXECUTABLE Qt5::moc)
set(Qt5Core_RCC_EXECUTABLE Qt5::rcc)
!!IF isEmpty(CMAKE_DATA_DIR_IS_ABSOLUTE)
-list(APPEND Qt5Core_INCLUDE_DIRS \"${_qt5_corelib_install_prefix}/mkspecs/default\")
+list(APPEND Qt5Core_INCLUDE_DIRS \"${_qt5_corelib_install_prefix}/mkspecs/$${CMAKE_MKSPEC}\")
!!ELSE
-list(APPEND Qt5Core_INCLUDE_DIRS \"$${CMAKE_DATA_DIR}mkspecs/default\")
+list(APPEND Qt5Core_INCLUDE_DIRS \"$${CMAKE_DATA_DIR}mkspecs/$${CMAKE_MKSPEC}\")
!!ENDIF
!!IF !isEmpty(CMAKE_ADD_FPIE_FLAGS)
diff --git a/src/corelib/global/qconfig-nacl.h b/src/corelib/global/qconfig-nacl.h
index d62b12fba5..d5172aac29 100644
--- a/src/corelib/global/qconfig-nacl.h
+++ b/src/corelib/global/qconfig-nacl.h
@@ -39,6 +39,10 @@
**
****************************************************************************/
+#if 0
+#pragma qt_sync_stop_processing
+#endif
+
#define QT_FONTS_ARE_RESOURCES
/* Data structures */
diff --git a/src/corelib/global/qfeatures.h b/src/corelib/global/qfeatures.h
index 160063fa67..90ef47cf5b 100644
--- a/src/corelib/global/qfeatures.h
+++ b/src/corelib/global/qfeatures.h
@@ -306,6 +306,11 @@
#define QT_NO_NETWORKDISKCACHE
#endif
+// QLocalServer
+#if !defined(QT_NO_LOCALSERVER) && (defined(QT_NO_TEMPORARYFILE))
+#define QT_NO_LOCALSERVER
+#endif
+
// QProgressDialog
#if !defined(QT_NO_PROGRESSDIALOG) && (defined(QT_NO_PROGRESSBAR))
#define QT_NO_PROGRESSDIALOG
diff --git a/src/corelib/global/qfeatures.txt b/src/corelib/global/qfeatures.txt
index 1a721e78b0..3b3af8a3fc 100644
--- a/src/corelib/global/qfeatures.txt
+++ b/src/corelib/global/qfeatures.txt
@@ -727,20 +727,6 @@ Requires:
Name: QWindowsStyle
SeeAlso: ???
-Feature: STYLE_MOTIF
-Description: Supports a Motif look and feel.
-Section: Styles
-Requires:
-Name: QMotifStyle
-SeeAlso: ???
-
-Feature: STYLE_CDE
-Description: Supports a CDE look and feel.
-Section: Styles
-Requires: STYLE_MOTIF
-Name: QCDEStyle
-SeeAlso: ???
-
Feature: STYLE_PLASTIQUE
Description: Supports a widget style similar to the Plastik style available in KDE.
Section: Styles
@@ -1025,6 +1011,12 @@ Requires: LIBRARY NETWORKINTERFACE PROPERTIES
Name: Bearer Management
SeeAlso: ???
+Feature: LOCALSERVER
+Description: Supports a local socket based server
+Section: Networking
+Requires: TEMPORARYFILE
+Name: QLocalServer
+SeeAlso: ???
# Utilities
diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp
index 1ef7af586f..0a928e4603 100644
--- a/src/corelib/io/qprocess_unix.cpp
+++ b/src/corelib/io/qprocess_unix.cpp
@@ -177,7 +177,7 @@ static QProcessManager *processManager()
QMutexLocker locker(&processManagerGlobalMutex);
if (!processManagerInstance)
- QProcessPrivate::initializeProcessManager();
+ new QProcessManager;
Q_ASSERT(processManagerInstance);
return processManagerInstance;
@@ -185,9 +185,6 @@ static QProcessManager *processManager()
QProcessManager::QProcessManager()
{
- // can only be called from main thread
- Q_ASSERT(!qApp || qApp->thread() == QThread::currentThread());
-
#if defined (QPROCESS_DEBUG)
qDebug() << "QProcessManager::QProcessManager()";
#endif
@@ -1434,15 +1431,7 @@ bool QProcessPrivate::startDetached(const QString &program, const QStringList &a
void QProcessPrivate::initializeProcessManager()
{
- if (qApp && qApp->thread() != QThread::currentThread()) {
- // The process manager must be initialized in the main thread
- // Note: The call below will re-enter this function, but in the right thread,
- // so the else statement below will be executed.
- QMetaObject::invokeMethod(qApp, "_q_initializeProcessManager", Qt::BlockingQueuedConnection);
- } else {
- static QProcessManager processManager;
- Q_UNUSED(processManager);
- }
+ (void) processManager();
}
QT_END_NAMESPACE
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index fd423d4479..df0ffce12d 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -264,6 +264,35 @@ struct QCoreApplicationData {
data->deref(); // deletes the data and the adopted thread
}
}
+
+#ifdef Q_OS_BLACKBERRY
+ //The QCoreApplicationData struct is only populated on demand, because it is rarely needed and would
+ //affect startup time
+ void loadManifest() {
+ static bool manifestLoadAttempt = false;
+ if (manifestLoadAttempt)
+ return;
+
+ manifestLoadAttempt = true;
+
+ QFile metafile(QStringLiteral("app/META-INF/MANIFEST.MF"));
+ if (!metafile.open(QIODevice::ReadOnly)) {
+ qWarning() << Q_FUNC_INFO << "Could not open application metafile for reading";
+ } else {
+ while (!metafile.atEnd() && (application.isEmpty() || applicationVersion.isEmpty() || orgName.isEmpty())) {
+ QByteArray line = metafile.readLine();
+ if (line.startsWith("Application-Name:"))
+ application = QString::fromUtf8(line.mid(18).trimmed());
+ else if (line.startsWith("Application-Version:"))
+ applicationVersion = QString::fromUtf8(line.mid(21).trimmed());
+ else if (line.startsWith("Package-Author:"))
+ orgName = QString::fromUtf8(line.mid(16).trimmed());
+ }
+ metafile.close();
+ }
+ }
+#endif
+
QString orgName, orgDomain, application;
QString applicationVersion;
@@ -363,16 +392,6 @@ void QCoreApplicationPrivate::createEventDispatcher()
#endif
}
-void QCoreApplicationPrivate::_q_initializeProcessManager()
-{
-#ifndef QT_NO_PROCESS
-# ifdef Q_OS_UNIX
- QProcessPrivate::initializeProcessManager();
-# endif
-#endif
-}
-
-
QThread *QCoreApplicationPrivate::theMainThread = 0;
QThread *QCoreApplicationPrivate::mainThread()
{
@@ -596,6 +615,12 @@ void QCoreApplication::init()
d->appendApplicationPathToLibraryPaths();
#endif
+#if defined(Q_OS_UNIX) && !(defined(QT_NO_PROCESS))
+ // Make sure the process manager thread object is created in the main
+ // thread.
+ QProcessPrivate::initializeProcessManager();
+#endif
+
#ifdef QT_EVAL
extern void qt_core_eval_init(uint);
qt_core_eval_init(d->application_type);
@@ -1765,6 +1790,15 @@ QString QCoreApplication::applicationFilePath()
#if defined(Q_OS_WIN)
d->cachedApplicationFilePath = QFileInfo(qAppFileName()).filePath();
return d->cachedApplicationFilePath;
+#elif defined(Q_OS_BLACKBERRY)
+ QDir dir(QStringLiteral("./app/native/"));
+ QStringList executables = dir.entryList(QDir::Executable | QDir::Files);
+ if (!executables.empty()) {
+ //We assume that there is only one executable in the folder
+ return dir.absoluteFilePath(executables.first());
+ } else {
+ return QString();
+ }
#elif defined(Q_OS_MAC)
QString qAppFileName_str = qAppFileName();
if(!qAppFileName_str.isEmpty()) {
@@ -1930,6 +1964,9 @@ void QCoreApplication::setOrganizationName(const QString &orgName)
QString QCoreApplication::organizationName()
{
+#ifdef Q_OS_BLACKBERRY
+ coreappdata()->loadManifest();
+#endif
return coreappdata()->orgName;
}
@@ -1977,6 +2014,9 @@ void QCoreApplication::setApplicationName(const QString &application)
QString QCoreApplication::applicationName()
{
+#ifdef Q_OS_BLACKBERRY
+ coreappdata()->loadManifest();
+#endif
QString appname = coreappdata() ? coreappdata()->application : QString();
if (appname.isEmpty() && QCoreApplication::self)
appname = QCoreApplication::self->d_func()->appName();
@@ -2003,6 +2043,9 @@ void QCoreApplication::setApplicationVersion(const QString &version)
QString QCoreApplication::applicationVersion()
{
+#ifdef Q_OS_BLACKBERRY
+ coreappdata()->loadManifest();
+#endif
return coreappdata()->applicationVersion;
}
@@ -2317,5 +2360,3 @@ void QCoreApplication::setEventDispatcher(QAbstractEventDispatcher *eventDispatc
*/
QT_END_NAMESPACE
-
-#include "moc_qcoreapplication.cpp"
diff --git a/src/corelib/kernel/qcoreapplication.h b/src/corelib/kernel/qcoreapplication.h
index 388877cbec..622139e6f8 100644
--- a/src/corelib/kernel/qcoreapplication.h
+++ b/src/corelib/kernel/qcoreapplication.h
@@ -178,7 +178,6 @@ protected:
QCoreApplication(QCoreApplicationPrivate &p);
private:
- Q_PRIVATE_SLOT(d_func(), void _q_initializeProcessManager())
static bool sendSpontaneousEvent(QObject *receiver, QEvent *event);
bool notifyInternal(QObject *receiver, QEvent *event);
diff --git a/src/corelib/kernel/qcoreapplication_p.h b/src/corelib/kernel/qcoreapplication_p.h
index 393ae1c55a..321f6905a4 100644
--- a/src/corelib/kernel/qcoreapplication_p.h
+++ b/src/corelib/kernel/qcoreapplication_p.h
@@ -76,8 +76,6 @@ public:
bool sendThroughObjectEventFilters(QObject *, QEvent *);
bool notify_helper(QObject *, QEvent *);
- void _q_initializeProcessManager();
-
QString appName() const;
virtual void createEventDispatcher();
static void removePostedEvent(QEvent *);
diff --git a/src/corelib/kernel/qeventdispatcher_blackberry.cpp b/src/corelib/kernel/qeventdispatcher_blackberry.cpp
index a553999121..33ca1023dd 100644
--- a/src/corelib/kernel/qeventdispatcher_blackberry.cpp
+++ b/src/corelib/kernel/qeventdispatcher_blackberry.cpp
@@ -295,14 +295,35 @@ int QEventDispatcherBlackberry::select(int nfds, fd_set *readfds, fd_set *writef
if (timeout)
timeout_bps = (timeout->tv_sec * 1000) + (timeout->tv_usec / 1000);
+ bool hasProcessedEventsOnce = false;
+ bps_event_t *event = 0;
+
// This loop exists such that we can drain the bps event queue of all native events
// more efficiently than if we were to return control to Qt after each event. This
// is important for handling touch events which can come in rapidly.
forever {
+ Q_ASSERT(!hasProcessedEventsOnce || event);
+
+ // Only emit the awake() and aboutToBlock() signals in the second iteration. For the first
+ // iteration, the UNIX event dispatcher will have taken care of that already.
+ if (hasProcessedEventsOnce)
+ emit awake();
+
+ // Filtering the native event should happen between the awake() and aboutToBlock() signal
+ // emissions. The calls awake() - filterNativeEvent() - aboutToBlock() - bps_get_event()
+ // need not to be interrupted by a break or return statement.
+ //
+ // Because of this, the native event is actually processed one loop iteration
+ // after it was retrieved with bps_get_event().
+ if (event)
+ filterNativeEvent(QByteArrayLiteral("bps_event_t"), static_cast<void*>(event), 0);
+
+ if (hasProcessedEventsOnce)
+ emit aboutToBlock();
+
// Wait for event or file to be ready
- bps_event_t *event = NULL;
+ event = 0;
const int result = bps_get_event(&event, timeout_bps);
-
if (result != BPS_SUCCESS)
qWarning("QEventDispatcherBlackberry::select: bps_get_event() failed");
@@ -314,14 +335,16 @@ int QEventDispatcherBlackberry::select(int nfds, fd_set *readfds, fd_set *writef
if (!event || bps_event_get_domain(event) == bpsIOReadyDomain)
break;
- // Any other events must be bps native events so we pass all such received
- // events through the native event filter chain
- filterNativeEvent(QByteArrayLiteral("bps_event_t"), static_cast<void*>(event), 0);
-
// Update the timeout. If this fails we have exceeded our alloted time or the system
// clock has changed time and we cannot calculate a new timeout so we bail out.
- if (!updateTimeout(&timeout_bps, startTime))
+ if (!updateTimeout(&timeout_bps, startTime)) {
+
+ // No more loop iteration, so we need to filter the event here.
+ filterNativeEvent(QByteArrayLiteral("bps_event_t"), static_cast<void*>(event), 0);
break;
+ }
+
+ hasProcessedEventsOnce = true;
}
// the number of bits set in the file sets
diff --git a/src/corelib/thread/qmutex.cpp b/src/corelib/thread/qmutex.cpp
index ee1037d4f4..3815ce16a7 100644
--- a/src/corelib/thread/qmutex.cpp
+++ b/src/corelib/thread/qmutex.cpp
@@ -162,8 +162,9 @@ public:
If \a mode is QMutex::Recursive, a thread can lock the same mutex
multiple times and the mutex won't be unlocked until a
- corresponding number of unlock() calls have been made. The
- default is QMutex::NonRecursive.
+ corresponding number of unlock() calls have been made. Otherwise
+ a thread may only lock a mutex once. The default is
+ QMutex::NonRecursive.
\sa lock(), unlock()
*/
@@ -371,6 +372,13 @@ bool QBasicMutex::isRecursive()
\sa unlock()
*/
+/*!
+ \fn QMutex *QMutexLocker::mutex()
+
+ Returns the mutex on which the QMutexLocker is operating.
+
+*/
+
#ifndef QT_LINUX_FUTEX //linux implementation is in qmutex_linux.cpp
/*
diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp
index 5949f9aefe..72bae48eba 100644
--- a/src/corelib/thread/qthread.cpp
+++ b/src/corelib/thread/qthread.cpp
@@ -323,7 +323,8 @@ QThreadPrivate::~QThreadPrivate()
/*!
\fn void QThread::started()
- This signal is emitted when the thread starts executing.
+ This signal is emitted from the associated thread when it starts executing,
+ before the run() function is called.
\sa finished(), terminated()
*/
@@ -331,7 +332,14 @@ QThreadPrivate::~QThreadPrivate()
/*!
\fn void QThread::finished()
- This signal is emitted when the thread has finished executing.
+ This signal is emitted from the associated thread right before it finishes executing.
+
+ When this signal is emitted, the event loop has already stopped running.
+ No more events will be processed in the thread, except for deferred deletion events.
+ This signal can be connected to QObject::deleteLater(), to free objects in that thread.
+
+ \note If the associated thread was terminated using terminate(), it is undefined from
+ which thread this signal is emitted.
\sa started(), terminated()
*/
@@ -341,6 +349,8 @@ QThreadPrivate::~QThreadPrivate()
This signal is emitted when the thread is terminated.
+ It is undefined from which thread this signal is emitted.
+
\sa started(), finished()
*/
diff --git a/src/gui/accessible/qaccessible2.cpp b/src/gui/accessible/qaccessible2.cpp
index e3402ef2e5..7f871f9c5a 100644
--- a/src/gui/accessible/qaccessible2.cpp
+++ b/src/gui/accessible/qaccessible2.cpp
@@ -134,19 +134,184 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn QString QAccessibleTextInterface::textBeforeOffset (int offset, QAccessible2::BoundaryType boundaryType,
- int *startOffset, int *endOffset) const
+ Returns the text item of type \a boundaryType that is close to offset \a offset
+ and sets \a startOffset and \a endOffset values to the start and end positions
+ of that item; returns an empty string if there is no such an item.
+ Sets \a startOffset and \a endOffset values to -1 on error.
*/
+QString QAccessibleTextInterface::textBeforeOffset(int offset, QAccessible2::BoundaryType boundaryType,
+ int *startOffset, int *endOffset) const
+{
+ const QString txt = text(0, characterCount());
+
+ if (txt.isEmpty() || offset < 0 || offset > txt.length()) {
+ *startOffset = *endOffset = -1;
+ return QString();
+ }
+ if (offset == 0) {
+ *startOffset = *endOffset = offset;
+ return QString();
+ }
+
+ QTextBoundaryFinder::BoundaryType type;
+ switch (boundaryType) {
+ case QAccessible2::CharBoundary:
+ type = QTextBoundaryFinder::Grapheme;
+ break;
+ case QAccessible2::WordBoundary:
+ type = QTextBoundaryFinder::Word;
+ break;
+ case QAccessible2::SentenceBoundary:
+ type = QTextBoundaryFinder::Sentence;
+ break;
+ default:
+ // in any other case return the whole line
+ *startOffset = 0;
+ *endOffset = txt.length();
+ return txt;
+ }
+
+ // keep behavior in sync with QTextCursor::movePosition()!
+
+ QTextBoundaryFinder boundary(type, txt);
+ boundary.setPosition(offset);
+
+ do {
+ if ((boundary.boundaryReasons() & (QTextBoundaryFinder::StartOfItem | QTextBoundaryFinder::EndOfItem)))
+ break;
+ } while (boundary.toPreviousBoundary() > 0);
+ Q_ASSERT(boundary.position() >= 0);
+ *endOffset = boundary.position();
+
+ while (boundary.toPreviousBoundary() > 0) {
+ if ((boundary.boundaryReasons() & (QTextBoundaryFinder::StartOfItem | QTextBoundaryFinder::EndOfItem)))
+ break;
+ }
+ Q_ASSERT(boundary.position() >= 0);
+ *startOffset = boundary.position();
+
+ return txt.mid(*startOffset, *endOffset - *startOffset);
+}
/*!
- \fn QString QAccessibleTextInterface::textAfterOffset(int offset, QAccessible2::BoundaryType boundaryType,
- int *startOffset, int *endOffset) const
+ Returns the text item of type \a boundaryType that is right after offset \a offset
+ and sets \a startOffset and \a endOffset values to the start and end positions
+ of that item; returns an empty string if there is no such an item.
+ Sets \a startOffset and \a endOffset values to -1 on error.
*/
+QString QAccessibleTextInterface::textAfterOffset(int offset, QAccessible2::BoundaryType boundaryType,
+ int *startOffset, int *endOffset) const
+{
+ const QString txt = text(0, characterCount());
+
+ if (txt.isEmpty() || offset < 0 || offset > txt.length()) {
+ *startOffset = *endOffset = -1;
+ return QString();
+ }
+ if (offset == txt.length()) {
+ *startOffset = *endOffset = offset;
+ return QString();
+ }
+
+ QTextBoundaryFinder::BoundaryType type;
+ switch (boundaryType) {
+ case QAccessible2::CharBoundary:
+ type = QTextBoundaryFinder::Grapheme;
+ break;
+ case QAccessible2::WordBoundary:
+ type = QTextBoundaryFinder::Word;
+ break;
+ case QAccessible2::SentenceBoundary:
+ type = QTextBoundaryFinder::Sentence;
+ break;
+ default:
+ // in any other case return the whole line
+ *startOffset = 0;
+ *endOffset = txt.length();
+ return txt;
+ }
+
+ // keep behavior in sync with QTextCursor::movePosition()!
+
+ QTextBoundaryFinder boundary(type, txt);
+ boundary.setPosition(offset);
+
+ while (boundary.toNextBoundary() < txt.length()) {
+ if ((boundary.boundaryReasons() & (QTextBoundaryFinder::StartOfItem | QTextBoundaryFinder::EndOfItem)))
+ break;
+ }
+ Q_ASSERT(boundary.position() <= txt.length());
+ *startOffset = boundary.position();
+
+ while (boundary.toNextBoundary() < txt.length()) {
+ if ((boundary.boundaryReasons() & (QTextBoundaryFinder::StartOfItem | QTextBoundaryFinder::EndOfItem)))
+ break;
+ }
+ Q_ASSERT(boundary.position() <= txt.length());
+ *endOffset = boundary.position();
+
+ return txt.mid(*startOffset, *endOffset - *startOffset);
+}
/*!
- \fn QString QAccessibleTextInterface::textAtOffset(int offset, QAccessible2::BoundaryType boundaryType,
- int *startOffset, int *endOffset) const
+ Returns the text item of type \a boundaryType at offset \a offset
+ and sets \a startOffset and \a endOffset values to the start and end positions
+ of that item; returns an empty string if there is no such an item.
+ Sets \a startOffset and \a endOffset values to -1 on error.
*/
+QString QAccessibleTextInterface::textAtOffset(int offset, QAccessible2::BoundaryType boundaryType,
+ int *startOffset, int *endOffset) const
+{
+ const QString txt = text(0, characterCount());
+
+ if (txt.isEmpty() || offset < 0 || offset > txt.length()) {
+ *startOffset = *endOffset = -1;
+ return QString();
+ }
+ if (offset == txt.length()) {
+ *startOffset = *endOffset = offset;
+ return QString();
+ }
+
+ QTextBoundaryFinder::BoundaryType type;
+ switch (boundaryType) {
+ case QAccessible2::CharBoundary:
+ type = QTextBoundaryFinder::Grapheme;
+ break;
+ case QAccessible2::WordBoundary:
+ type = QTextBoundaryFinder::Word;
+ break;
+ case QAccessible2::SentenceBoundary:
+ type = QTextBoundaryFinder::Sentence;
+ break;
+ default:
+ // in any other case return the whole line
+ *startOffset = 0;
+ *endOffset = txt.length();
+ return txt;
+ }
+
+ // keep behavior in sync with QTextCursor::movePosition()!
+
+ QTextBoundaryFinder boundary(type, txt);
+ boundary.setPosition(offset);
+
+ do {
+ if ((boundary.boundaryReasons() & (QTextBoundaryFinder::StartOfItem | QTextBoundaryFinder::EndOfItem)))
+ break;
+ } while (boundary.toPreviousBoundary() > 0);
+ Q_ASSERT(boundary.position() >= 0);
+ *startOffset = boundary.position();
+
+ while (boundary.toNextBoundary() < txt.length()) {
+ if ((boundary.boundaryReasons() & (QTextBoundaryFinder::StartOfItem | QTextBoundaryFinder::EndOfItem)))
+ break;
+ }
+ Q_ASSERT(boundary.position() <= txt.length());
+ *endOffset = boundary.position();
+
+ return txt.mid(*startOffset, *endOffset - *startOffset);
+}
/*!
\fn void QAccessibleTextInterface::removeSelection(int selectionIndex)
@@ -512,117 +677,6 @@ const QString &QAccessibleActionInterface::toggleAction()
return accessibleActionStrings()->toggleAction;
}
-
-/*!
- \internal
-*/
-QString Q_GUI_EXPORT qTextBeforeOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType,
- int *startOffset, int *endOffset, const QString& text)
-{
- QTextBoundaryFinder::BoundaryType type;
- switch (boundaryType) {
- case QAccessible2::CharBoundary:
- type = QTextBoundaryFinder::Grapheme;
- break;
- case QAccessible2::WordBoundary:
- type = QTextBoundaryFinder::Word;
- break;
- case QAccessible2::SentenceBoundary:
- type = QTextBoundaryFinder::Sentence;
- break;
- default:
- // in any other case return the whole line
- *startOffset = 0;
- *endOffset = text.length();
- return text;
- }
-
- QTextBoundaryFinder boundary(type, text);
- boundary.setPosition(offset);
-
- if (!boundary.isAtBoundary()) {
- boundary.toPreviousBoundary();
- }
- boundary.toPreviousBoundary();
- *startOffset = boundary.position();
- boundary.toNextBoundary();
- *endOffset = boundary.position();
-
- return text.mid(*startOffset, *endOffset - *startOffset);
-}
-
-/*!
- \internal
-*/
-QString Q_GUI_EXPORT qTextAfterOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType,
- int *startOffset, int *endOffset, const QString& text)
-{
- QTextBoundaryFinder::BoundaryType type;
- switch (boundaryType) {
- case QAccessible2::CharBoundary:
- type = QTextBoundaryFinder::Grapheme;
- break;
- case QAccessible2::WordBoundary:
- type = QTextBoundaryFinder::Word;
- break;
- case QAccessible2::SentenceBoundary:
- type = QTextBoundaryFinder::Sentence;
- break;
- default:
- // in any other case return the whole line
- *startOffset = 0;
- *endOffset = text.length();
- return text;
- }
-
- QTextBoundaryFinder boundary(type, text);
- boundary.setPosition(offset);
-
- boundary.toNextBoundary();
- *startOffset = boundary.position();
- boundary.toNextBoundary();
- *endOffset = boundary.position();
-
- return text.mid(*startOffset, *endOffset - *startOffset);
-}
-
-/*!
- \internal
-*/
-QString Q_GUI_EXPORT qTextAtOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType,
- int *startOffset, int *endOffset, const QString& text)
-{
- QTextBoundaryFinder::BoundaryType type;
- switch (boundaryType) {
- case QAccessible2::CharBoundary:
- type = QTextBoundaryFinder::Grapheme;
- break;
- case QAccessible2::WordBoundary:
- type = QTextBoundaryFinder::Word;
- break;
- case QAccessible2::SentenceBoundary:
- type = QTextBoundaryFinder::Sentence;
- break;
- default:
- // in any other case return the whole line
- *startOffset = 0;
- *endOffset = text.length();
- return text;
- }
-
- QTextBoundaryFinder boundary(type, text);
- boundary.setPosition(offset);
-
- if (!boundary.isAtBoundary()) {
- boundary.toPreviousBoundary();
- }
- *startOffset = boundary.position();
- boundary.toNextBoundary();
- *endOffset = boundary.position();
-
- return text.mid(*startOffset, *endOffset - *startOffset);
-}
-
QT_END_NAMESPACE
#endif // QT_NO_ACCESSIBILITY
diff --git a/src/gui/accessible/qaccessible2.h b/src/gui/accessible/qaccessible2.h
index ee0215ecf3..c1e7b8b5a2 100644
--- a/src/gui/accessible/qaccessible2.h
+++ b/src/gui/accessible/qaccessible2.h
@@ -83,12 +83,12 @@ public:
// text
virtual QString text(int startOffset, int endOffset) const = 0;
- virtual QString textBeforeOffset (int offset, QAccessible2::BoundaryType boundaryType,
- int *startOffset, int *endOffset) const = 0;
+ virtual QString textBeforeOffset(int offset, QAccessible2::BoundaryType boundaryType,
+ int *startOffset, int *endOffset) const;
virtual QString textAfterOffset(int offset, QAccessible2::BoundaryType boundaryType,
- int *startOffset, int *endOffset) const = 0;
+ int *startOffset, int *endOffset) const;
virtual QString textAtOffset(int offset, QAccessible2::BoundaryType boundaryType,
- int *startOffset, int *endOffset) const = 0;
+ int *startOffset, int *endOffset) const;
virtual int characterCount() const = 0;
// character <-> geometry
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 84f22de322..a67917ca3b 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -1207,6 +1207,10 @@ void QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePriv
QGuiApplicationPrivate::processPlatformPanelEvent(
static_cast<QWindowSystemInterfacePrivate::PlatformPanelEvent *>(e));
break;
+ case QWindowSystemInterfacePrivate::FileOpen:
+ QGuiApplicationPrivate::processFileOpenEvent(
+ static_cast<QWindowSystemInterfacePrivate::FileOpenEvent *>(e));
+ break;
default:
qWarning() << "Unknown user input event type:" << e->type;
break;
@@ -1942,13 +1946,12 @@ void QGuiApplicationPrivate::reportGeometryChange(QWindowSystemInterfacePrivate:
Qt::ScreenOrientation primaryOrientation = s->primaryOrientation();
s->d_func()->updatePrimaryOrientation();
- emit s->sizeChanged(s->size());
emit s->geometryChanged(s->geometry());
- emit s->physicalDotsPerInchXChanged(s->physicalDotsPerInchX());
- emit s->physicalDotsPerInchYChanged(s->physicalDotsPerInchY());
+ emit s->physicalSizeChanged(s->physicalSize());
emit s->physicalDotsPerInchChanged(s->physicalDotsPerInch());
- emit s->availableSizeChanged(s->availableSize());
- emit s->availableGeometryChanged(s->availableGeometry());
+ emit s->logicalDotsPerInchChanged(s->logicalDotsPerInch());
+ foreach (QScreen* sibling, s->virtualSiblings())
+ emit sibling->virtualGeometryChanged(sibling->virtualGeometry());
if (s->primaryOrientation() != primaryOrientation)
emit s->primaryOrientationChanged(s->primaryOrientation());
@@ -1970,8 +1973,8 @@ void QGuiApplicationPrivate::reportAvailableGeometryChange(
QScreen *s = e->screen.data();
s->d_func()->availableGeometry = e->availableGeometry;
- emit s->availableSizeChanged(s->availableSize());
- emit s->availableGeometryChanged(s->availableGeometry());
+ foreach (QScreen* sibling, s->virtualSiblings())
+ emit sibling->virtualGeometryChanged(sibling->virtualGeometry());
}
void QGuiApplicationPrivate::reportLogicalDotsPerInchChange(QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInchEvent *e)
@@ -1986,8 +1989,6 @@ void QGuiApplicationPrivate::reportLogicalDotsPerInchChange(QWindowSystemInterfa
QScreen *s = e->screen.data();
s->d_func()->logicalDpi = QDpi(e->dpiX, e->dpiY);
- emit s->logicalDotsPerInchXChanged(s->logicalDotsPerInchX());
- emit s->logicalDotsPerInchYChanged(s->logicalDotsPerInchY());
emit s->logicalDotsPerInchChanged(s->logicalDotsPerInch());
}
diff --git a/src/gui/kernel/qkeymapper_qpa.cpp b/src/gui/kernel/qkeymapper_qpa.cpp
index 5073720ed8..0c225a4c91 100644
--- a/src/gui/kernel/qkeymapper_qpa.cpp
+++ b/src/gui/kernel/qkeymapper_qpa.cpp
@@ -43,6 +43,8 @@
#include <qdebug.h>
#include <private/qevent_p.h>
#include <private/qlocale_p.h>
+#include <private/qguiapplication_p.h>
+#include <qpa/qplatformintegration.h>
QT_BEGIN_NAMESPACE
@@ -66,7 +68,10 @@ void QKeyMapperPrivate::clearMappings()
QList<int> QKeyMapperPrivate::possibleKeys(QKeyEvent *e)
{
- QList<int> result;
+ QList<int> result = QGuiApplicationPrivate::platformIntegration()->possibleKeys(e);
+ if (!result.isEmpty())
+ return result;
+
if (e->key() && (e->key() != Qt::Key_unknown))
result << int(e->key() + e->modifiers());
else if (!e->text().isEmpty())
diff --git a/src/gui/kernel/qkeysequence.h b/src/gui/kernel/qkeysequence.h
index a8b71645b0..2bb0c73119 100644
--- a/src/gui/kernel/qkeysequence.h
+++ b/src/gui/kernel/qkeysequence.h
@@ -227,11 +227,6 @@ public:
QKeySequence(int) {}
};
-#ifndef QT_NO_DATASTREAM
-Q_GUI_EXPORT QDataStream &operator<<(QDataStream &in, const QKeySequence &ks) {}
-Q_GUI_EXPORT QDataStream &operator>>(QDataStream &in, QKeySequence &ks) {}
-#endif /* #ifndef QT_NO_DATASTREAM */
-
#endif // QT_NO_SHORTCUT
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformintegration.cpp b/src/gui/kernel/qplatformintegration.cpp
index 631f392284..cf55c59bab 100644
--- a/src/gui/kernel/qplatformintegration.cpp
+++ b/src/gui/kernel/qplatformintegration.cpp
@@ -313,6 +313,20 @@ Qt::KeyboardModifiers QPlatformIntegration::queryKeyboardModifiers() const
}
/*!
+ Should be used to obtain a list of possible shortcuts for the given key
+ event. As that needs system functionality it cannot be done in qkeymapper.
+
+ One example for more than 1 possibility is the key combination of Shift+5.
+ That one might trigger a shortcut which is set as "Shift+5" as well as one
+ using %. These combinations depend on the currently set keyboard layout
+ which cannot be obtained by Qt functionality.
+*/
+QList<int> QPlatformIntegration::possibleKeys(const QKeyEvent *) const
+{
+ return QList<int>();
+}
+
+/*!
Should be called by the implementation whenever a new screen is added.
The first screen added will be the primary screen, used for default-created
diff --git a/src/gui/kernel/qplatformintegration.h b/src/gui/kernel/qplatformintegration.h
index 7bc6c276c0..7e8888407c 100644
--- a/src/gui/kernel/qplatformintegration.h
+++ b/src/gui/kernel/qplatformintegration.h
@@ -76,6 +76,7 @@ class QPlatformTheme;
class QPlatformDialogHelper;
class QPlatformSharedGraphicsCache;
class QPlatformServices;
+class QKeyEvent;
class Q_GUI_EXPORT QPlatformIntegration
{
@@ -141,6 +142,7 @@ public:
virtual QVariant styleHint(StyleHint hint) const;
virtual Qt::KeyboardModifiers queryKeyboardModifiers() const;
+ virtual QList<int> possibleKeys(const QKeyEvent *) const;
virtual QStringList themeNames() const;
virtual QPlatformTheme *createPlatformTheme(const QString &name) const;
diff --git a/src/gui/kernel/qplatformwindow.cpp b/src/gui/kernel/qplatformwindow.cpp
index 755fd8a652..27dfd7cf40 100644
--- a/src/gui/kernel/qplatformwindow.cpp
+++ b/src/gui/kernel/qplatformwindow.cpp
@@ -142,17 +142,16 @@ void QPlatformWindow::setVisible(bool visible)
QWindowSystemInterface::handleExposeEvent(window(), rect);
QWindowSystemInterface::flushWindowSystemEvents();
}
+
/*!
Requests setting the window flags of this surface
- to \a type. Returns the actual flags set.
+ to \a flags.
*/
-Qt::WindowFlags QPlatformWindow::setWindowFlags(Qt::WindowFlags flags)
+void QPlatformWindow::setWindowFlags(Qt::WindowFlags flags)
{
- return flags;
+ Q_UNUSED(flags);
}
-
-
/*!
Returns if this window is exposed in the windowing system.
diff --git a/src/gui/kernel/qplatformwindow.h b/src/gui/kernel/qplatformwindow.h
index 7ea17d05aa..2b2d227fcf 100644
--- a/src/gui/kernel/qplatformwindow.h
+++ b/src/gui/kernel/qplatformwindow.h
@@ -90,7 +90,7 @@ public:
virtual QMargins frameMargins() const;
virtual void setVisible(bool visible);
- virtual Qt::WindowFlags setWindowFlags(Qt::WindowFlags flags);
+ virtual void setWindowFlags(Qt::WindowFlags flags);
virtual Qt::WindowState setWindowState(Qt::WindowState state);
virtual WId winId() const;
diff --git a/src/gui/kernel/qscreen.h b/src/gui/kernel/qscreen.h
index 6a47a7be9c..48eaad94f7 100644
--- a/src/gui/kernel/qscreen.h
+++ b/src/gui/kernel/qscreen.h
@@ -70,20 +70,20 @@ class Q_GUI_EXPORT QScreen : public QObject
Q_PROPERTY(QString name READ name CONSTANT)
Q_PROPERTY(int depth READ depth CONSTANT)
- Q_PROPERTY(QSize size READ size NOTIFY sizeChanged)
- Q_PROPERTY(QSize availableSize READ availableSize NOTIFY availableSizeChanged)
- Q_PROPERTY(QSize virtualSize READ virtualSize NOTIFY sizeChanged)
- Q_PROPERTY(QSize availableVirtualSize READ availableVirtualSize NOTIFY availableSizeChanged)
+ Q_PROPERTY(QSize size READ size NOTIFY geometryChanged)
+ Q_PROPERTY(QSize availableSize READ availableSize NOTIFY virtualGeometryChanged)
+ Q_PROPERTY(QSize virtualSize READ virtualSize NOTIFY virtualGeometryChanged)
+ Q_PROPERTY(QSize availableVirtualSize READ availableVirtualSize NOTIFY virtualGeometryChanged)
Q_PROPERTY(QRect geometry READ geometry NOTIFY geometryChanged)
- Q_PROPERTY(QRect availableGeometry READ availableGeometry NOTIFY availableGeometryChanged)
- Q_PROPERTY(QRect virtualGeometry READ virtualGeometry NOTIFY sizeChanged)
- Q_PROPERTY(QRect availableVirtualGeometry READ availableVirtualGeometry NOTIFY availableGeometryChanged)
- Q_PROPERTY(QSizeF physicalSize READ physicalSize CONSTANT)
- Q_PROPERTY(qreal physicalDotsPerInchX READ physicalDotsPerInchX NOTIFY physicalDotsPerInchXChanged)
- Q_PROPERTY(qreal physicalDotsPerInchY READ physicalDotsPerInchY NOTIFY physicalDotsPerInchYChanged)
+ Q_PROPERTY(QRect availableGeometry READ availableGeometry NOTIFY virtualGeometryChanged)
+ Q_PROPERTY(QRect virtualGeometry READ virtualGeometry NOTIFY virtualGeometryChanged)
+ Q_PROPERTY(QRect availableVirtualGeometry READ availableVirtualGeometry NOTIFY virtualGeometryChanged)
+ Q_PROPERTY(QSizeF physicalSize READ physicalSize NOTIFY physicalSizeChanged)
+ Q_PROPERTY(qreal physicalDotsPerInchX READ physicalDotsPerInchX NOTIFY physicalDotsPerInchChanged)
+ Q_PROPERTY(qreal physicalDotsPerInchY READ physicalDotsPerInchY NOTIFY physicalDotsPerInchChanged)
Q_PROPERTY(qreal physicalDotsPerInch READ physicalDotsPerInch NOTIFY physicalDotsPerInchChanged)
- Q_PROPERTY(qreal logicalDotsPerInchX READ logicalDotsPerInchX NOTIFY logicalDotsPerInchXChanged)
- Q_PROPERTY(qreal logicalDotsPerInchY READ logicalDotsPerInchY NOTIFY logicalDotsPerInchYChanged)
+ Q_PROPERTY(qreal logicalDotsPerInchX READ logicalDotsPerInchX NOTIFY logicalDotsPerInchChanged)
+ Q_PROPERTY(qreal logicalDotsPerInchY READ logicalDotsPerInchY NOTIFY logicalDotsPerInchChanged)
Q_PROPERTY(qreal logicalDotsPerInch READ logicalDotsPerInch NOTIFY logicalDotsPerInchChanged)
Q_PROPERTY(Qt::ScreenOrientation primaryOrientation READ primaryOrientation NOTIFY primaryOrientationChanged)
Q_PROPERTY(Qt::ScreenOrientation orientation READ orientation NOTIFY orientationChanged)
@@ -138,16 +138,11 @@ public:
qreal refreshRate() const;
Q_SIGNALS:
- void sizeChanged(const QSize &size);
void geometryChanged(const QRect &geometry);
- void physicalDotsPerInchXChanged(qreal dpi);
- void physicalDotsPerInchYChanged(qreal dpi);
+ void physicalSizeChanged(const QSizeF &size);
void physicalDotsPerInchChanged(qreal dpi);
- void logicalDotsPerInchXChanged(qreal dpi);
- void logicalDotsPerInchYChanged(qreal dpi);
void logicalDotsPerInchChanged(qreal dpi);
- void availableSizeChanged(const QSize &size);
- void availableGeometryChanged(const QRect &rect);
+ void virtualGeometryChanged(const QRect &rect);
void primaryOrientationChanged(Qt::ScreenOrientation orientation);
void orientationChanged(Qt::ScreenOrientation orientation);
void refreshRateChanged(qreal refreshRate);
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index 79927cbc71..27e1571184 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -514,9 +514,8 @@ void QWindow::setWindowFlags(Qt::WindowFlags flags)
{
Q_D(QWindow);
if (d->platformWindow)
- d->windowFlags = d->platformWindow->setWindowFlags(flags);
- else
- d->windowFlags = flags;
+ d->platformWindow->setWindowFlags(flags);
+ d->windowFlags = flags;
}
/*!
diff --git a/src/gui/opengl/qopengl.h b/src/gui/opengl/qopengl.h
index 291c23b85f..5928b0be2f 100644
--- a/src/gui/opengl/qopengl.h
+++ b/src/gui/opengl/qopengl.h
@@ -63,7 +63,7 @@ QT_BEGIN_HEADER
*/
typedef char GLchar;
-# include "qopengles2ext.h"
+# include <QtGui/qopengles2ext.h>
# ifndef GL_DOUBLE
# define GL_DOUBLE GL_FLOAT
# endif
@@ -96,7 +96,7 @@ typedef GLfloat GLdouble;
# include <QtCore/qt_windows.h>
# endif
# include <GL/gl.h>
-# include "qopenglext.h"
+# include <QtGui/qopenglext.h>
# endif // Q_OS_MAC
#endif
diff --git a/src/gui/opengl/qopengles2ext.h b/src/gui/opengl/qopengles2ext.h
index 564bbc8484..61bfb595cc 100644
--- a/src/gui/opengl/qopengles2ext.h
+++ b/src/gui/opengl/qopengles2ext.h
@@ -3,6 +3,7 @@
#if 0
#pragma qt_no_master_include
+#pragma qt_sync_stop_processing
#endif
/* $Revision: 18481 $ on $Date:: 2012-07-11 18:07:26 -0700 #$ */
diff --git a/src/gui/opengl/qopenglext.h b/src/gui/opengl/qopenglext.h
index 070dd993d9..5d21cb6eea 100644
--- a/src/gui/opengl/qopenglext.h
+++ b/src/gui/opengl/qopenglext.h
@@ -3,6 +3,7 @@
#if 0
#pragma qt_no_master_include
+#pragma qt_sync_stop_processing
#endif
#ifdef __cplusplus
diff --git a/src/gui/opengl/qopenglfunctions.h b/src/gui/opengl/qopenglfunctions.h
index 54633ff208..f035e26d81 100644
--- a/src/gui/opengl/qopenglfunctions.h
+++ b/src/gui/opengl/qopenglfunctions.h
@@ -83,6 +83,8 @@ typedef ptrdiff_t qopengl_GLsizeiptr;
#if defined(APIENTRY) && !defined(QOPENGLF_APIENTRY)
# define QOPENGLF_APIENTRY APIENTRY
+#elif defined(GL_APIENTRY) && !defined(QOPENGLF_APIENTRY)
+# define QOPENGLF_APIENTRY GL_APIENTRY
#endif
# ifndef QOPENGLF_APIENTRYP
diff --git a/src/gui/painting/qt_mips_asm_dsp.h b/src/gui/painting/qt_mips_asm_dsp.h
index af724bf7bb..c2fd234d08 100644
--- a/src/gui/painting/qt_mips_asm_dsp.h
+++ b/src/gui/painting/qt_mips_asm_dsp.h
@@ -42,6 +42,10 @@
#ifndef QT_MIPS_ASM_DSP_H
#define QT_MIPS_ASM_DSP_H
+#if 0
+#pragma qt_sync_stop_processing
+#endif
+
#define zero $0
#define AT $1
#define v0 $2
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp
index 65368fd9d8..995d48d450 100644
--- a/src/gui/text/qfont.cpp
+++ b/src/gui/text/qfont.cpp
@@ -760,6 +760,9 @@ QString QFont::family() const
*/
void QFont::setFamily(const QString &family)
{
+ if ((resolve_mask & QFont::FamilyResolved) && d->request.family == family)
+ return;
+
detach();
d->request.family = family;
@@ -793,6 +796,9 @@ QString QFont::styleName() const
*/
void QFont::setStyleName(const QString &styleName)
{
+ if ((resolve_mask & QFont::StyleNameResolved) && d->request.styleName == styleName)
+ return;
+
detach();
d->request.styleName = styleName;
@@ -892,6 +898,9 @@ int QFont::pointSize() const
*/
void QFont::setHintingPreference(HintingPreference hintingPreference)
{
+ if ((resolve_mask & QFont::HintingPreferenceResolved) && d->request.hintingPreference == hintingPreference)
+ return;
+
detach();
d->request.hintingPreference = hintingPreference;
@@ -922,6 +931,9 @@ void QFont::setPointSize(int pointSize)
return;
}
+ if ((resolve_mask & QFont::SizeResolved) && d->request.pointSize == qreal(pointSize))
+ return;
+
detach();
d->request.pointSize = qreal(pointSize);
@@ -944,6 +956,9 @@ void QFont::setPointSizeF(qreal pointSize)
return;
}
+ if ((resolve_mask & QFont::SizeResolved) && d->request.pointSize == pointSize)
+ return;
+
detach();
d->request.pointSize = pointSize;
@@ -979,6 +994,9 @@ void QFont::setPixelSize(int pixelSize)
return;
}
+ if ((resolve_mask & QFont::SizeResolved) && d->request.pixelSize == qreal(pixelSize))
+ return;
+
detach();
d->request.pixelSize = pixelSize;
@@ -1034,6 +1052,9 @@ QFont::Style QFont::style() const
*/
void QFont::setStyle(Style style)
{
+ if ((resolve_mask & QFont::StyleResolved) && d->request.style == style)
+ return;
+
detach();
d->request.style = style;
@@ -1077,6 +1098,9 @@ void QFont::setWeight(int weight)
{
Q_ASSERT_X(weight >= 0 && weight <= 99, "QFont::setWeight", "Weight must be between 0 and 99");
+ if ((resolve_mask & QFont::WeightResolved) && d->request.weight == weight)
+ return;
+
detach();
d->request.weight = weight;
@@ -1122,6 +1146,9 @@ bool QFont::underline() const
*/
void QFont::setUnderline(bool enable)
{
+ if ((resolve_mask & QFont::UnderlineResolved) && d->underline == enable)
+ return;
+
detach();
d->underline = enable;
@@ -1145,6 +1172,9 @@ bool QFont::overline() const
*/
void QFont::setOverline(bool enable)
{
+ if ((resolve_mask & QFont::OverlineResolved) && d->overline == enable)
+ return;
+
detach();
d->overline = enable;
@@ -1169,6 +1199,9 @@ bool QFont::strikeOut() const
*/
void QFont::setStrikeOut(bool enable)
{
+ if ((resolve_mask & QFont::StrikeOutResolved) && d->strikeOut == enable)
+ return;
+
detach();
d->strikeOut = enable;
@@ -1193,6 +1226,9 @@ bool QFont::fixedPitch() const
*/
void QFont::setFixedPitch(bool enable)
{
+ if ((resolve_mask & QFont::FixedPitchResolved) && d->request.fixedPitch == enable)
+ return;
+
detach();
d->request.fixedPitch = enable;
@@ -1223,7 +1259,11 @@ bool QFont::kerning() const
*/
void QFont::setKerning(bool enable)
{
+ if ((resolve_mask & QFont::KerningResolved) && d->kerning == enable)
+ return;
+
detach();
+
d->kerning = enable;
resolve_mask |= QFont::KerningResolved;
}
@@ -1339,13 +1379,13 @@ QFont::StyleHint QFont::styleHint() const
*/
void QFont::setStyleHint(StyleHint hint, StyleStrategy strategy)
{
- detach();
-
if ((resolve_mask & (QFont::StyleHintResolved | QFont::StyleStrategyResolved)) &&
(StyleHint) d->request.styleHint == hint &&
(StyleStrategy) d->request.styleStrategy == strategy)
return;
+ detach();
+
d->request.styleHint = hint;
d->request.styleStrategy = strategy;
resolve_mask |= QFont::StyleHintResolved;
@@ -1360,12 +1400,12 @@ void QFont::setStyleHint(StyleHint hint, StyleStrategy strategy)
*/
void QFont::setStyleStrategy(StyleStrategy s)
{
- detach();
-
if ((resolve_mask & QFont::StyleStrategyResolved) &&
s == (StyleStrategy)d->request.styleStrategy)
return;
+ detach();
+
d->request.styleStrategy = s;
resolve_mask |= QFont::StyleStrategyResolved;
}
@@ -1593,10 +1633,10 @@ QFont::Capitalization QFont::capitalization() const
*/
void QFont::setRawMode(bool enable)
{
- detach();
-
if ((bool) d->rawMode == enable) return;
+ detach();
+
d->rawMode = enable;
}
@@ -2648,9 +2688,9 @@ void QFontCache::clear()
QFontEngineData *QFontCache::findEngineData(const QFontDef &def) const
{
- EngineDataCache::ConstIterator it = engineDataCache.find(def),
- end = engineDataCache.end();
- if (it == end) return 0;
+ EngineDataCache::ConstIterator it = engineDataCache.constFind(def);
+ if (it == engineDataCache.constEnd())
+ return 0;
// found
return it.value();
@@ -2768,7 +2808,7 @@ void QFontCache::timerEvent(QTimerEvent *)
end = engineDataCache.constEnd();
for (; it != end; ++it) {
#ifdef QFONTCACHE_DEBUG
- FC_DEBUG(" %p: ref %2d", it.value(), int(it.value()->ref));
+ FC_DEBUG(" %p: ref %2d", it.value(), int(it.value()->ref.load()));
#endif // QFONTCACHE_DEBUG
diff --git a/src/gui/text/qglyphrun.cpp b/src/gui/text/qglyphrun.cpp
index 48e0b15c85..f46e86e88c 100644
--- a/src/gui/text/qglyphrun.cpp
+++ b/src/gui/text/qglyphrun.cpp
@@ -473,15 +473,15 @@ void QGlyphRun::setBoundingRect(const QRectF &boundingRect)
*/
QRectF QGlyphRun::boundingRect() const
{
- if (!d->boundingRect.isEmpty())
+ if (!d->boundingRect.isEmpty() || !d->rawFont.isValid())
return d->boundingRect;
qreal minX, minY, maxX, maxY;
minX = minY = maxX = maxY = 0;
- for (int i=0; i<qMin(d->glyphPositions.size(), d->glyphIndexes.size()); ++i) {
- QRectF glyphRect = d->rawFont.boundingRect(d->glyphIndexes.at(i));
- glyphRect.translate(d->glyphPositions.at(i));
+ for (int i = 0, n = qMin(d->glyphIndexDataSize, d->glyphPositionDataSize); i < n; ++i) {
+ QRectF glyphRect = d->rawFont.boundingRect(d->glyphIndexData[i]);
+ glyphRect.translate(d->glyphPositionData[i]);
if (i == 0) {
minX = glyphRect.left();
@@ -506,7 +506,7 @@ QRectF QGlyphRun::boundingRect() const
*/
bool QGlyphRun::isEmpty() const
{
- return d->glyphIndexes.isEmpty();
+ return d->glyphIndexDataSize == 0;
}
QT_END_NAMESPACE
diff --git a/src/gui/text/qrawfont.cpp b/src/gui/text/qrawfont.cpp
index dee1abcfbc..f1191bc4b9 100644
--- a/src/gui/text/qrawfont.cpp
+++ b/src/gui/text/qrawfont.cpp
@@ -388,10 +388,7 @@ qreal QRawFont::unitsPerEm() const
*/
qreal QRawFont::lineThickness() const
{
- if (!isValid())
- return 0.0;
-
- return d->fontEngine->lineThickness().toReal();
+ return d->isValid() ? d->fontEngine->lineThickness().toReal() : 0.0;
}
/*!
@@ -400,10 +397,7 @@ qreal QRawFont::lineThickness() const
*/
qreal QRawFont::underlinePosition() const
{
- if (!isValid())
- return 0.0;
-
- return d->fontEngine->underlinePosition().toReal();
+ return d->isValid() ? d->fontEngine->underlinePosition().toReal() : 0.0;
}
/*!
@@ -459,23 +453,28 @@ int QRawFont::weight() const
*/
QVector<quint32> QRawFont::glyphIndexesForString(const QString &text) const
{
- if (!d->isValid())
- return QVector<quint32>();
+ QVector<quint32> glyphIndexes;
+ if (!d->isValid() || text.isEmpty())
+ return glyphIndexes;
+
+ int numGlyphs = text.size();
+ glyphIndexes.resize(numGlyphs);
- int nglyphs = text.size();
- QVarLengthGlyphLayoutArray glyphs(nglyphs);
- if (!glyphIndexesForChars(text.data(), text.size(), glyphs.glyphs, &nglyphs)) {
- glyphs.resize(nglyphs);
- if (!glyphIndexesForChars(text.data(), text.size(), glyphs.glyphs, &nglyphs)) {
+ QGlyphLayout glyphs;
+ glyphs.numGlyphs = numGlyphs;
+ glyphs.glyphs = glyphIndexes.data();
+ if (!d->fontEngine->stringToCMap(text.data(), text.size(), &glyphs, &numGlyphs, QFontEngine::GlyphIndicesOnly)) {
+ glyphIndexes.resize(numGlyphs);
+
+ glyphs.numGlyphs = numGlyphs;
+ glyphs.glyphs = glyphIndexes.data();
+ if (!d->fontEngine->stringToCMap(text.data(), text.size(), &glyphs, &numGlyphs, QFontEngine::GlyphIndicesOnly)) {
Q_ASSERT_X(false, Q_FUNC_INFO, "stringToCMap shouldn't fail twice");
return QVector<quint32>();
}
}
- QVector<quint32> glyphIndexes;
- for (int i=0; i<nglyphs; ++i)
- glyphIndexes.append(glyphs.glyphs[i]);
-
+ glyphIndexes.resize(numGlyphs);
return glyphIndexes;
}
@@ -491,38 +490,32 @@ QVector<quint32> QRawFont::glyphIndexesForString(const QString &text) const
*/
bool QRawFont::glyphIndexesForChars(const QChar *chars, int numChars, quint32 *glyphIndexes, int *numGlyphs) const
{
- if (!d->isValid())
+ Q_ASSERT(numGlyphs);
+ if (!d->isValid() || numChars <= 0) {
+ *numGlyphs = 0;
+ return false;
+ }
+
+ if (*numGlyphs <= 0 || !glyphIndexes) {
+ *numGlyphs = numChars;
return false;
+ }
QGlyphLayout glyphs;
+ glyphs.numGlyphs = *numGlyphs;
glyphs.glyphs = glyphIndexes;
return d->fontEngine->stringToCMap(chars, numChars, &glyphs, numGlyphs, QFontEngine::GlyphIndicesOnly);
}
/*!
+ \fn QVector<QPointF> QRawFont::advancesForGlyphIndexes(const QVector<quint32> &glyphIndexes) const
+
Returns the QRawFont's advances for each of the \a glyphIndexes in pixel units. The advances
give the distance from the position of a given glyph to where the next glyph should be drawn
to make it appear as if the two glyphs are unspaced.
\sa QTextLine::horizontalAdvance(), QFontMetricsF::width()
*/
-QVector<QPointF> QRawFont::advancesForGlyphIndexes(const QVector<quint32> &glyphIndexes) const
-{
- if (!d->isValid())
- return QVector<QPointF>();
-
- int numGlyphs = glyphIndexes.size();
- QVarLengthGlyphLayoutArray glyphs(numGlyphs);
- memcpy(glyphs.glyphs, glyphIndexes.data(), numGlyphs * sizeof(quint32));
-
- d->fontEngine->recalcAdvances(&glyphs, 0);
-
- QVector<QPointF> advances;
- for (int i=0; i<numGlyphs; ++i)
- advances.append(QPointF(glyphs.advances_x[i].toReal(), glyphs.advances_y[i].toReal()));
-
- return advances;
-}
/*!
Returns the QRawFont's advances for each of the \a glyphIndexes in pixel units. The advances
@@ -535,7 +528,8 @@ QVector<QPointF> QRawFont::advancesForGlyphIndexes(const QVector<quint32> &glyph
*/
bool QRawFont::advancesForGlyphIndexes(const quint32 *glyphIndexes, QPointF *advances, int numGlyphs) const
{
- if (!d->isValid())
+ Q_ASSERT(glyphIndexes && advances);
+ if (!d->isValid() || numGlyphs <= 0)
return false;
QGlyphLayout glyphs;
diff --git a/src/gui/text/qrawfont.h b/src/gui/text/qrawfont.h
index 1dbde27c73..98314809e8 100644
--- a/src/gui/text/qrawfont.h
+++ b/src/gui/text/qrawfont.h
@@ -94,7 +94,7 @@ public:
int weight() const;
QVector<quint32> glyphIndexesForString(const QString &text) const;
- QVector<QPointF> advancesForGlyphIndexes(const QVector<quint32> &glyphIndexes) const;
+ inline QVector<QPointF> advancesForGlyphIndexes(const QVector<quint32> &glyphIndexes) const;
bool glyphIndexesForChars(const QChar *chars, int numChars, quint32 *glyphIndexes, int *numGlyphs) const;
bool advancesForGlyphIndexes(const quint32 *glyphIndexes, QPointF *advances, int numGlyphs) const;
@@ -147,6 +147,14 @@ private:
Q_DECLARE_SHARED(QRawFont)
+inline QVector<QPointF> QRawFont::advancesForGlyphIndexes(const QVector<quint32> &glyphIndexes) const
+{
+ QVector<QPointF> advances(glyphIndexes.size());
+ if (advancesForGlyphIndexes(glyphIndexes.constData(), advances.data(), glyphIndexes.size()))
+ return advances;
+ return QVector<QPointF>();
+}
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index 8527a85369..38fe2f8140 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -157,27 +157,27 @@ private:
m_splitter->setPosition(start);
QScriptAnalysis itemAnalysis = m_analysis[start];
- if (m_splitter->boundaryReasons() & QTextBoundaryFinder::StartWord) {
+ if (m_splitter->boundaryReasons() & QTextBoundaryFinder::StartOfItem)
itemAnalysis.flags = QScriptAnalysis::Uppercase;
- m_splitter->toNextBoundary();
- }
+
+ m_splitter->toNextBoundary();
const int end = start + length;
for (int i = start + 1; i < end; ++i) {
-
- bool atWordBoundary = false;
+ bool atWordStart = false;
if (i == m_splitter->position()) {
- if (m_splitter->boundaryReasons() & QTextBoundaryFinder::StartWord
- && m_analysis[i].flags < QScriptAnalysis::TabOrObject)
- atWordBoundary = true;
+ if (m_splitter->boundaryReasons() & QTextBoundaryFinder::StartOfItem) {
+ Q_ASSERT(m_analysis[i].flags < QScriptAnalysis::TabOrObject);
+ atWordStart = true;
+ }
m_splitter->toNextBoundary();
}
if (m_analysis[i] == itemAnalysis
&& m_analysis[i].flags < QScriptAnalysis::TabOrObject
- && !atWordBoundary
+ && !atWordStart
&& i - start < MaxItemLength)
continue;
@@ -185,7 +185,7 @@ private:
start = i;
itemAnalysis = m_analysis[start];
- if (atWordBoundary)
+ if (atWordStart)
itemAnalysis.flags = QScriptAnalysis::Uppercase;
}
m_items.append(QScriptItem(start, itemAnalysis));
@@ -1799,7 +1799,6 @@ struct QJustificationPoint {
int type;
QFixed kashidaWidth;
QGlyphLayout glyph;
- QFontEngine *fontEngine;
};
Q_DECLARE_TYPEINFO(QJustificationPoint, Q_PRIMITIVE_TYPE);
@@ -1808,7 +1807,6 @@ static void set(QJustificationPoint *point, int type, const QGlyphLayout &glyph,
{
point->type = type;
point->glyph = glyph;
- point->fontEngine = fe;
if (type >= HB_Arabic_Normal) {
QChar ch(0x640); // Kashida character
@@ -2741,13 +2739,13 @@ void QTextEngine::resolveAdditionalFormats() const
const QScriptItem *si = &layoutData->items.at(i);
int end = si->position + length(si);
- while (startIt != addFormatSortedByStart.end() &&
+ while (startIt != addFormatSortedByStart.constEnd() &&
specialData->addFormats.at(*startIt).start <= si->position) {
currentFormats.insert(std::upper_bound(currentFormats.begin(), currentFormats.end(), *startIt),
*startIt);
++startIt;
}
- while (endIt != addFormatSortedByEnd.end() &&
+ while (endIt != addFormatSortedByEnd.constEnd() &&
specialData->addFormats.at(*endIt).start + specialData->addFormats.at(*endIt).length < end) {
currentFormats.remove(qBinaryFind(currentFormats, *endIt) - currentFormats.begin());
++endIt;
diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp
index 6607c427f5..90cdd7e072 100644
--- a/src/gui/text/qtextformat.cpp
+++ b/src/gui/text/qtextformat.cpp
@@ -3358,8 +3358,8 @@ int QTextFormatCollection::indexForFormat(const QTextFormat &format)
bool QTextFormatCollection::hasFormatCached(const QTextFormat &format) const
{
uint hash = getHash(format.d, format.format_type);
- QMultiHash<uint, int>::const_iterator i = hashes.find(hash);
- while (i != hashes.end() && i.key() == hash) {
+ QMultiHash<uint, int>::const_iterator i = hashes.constFind(hash);
+ while (i != hashes.constEnd() && i.key() == hash) {
if (formats.value(i.value()) == format) {
return true;
}
diff --git a/src/gui/text/qtextobject.cpp b/src/gui/text/qtextobject.cpp
index abe1035cd1..349f8869fd 100644
--- a/src/gui/text/qtextobject.cpp
+++ b/src/gui/text/qtextobject.cpp
@@ -1185,8 +1185,15 @@ Qt::LayoutDirection QTextBlock::textDirection() const
const QChar *p = buffer.constData() + frag->stringPosition;
const QChar * const end = p + frag->size_array[0];
while (p < end) {
- switch(QChar::direction(p->unicode()))
- {
+ uint ucs4 = p->unicode();
+ if (QChar::isHighSurrogate(ucs4) && p + 1 < end) {
+ ushort low = p[1].unicode();
+ if (QChar::isLowSurrogate(low)) {
+ ucs4 = QChar::surrogateToUcs4(ucs4, low);
+ ++p;
+ }
+ }
+ switch (QChar::direction(ucs4)) {
case QChar::DirL:
return Qt::LeftToRight;
case QChar::DirR:
diff --git a/src/network/access/qnetworkdiskcache.cpp b/src/network/access/qnetworkdiskcache.cpp
index 04ba45e90e..86dd57b353 100644
--- a/src/network/access/qnetworkdiskcache.cpp
+++ b/src/network/access/qnetworkdiskcache.cpp
@@ -78,7 +78,7 @@ QT_BEGIN_NAMESPACE
and ends in ".cache". Data is written to disk only in insert()
and updateMetaData().
- Currently you can not share the same cache files with more then
+ Currently you cannot share the same cache files with more than
one disk cache.
QNetworkDiskCache by default limits the amount of space that the cache will
diff --git a/src/network/kernel/qnetworkfunctions_wince.h b/src/network/kernel/qnetworkfunctions_wince.h
index ebbdebb2f1..09caab06eb 100644
--- a/src/network/kernel/qnetworkfunctions_wince.h
+++ b/src/network/kernel/qnetworkfunctions_wince.h
@@ -42,6 +42,10 @@
#ifndef QNETWORKFUNCTIONS_WINCE_H
#define QNETWORKFUNCTIONS_WINCE_H
+#if 0
+#pragma qt_sync_stop_processing
+#endif
+
#ifdef Q_OS_WINCE
#include <qt_windows.h>
diff --git a/src/opengl/qglfunctions.h b/src/opengl/qglfunctions.h
index 3989063f96..3d49b3ea3b 100644
--- a/src/opengl/qglfunctions.h
+++ b/src/opengl/qglfunctions.h
@@ -61,6 +61,11 @@ QT_BEGIN_NAMESPACE
typedef ptrdiff_t qgl_GLintptr;
typedef ptrdiff_t qgl_GLsizeiptr;
+#if defined(APIENTRY) && !defined(QGLF_APIENTRY)
+# define QGLF_APIENTRY APIENTRY
+#elif defined(GL_APIENTRY) && !defined(QGLF_APIENTRY)
+# define QGLF_APIENTRY GL_APIENTRY
+#endif
# ifndef QGLF_APIENTRYP
# ifdef QGLF_APIENTRY
diff --git a/src/platformsupport/fbconvenience/qfbwindow.cpp b/src/platformsupport/fbconvenience/qfbwindow.cpp
index fd89e1b559..598e96886d 100644
--- a/src/platformsupport/fbconvenience/qfbwindow.cpp
+++ b/src/platformsupport/fbconvenience/qfbwindow.cpp
@@ -76,11 +76,10 @@ void QFbWindow::setGeometry(const QRect &rect)
QPlatformWindow::setGeometry(rect);
}
-Qt::WindowFlags QFbWindow::setWindowFlags(Qt::WindowFlags flags)
+void QFbWindow::setWindowFlags(Qt::WindowFlags flags)
{
mWindowFlags = flags;
platformScreen()->invalidateRectCache();
- return mWindowFlags;
}
Qt::WindowFlags QFbWindow::windowFlags() const
diff --git a/src/platformsupport/fbconvenience/qfbwindow_p.h b/src/platformsupport/fbconvenience/qfbwindow_p.h
index 67b2ef87cd..e440e04e39 100644
--- a/src/platformsupport/fbconvenience/qfbwindow_p.h
+++ b/src/platformsupport/fbconvenience/qfbwindow_p.h
@@ -60,7 +60,7 @@ public:
void setGeometry(const QRect &rect);
- virtual Qt::WindowFlags setWindowFlags(Qt::WindowFlags type);
+ virtual void setWindowFlags(Qt::WindowFlags type);
virtual Qt::WindowFlags windowFlags() const;
WId winId() const { return mWindowId; }
diff --git a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp
index a4a4d66012..33c0750263 100644
--- a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp
+++ b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp
@@ -707,7 +707,8 @@ void AtSpiAdaptor::setBitFlag(const QString &flag)
sendObject_text_selection_changed = 1;
} else if (right.startsWith(QLatin1String("ValueChanged"))) {
sendObject_value_changed = 1;
- } else if (right.startsWith(QLatin1String("VisibleDataChanged"))) {
+ } else if (right.startsWith(QLatin1String("VisibleDataChanged"))
+ || right.startsWith(QLatin1String("VisibledataChanged"))) { // typo in libatspi
sendObject_visible_data_changed = 1;
} else {
qAtspiDebug() << "WARNING: subscription string not handled:" << flag;
@@ -1277,7 +1278,16 @@ bool AtSpiAdaptor::applicationInterface(const QAIPointer &interface, const QStri
QDBusMessage reply = message.createReply(QVariant::fromValue(QDBusVariant(QLatin1String("Qt"))));
return connection.send(reply);
}
-
+ if (function == QLatin1String("GetVersion")) {
+ Q_ASSERT(message.signature() == QLatin1String("ss"));
+ QDBusMessage reply = message.createReply(QVariant::fromValue(QDBusVariant(QLatin1String(qVersion()))));
+ return connection.send(reply);
+ }
+ if (function == QLatin1String("GetLocale")) {
+ Q_ASSERT(message.signature() == QLatin1String("u"));
+ QDBusMessage reply = message.createReply(QVariant::fromValue(QLocale().name()));
+ return connection.send(reply);
+ }
qAtspiDebug() << "AtSpiAdaptor::applicationInterface " << message.path() << interface << function;
return false;
}
diff --git a/src/plugins/accessible/widgets/itemviews.cpp b/src/plugins/accessible/widgets/itemviews.cpp
index a8c42c9f59..649863ed84 100644
--- a/src/plugins/accessible/widgets/itemviews.cpp
+++ b/src/plugins/accessible/widgets/itemviews.cpp
@@ -407,7 +407,7 @@ QModelIndex QAccessibleTree::indexFromLogical(int row, int column) const
return QModelIndex();
const QTreeView *treeView = qobject_cast<const QTreeView*>(view());
- if (treeView->d_func()->viewItems.count() <= row) {
+ if ((row < 0) || (column < 0) || (treeView->d_func()->viewItems.count() <= row)) {
qWarning() << "QAccessibleTree::indexFromLogical: invalid index: " << row << column << " for " << treeView;
return QModelIndex();
}
diff --git a/src/plugins/accessible/widgets/qaccessiblewidgets.cpp b/src/plugins/accessible/widgets/qaccessiblewidgets.cpp
index 5f3f0bc3de..ad5ef69da4 100644
--- a/src/plugins/accessible/widgets/qaccessiblewidgets.cpp
+++ b/src/plugins/accessible/widgets/qaccessiblewidgets.cpp
@@ -949,7 +949,7 @@ QPair< int, int > QAccessibleTextWidget::getBoundaries(int offset, BoundaryType
sentenceFinder.setPosition(offsetWithinBlockText);
int prevBoundary = offsetWithinBlockText;
int nextBoundary = offsetWithinBlockText;
- if (!sentenceFinder.isAtBoundary())
+ if (!(sentenceFinder.boundaryReasons() & QTextBoundaryFinder::StartOfItem))
prevBoundary = sentenceFinder.toPreviousBoundary();
nextBoundary = sentenceFinder.toNextBoundary();
if (nextBoundary != -1)
diff --git a/src/plugins/accessible/widgets/simplewidgets.cpp b/src/plugins/accessible/widgets/simplewidgets.cpp
index 2015929010..bb90061a7e 100644
--- a/src/plugins/accessible/widgets/simplewidgets.cpp
+++ b/src/plugins/accessible/widgets/simplewidgets.cpp
@@ -72,13 +72,6 @@ extern QList<QWidget*> childWidgets(const QWidget *widget, bool includeTopLevel
QString Q_GUI_EXPORT qt_accStripAmp(const QString &text);
QString Q_GUI_EXPORT qt_accHotKey(const QString &text);
-QString Q_GUI_EXPORT qTextBeforeOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType,
- int *startOffset, int *endOffset, const QString& text);
-QString Q_GUI_EXPORT qTextAtOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType,
- int *startOffset, int *endOffset, const QString& text);
-QString Q_GUI_EXPORT qTextAfterOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType,
- int *startOffset, int *endOffset, const QString& text);
-
/*!
\class QAccessibleButton
\brief The QAccessibleButton class implements the QAccessibleInterface for button type widgets.
@@ -725,7 +718,7 @@ QString QAccessibleLineEdit::textBeforeOffset(int offset, BoundaryType boundaryT
*startOffset = *endOffset = -1;
return QString();
}
- return qTextBeforeOffsetFromString(offset, boundaryType, startOffset, endOffset, lineEdit()->text());
+ return QAccessibleTextInterface::textBeforeOffset(offset, boundaryType, startOffset, endOffset);
}
QString QAccessibleLineEdit::textAfterOffset(int offset, BoundaryType boundaryType,
@@ -735,7 +728,7 @@ QString QAccessibleLineEdit::textAfterOffset(int offset, BoundaryType boundaryTy
*startOffset = *endOffset = -1;
return QString();
}
- return qTextAfterOffsetFromString(offset, boundaryType, startOffset, endOffset, lineEdit()->text());
+ return QAccessibleTextInterface::textAfterOffset(offset, boundaryType, startOffset, endOffset);
}
QString QAccessibleLineEdit::textAtOffset(int offset, BoundaryType boundaryType,
@@ -745,7 +738,7 @@ QString QAccessibleLineEdit::textAtOffset(int offset, BoundaryType boundaryType,
*startOffset = *endOffset = -1;
return QString();
}
- return qTextAtOffsetFromString(offset, boundaryType, startOffset, endOffset, lineEdit()->text());
+ return QAccessibleTextInterface::textAtOffset(offset, boundaryType, startOffset, endOffset);
}
void QAccessibleLineEdit::removeSelection(int selectionIndex)
diff --git a/src/plugins/platforms/cocoa/qcocoanativeinterface.h b/src/plugins/platforms/cocoa/qcocoanativeinterface.h
index 6f99dc458a..e4b52b9454 100644
--- a/src/plugins/platforms/cocoa/qcocoanativeinterface.h
+++ b/src/plugins/platforms/cocoa/qcocoanativeinterface.h
@@ -56,8 +56,11 @@ class QCocoaNativeInterface : public QPlatformNativeInterface
public:
QCocoaNativeInterface();
+ void *nativeResourceForContext(const QByteArray &resourceString, QOpenGLContext *context);
void *nativeResourceForWindow(const QByteArray &resourceString, QWindow *window);
+ static void *cglContextForContext(QOpenGLContext *context);
+
public Q_SLOTS:
void onAppFocusWindowChanged(QWindow *window);
diff --git a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm
index e5040080ed..7f37b971d7 100644
--- a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm
+++ b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm
@@ -65,6 +65,17 @@ QCocoaNativeInterface::QCocoaNativeInterface()
{
}
+void *QCocoaNativeInterface::nativeResourceForContext(const QByteArray &resourceString, QOpenGLContext *context)
+{
+ if (!context)
+ return 0;
+
+ if (resourceString.toLower() == "cglcontextobj")
+ return cglContextForContext(context);
+
+ return 0;
+}
+
void *QCocoaNativeInterface::nativeResourceForWindow(const QByteArray &resourceString, QWindow *window)
{
if (!window->handle()) {
@@ -109,4 +120,17 @@ void QCocoaNativeInterface::onAppFocusWindowChanged(QWindow *window)
QCocoaMenuBar::updateMenuBarImmediately();
}
+void *QCocoaNativeInterface::cglContextForContext(QOpenGLContext* context)
+{
+ if (context) {
+ QCocoaGLContext *cocoaGLContext = static_cast<QCocoaGLContext *>(context->handle());
+ if (cocoaGLContext) {
+ NSOpenGLContext *nsOpenGLContext = cocoaGLContext->nsOpenGLContext();
+ if (nsOpenGLContext)
+ return [nsOpenGLContext CGLContextObj];
+ }
+ }
+ return 0;
+}
+
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h
index 4a146767d5..014db378e7 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.h
+++ b/src/plugins/platforms/cocoa/qcocoawindow.h
@@ -98,7 +98,7 @@ public:
void setGeometry(const QRect &rect);
void setCocoaGeometry(const QRect &rect);
void setVisible(bool visible);
- Qt::WindowFlags setWindowFlags(Qt::WindowFlags flags);
+ void setWindowFlags(Qt::WindowFlags flags);
Qt::WindowState setWindowState(Qt::WindowState state);
void setWindowTitle(const QString &title);
void setWindowFilePath(const QString &filePath);
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index 26161b106e..f4a4936c28 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -387,7 +387,7 @@ void QCocoaWindow::setWindowShadow(Qt::WindowFlags flags)
[m_nsWindow setHasShadow:(keepShadow ? YES : NO)];
}
-Qt::WindowFlags QCocoaWindow::setWindowFlags(Qt::WindowFlags flags)
+void QCocoaWindow::setWindowFlags(Qt::WindowFlags flags)
{
if (m_nsWindow) {
NSUInteger styleMask = windowStyleMask(flags);
@@ -398,7 +398,6 @@ Qt::WindowFlags QCocoaWindow::setWindowFlags(Qt::WindowFlags flags)
}
m_windowFlags = flags;
- return m_windowFlags;
}
Qt::WindowState QCocoaWindow::setWindowState(Qt::WindowState state)
diff --git a/src/plugins/platforms/directfb/qdirectfbwindow.cpp b/src/plugins/platforms/directfb/qdirectfbwindow.cpp
index 8b108eeaa2..630e4fd7a2 100644
--- a/src/plugins/platforms/directfb/qdirectfbwindow.cpp
+++ b/src/plugins/platforms/directfb/qdirectfbwindow.cpp
@@ -140,7 +140,7 @@ void QDirectFbWindow::setVisible(bool visible)
QWindowSystemInterface::handleExposeEvent(window(), window()->geometry());
}
-Qt::WindowFlags QDirectFbWindow::setWindowFlags(Qt::WindowFlags flags)
+void QDirectFbWindow::setWindowFlags(Qt::WindowFlags flags)
{
switch (flags & Qt::WindowType_Mask) {
case Qt::ToolTip: {
@@ -154,7 +154,6 @@ Qt::WindowFlags QDirectFbWindow::setWindowFlags(Qt::WindowFlags flags)
}
m_dfbWindow->SetStackingClass(m_dfbWindow.data(), flags & Qt::WindowStaysOnTopHint ? DWSC_UPPER : DWSC_MIDDLE);
- return flags;
}
void QDirectFbWindow::raise()
diff --git a/src/plugins/platforms/directfb/qdirectfbwindow.h b/src/plugins/platforms/directfb/qdirectfbwindow.h
index cedd140809..3edee7c6b2 100644
--- a/src/plugins/platforms/directfb/qdirectfbwindow.h
+++ b/src/plugins/platforms/directfb/qdirectfbwindow.h
@@ -60,7 +60,7 @@ public:
void setVisible(bool visible);
- Qt::WindowFlags setWindowFlags(Qt::WindowFlags flags);
+ void setWindowFlags(Qt::WindowFlags flags);
bool setKeyboardGrabEnabled(bool grab);
bool setMouseGrabEnabled(bool grab);
void raise();
diff --git a/src/plugins/platforms/qnx/qqnxbuffer.cpp b/src/plugins/platforms/qnx/qqnxbuffer.cpp
index ed3ea49d44..9007af7f70 100644
--- a/src/plugins/platforms/qnx/qqnxbuffer.cpp
+++ b/src/plugins/platforms/qnx/qqnxbuffer.cpp
@@ -88,7 +88,7 @@ QQnxBuffer::QQnxBuffer(screen_buffer_t buffer)
if (result != 0) {
qFatal("QQNX: failed to query buffer pointer, errno=%d", errno);
}
- if (dataPtr == NULL) {
+ if (dataPtr == 0) {
qFatal("QQNX: buffer pointer is NULL, errno=%d", errno);
}
diff --git a/src/plugins/platforms/qnx/qqnxbuffer.h b/src/plugins/platforms/qnx/qqnxbuffer.h
index 7788778a4a..d5adeb8d8b 100644
--- a/src/plugins/platforms/qnx/qqnxbuffer.h
+++ b/src/plugins/platforms/qnx/qqnxbuffer.h
@@ -57,8 +57,8 @@ public:
virtual ~QQnxBuffer();
screen_buffer_t nativeBuffer() const { return m_buffer; }
- const QImage *image() const { return (m_buffer != NULL) ? &m_image : NULL; }
- QImage *image() { return (m_buffer != NULL) ? &m_image : NULL; }
+ const QImage *image() const { return (m_buffer != 0) ? &m_image : 0; }
+ QImage *image() { return (m_buffer != 0) ? &m_image : 0; }
QRect rect() const { return m_image.rect(); }
diff --git a/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp b/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp
index 72a967d5e5..30ca8a5c48 100644
--- a/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp
+++ b/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp
@@ -571,7 +571,7 @@ spannable_string_t *toSpannableString(const QString &text)
spannable_string_t *pString = reinterpret_cast<spannable_string_t *>(malloc(sizeof(spannable_string_t)));
pString->str = (wchar_t *)malloc(sizeof(wchar_t) * text.length() + 1);
pString->length = text.length();
- pString->spans = NULL;
+ pString->spans = 0;
pString->spans_count = 0;
const QChar *pData = text.constData();
@@ -601,7 +601,7 @@ static bool s_imfInitFailed = false;
static bool imfAvailable()
{
- static bool s_imfDisabled = getenv("DISABLE_IMF") != NULL;
+ static bool s_imfDisabled = getenv("DISABLE_IMF") != 0;
static bool s_imfReady = false;
if ( s_imfInitFailed || s_imfDisabled) {
@@ -611,7 +611,7 @@ static bool imfAvailable()
return true;
}
- if ( p_imf_client_init == NULL ) {
+ if ( p_imf_client_init == 0 ) {
void *handle = dlopen("libinput_client.so.1", 0);
if ( handle ) {
p_imf_client_init = (int32_t (*)()) dlsym(handle, "imf_client_init");
@@ -632,8 +632,8 @@ static bool imfAvailable()
s_imfReady = true;
}
else {
- p_ictrl_open_session = NULL;
- p_ictrl_dispatch_event = NULL;
+ p_ictrl_open_session = 0;
+ p_ictrl_dispatch_event = 0;
s_imfDisabled = true;
qCritical() << Q_FUNC_INFO << "libinput_client.so.1 did not contain the correct symbols, library mismatch? IMF services are disabled.";
return false;
diff --git a/src/plugins/platforms/qnx/qqnxscreen.cpp b/src/plugins/platforms/qnx/qqnxscreen.cpp
index 6a092f01a0..593bec8458 100644
--- a/src/plugins/platforms/qnx/qqnxscreen.cpp
+++ b/src/plugins/platforms/qnx/qqnxscreen.cpp
@@ -524,7 +524,7 @@ void QQnxScreen::newWindowCreated(void *window)
{
Q_ASSERT(thread() == QThread::currentThread());
const screen_window_t windowHandle = reinterpret_cast<screen_window_t>(window);
- screen_display_t display = NULL;
+ screen_display_t display = 0;
if (screen_get_window_property_pv(windowHandle, SCREEN_PROPERTY_DISPLAY, (void**)&display) != 0) {
qWarning("QQnx: Failed to get screen for window, errno=%d", errno);
return;
diff --git a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp
index 621440ed53..d8712bf569 100644
--- a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp
+++ b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp
@@ -462,7 +462,7 @@ void QQnxScreenEventHandler::handleCreateEvent(screen_event_t event)
void QQnxScreenEventHandler::handleDisplayEvent(screen_event_t event)
{
- screen_display_t nativeDisplay = NULL;
+ screen_display_t nativeDisplay = 0;
if (screen_get_event_property_pv(event, SCREEN_PROPERTY_DISPLAY, (void **)&nativeDisplay) != 0) {
qWarning("QQnx: failed to query display property, errno=%d", errno);
return;
diff --git a/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.cpp b/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.cpp
index 4618b90f81..ab912927bb 100644
--- a/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.cpp
+++ b/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.cpp
@@ -130,7 +130,7 @@ bool QQnxVirtualKeyboardPps::connect()
m_decoder = new pps_decoder_t;
pps_encoder_initialize(m_encoder, false);
- pps_decoder_initialize(m_decoder, NULL);
+ pps_decoder_initialize(m_decoder, 0);
errno = 0;
m_fd = ::open(ms_PPSPath, O_RDWR);
@@ -197,7 +197,7 @@ void QQnxVirtualKeyboardPps::ppsDataReady()
m_buffer[nread] = 0;
pps_decoder_parse_pps_str(m_decoder, m_buffer);
- pps_decoder_push(m_decoder, NULL);
+ pps_decoder_push(m_decoder, 0);
#if defined(QQNXVIRTUALKEYBOARD_DEBUG)
pps_decoder_dump_tree(m_decoder, stderr);
#endif
diff --git a/src/plugins/platforms/windows/qtwindowsglobal.h b/src/plugins/platforms/windows/qtwindowsglobal.h
index 6eb3bdee10..73f963b6b8 100644
--- a/src/plugins/platforms/windows/qtwindowsglobal.h
+++ b/src/plugins/platforms/windows/qtwindowsglobal.h
@@ -104,6 +104,7 @@ enum WindowsEventType // Simplify event types
InputMethodRequest = InputMethodEventFlag + 6,
ThemeChanged = ThemingEventFlag + 1,
DisplayChangedEvent = 437,
+ SettingChangedEvent = DisplayChangedEvent + 1,
UnknownEvent = 542
};
@@ -184,6 +185,11 @@ inline QtWindows::WindowsEventType windowsEventType(UINT message, WPARAM wParamI
return QtWindows::FocusInEvent;
case WM_KILLFOCUS:
return QtWindows::FocusOutEvent;
+ // Among other things, WM_SETTINGCHANGE happens when the taskbar is moved
+ // and therefore the "working area" changes.
+ // http://msdn.microsoft.com/en-us/library/ms695534(v=vs.85).aspx
+ case WM_SETTINGCHANGE:
+ return QtWindows::SettingChangedEvent;
case WM_DISPLAYCHANGE:
return QtWindows::DisplayChangedEvent;
case WM_THEMECHANGED:
diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp
index 0dade2c49b..98c17deba9 100644
--- a/src/plugins/platforms/windows/qwindowscontext.cpp
+++ b/src/plugins/platforms/windows/qwindowscontext.cpp
@@ -331,6 +331,11 @@ bool QWindowsContext::useRTLExtensions() const
return d->m_keyMapper.useRTLExtensions();
}
+QList<int> QWindowsContext::possibleKeys(const QKeyEvent *e) const
+{
+ return d->m_keyMapper.possibleKeys(e);
+}
+
void QWindowsContext::setWindowCreationContext(const QSharedPointer<QWindowCreationContext> &ctx)
{
d->m_creationContext = ctx;
@@ -749,6 +754,8 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
#endif
case QtWindows::DisplayChangedEvent:
return d->m_screenManager.handleDisplayChange(wParam, lParam);
+ case QtWindows::SettingChangedEvent:
+ return d->m_screenManager.handleScreenChanges();
default:
break;
}
diff --git a/src/plugins/platforms/windows/qwindowscontext.h b/src/plugins/platforms/windows/qwindowscontext.h
index 3f08a742f8..450d6c8f4b 100644
--- a/src/plugins/platforms/windows/qwindowscontext.h
+++ b/src/plugins/platforms/windows/qwindowscontext.h
@@ -60,6 +60,7 @@ class QWindowsMimeConverter;
struct QWindowCreationContext;
struct QWindowsContextPrivate;
class QPoint;
+class QKeyEvent;
#ifndef Q_OS_WINCE
struct QWindowsUser32DLL
@@ -170,6 +171,7 @@ public:
unsigned systemInfo() const;
bool useRTLExtensions() const;
+ QList<int> possibleKeys(const QKeyEvent *e) const;
QWindowsMimeConverter &mimeConverter() const;
QWindowsScreenManager &screenManager();
diff --git a/src/plugins/platforms/windows/qwindowsinputcontext.cpp b/src/plugins/platforms/windows/qwindowsinputcontext.cpp
index 8b3d6749a0..11fd740009 100644
--- a/src/plugins/platforms/windows/qwindowsinputcontext.cpp
+++ b/src/plugins/platforms/windows/qwindowsinputcontext.cpp
@@ -560,12 +560,8 @@ int QWindowsInputContext::reconvertString(RECONVERTSTRING *reconv)
// Find the word in the surrounding text.
QTextBoundaryFinder bounds(QTextBoundaryFinder::Word, surroundingText);
bounds.setPosition(pos);
- if (bounds.isAtBoundary()) {
- if (QTextBoundaryFinder::EndWord == bounds.boundaryReasons())
- bounds.toPreviousBoundary();
- } else {
+ if (bounds.position() > 0 && !(bounds.boundaryReasons() & QTextBoundaryFinder::StartOfItem))
bounds.toPreviousBoundary();
- }
const int startPos = bounds.position();
bounds.toNextBoundary();
const int endPos = bounds.position();
diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp
index 463e01246b..1f26ec5bab 100644
--- a/src/plugins/platforms/windows/qwindowsintegration.cpp
+++ b/src/plugins/platforms/windows/qwindowsintegration.cpp
@@ -447,6 +447,11 @@ Qt::KeyboardModifiers QWindowsIntegration::queryKeyboardModifiers() const
return QWindowsKeyMapper::queryKeyboardModifiers();
}
+QList<int> QWindowsIntegration::possibleKeys(const QKeyEvent *e) const
+{
+ return d->m_context.possibleKeys(e);
+}
+
QPlatformNativeInterface *QWindowsIntegration::nativeInterface() const
{
return &d->m_nativeInterface;
diff --git a/src/plugins/platforms/windows/qwindowsintegration.h b/src/plugins/platforms/windows/qwindowsintegration.h
index fe095cf5d3..49780566dd 100644
--- a/src/plugins/platforms/windows/qwindowsintegration.h
+++ b/src/plugins/platforms/windows/qwindowsintegration.h
@@ -81,6 +81,7 @@ public:
virtual QVariant styleHint(StyleHint hint) const;
virtual Qt::KeyboardModifiers queryKeyboardModifiers() const;
+ virtual QList<int> possibleKeys(const QKeyEvent *e) const;
static QWindowsIntegration *instance();
diff --git a/src/plugins/platforms/windows/qwindowskeymapper.cpp b/src/plugins/platforms/windows/qwindowskeymapper.cpp
index 322d66836a..b57a27acb4 100644
--- a/src/plugins/platforms/windows/qwindowskeymapper.cpp
+++ b/src/plugins/platforms/windows/qwindowskeymapper.cpp
@@ -1119,4 +1119,30 @@ Qt::KeyboardModifiers QWindowsKeyMapper::queryKeyboardModifiers()
return modifiers;
}
+QList<int> QWindowsKeyMapper::possibleKeys(const QKeyEvent *e) const
+{
+ QList<int> result;
+
+ KeyboardLayoutItem *kbItem = keyLayout[e->nativeVirtualKey()];
+ if (!kbItem)
+ return result;
+
+ quint32 baseKey = kbItem->qtKey[0];
+ Qt::KeyboardModifiers keyMods = e->modifiers();
+ if (baseKey == Qt::Key_Return && (e->nativeModifiers() & ExtendedKey)) {
+ result << int(Qt::Key_Enter + keyMods);
+ return result;
+ }
+ result << int(baseKey + keyMods); // The base key is _always_ valid, of course
+
+ for (int i = 1; i < 9; ++i) {
+ Qt::KeyboardModifiers neededMods = ModsTbl[i];
+ quint32 key = kbItem->qtKey[i];
+ if (key && key != baseKey && ((keyMods & neededMods) == neededMods))
+ result << int(key + (keyMods & ~neededMods));
+ }
+
+ return result;
+}
+
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/windows/qwindowskeymapper.h b/src/plugins/platforms/windows/qwindowskeymapper.h
index 3a13deb0b6..7b3f18a42d 100644
--- a/src/plugins/platforms/windows/qwindowskeymapper.h
+++ b/src/plugins/platforms/windows/qwindowskeymapper.h
@@ -48,6 +48,7 @@
QT_BEGIN_NAMESPACE
+class QKeyEvent;
class QWindow;
struct KeyboardLayoutItem;
@@ -70,6 +71,7 @@ public:
void setKeyGrabber(QWindow *w) { m_keyGrabber = w; }
static Qt::KeyboardModifiers queryKeyboardModifiers();
+ QList<int> possibleKeys(const QKeyEvent *e) const;
private:
bool translateKeyEventInternal(QWindow *receiver, const MSG &msg, bool grab);
diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp
index 05a6893aad..0717a8ec60 100644
--- a/src/plugins/platforms/windows/qwindowsscreen.cpp
+++ b/src/plugins/platforms/windows/qwindowsscreen.cpp
@@ -372,7 +372,7 @@ static inline int indexOfMonitor(const QList<QWindowsScreenData> &screenData,
ones and propagates resolution changes to QWindowSystemInterface.
*/
-void QWindowsScreenManager::handleScreenChanges()
+bool QWindowsScreenManager::handleScreenChanges()
{
// Look for changed monitors, add new ones
const WindowsScreenDataList newDataList = monitorData();
@@ -396,6 +396,7 @@ void QWindowsScreenManager::handleScreenChanges()
delete m_screens.takeAt(i);
} // not found
} // for existing screens
+ return true;
}
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/windows/qwindowsscreen.h b/src/plugins/platforms/windows/qwindowsscreen.h
index 49b62632fc..dfd85f9be4 100644
--- a/src/plugins/platforms/windows/qwindowsscreen.h
+++ b/src/plugins/platforms/windows/qwindowsscreen.h
@@ -129,7 +129,7 @@ public:
delete m_screens.takeLast();
}
- void handleScreenChanges();
+ bool handleScreenChanges();
bool handleDisplayChange(WPARAM wParam, LPARAM lParam);
const WindowsScreenList &screens() const { return m_screens; }
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index 2335870ea7..f3830eb962 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -1178,7 +1178,7 @@ void QWindowsWindow::setWindowTitle(const QString &title)
SetWindowText(m_data.hwnd, (const wchar_t*)title.utf16());
}
-Qt::WindowFlags QWindowsWindow::setWindowFlags(Qt::WindowFlags flags)
+void QWindowsWindow::setWindowFlags(Qt::WindowFlags flags)
{
if (QWindowsContext::verboseWindows)
qDebug() << '>' << __FUNCTION__ << this << window() << "\n from: "
@@ -1202,7 +1202,6 @@ Qt::WindowFlags QWindowsWindow::setWindowFlags(Qt::WindowFlags flags)
qDebug() << '<' << __FUNCTION__ << "\n returns: "
<< QWindowsWindow::debugWindowFlags(m_data.flags)
<< " geometry " << oldGeometry << "->" << newGeometry;
- return m_data.flags;
}
QWindowsWindow::WindowData QWindowsWindow::setWindowFlags_sys(Qt::WindowFlags wt,
diff --git a/src/plugins/platforms/windows/qwindowswindow.h b/src/plugins/platforms/windows/qwindowswindow.h
index 4b1792859f..3b7666cf32 100644
--- a/src/plugins/platforms/windows/qwindowswindow.h
+++ b/src/plugins/platforms/windows/qwindowswindow.h
@@ -159,7 +159,7 @@ public:
virtual QPoint mapToGlobal(const QPoint &pos) const;
virtual QPoint mapFromGlobal(const QPoint &pos) const;
- virtual Qt::WindowFlags setWindowFlags(Qt::WindowFlags flags);
+ virtual void setWindowFlags(Qt::WindowFlags flags);
virtual Qt::WindowState setWindowState(Qt::WindowState state);
HWND handle() const { return m_data.hwnd; }
diff --git a/src/plugins/platforms/xcb/qxcbclipboard.cpp b/src/plugins/platforms/xcb/qxcbclipboard.cpp
index f021ab8b4a..142a8dfcde 100644
--- a/src/plugins/platforms/xcb/qxcbclipboard.cpp
+++ b/src/plugins/platforms/xcb/qxcbclipboard.cpp
@@ -300,6 +300,9 @@ void QXcbClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode)
m_timestamp[mode] = XCB_CURRENT_TIME;
}
+ if (connection()->time() == XCB_CURRENT_TIME)
+ connection()->setTime(connection()->getTimestamp());
+
if (data) {
newOwner = owner();
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp
index 401739f7d5..ad9fb1d19c 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection.cpp
@@ -864,6 +864,59 @@ void QXcbConnection::sendConnectionEvent(QXcbAtom::Atom a, uint id)
xcb_flush(xcb_connection());
}
+namespace
+{
+ class PropertyNotifyEvent {
+ public:
+ PropertyNotifyEvent(xcb_window_t win, xcb_atom_t property)
+ : window(win), type(XCB_PROPERTY_NOTIFY), atom(property) {}
+ xcb_window_t window;
+ int type;
+ xcb_atom_t atom;
+ bool checkEvent(xcb_generic_event_t *event) const {
+ if (!event)
+ return false;
+ if ((event->response_type & ~0x80) != type) {
+ return false;
+ } else {
+ xcb_property_notify_event_t *pn = (xcb_property_notify_event_t *)event;
+ if ((pn->window == window) && (pn->atom == atom))
+ return true;
+ }
+ return false;
+ }
+ };
+}
+
+xcb_timestamp_t QXcbConnection::getTimestamp()
+{
+ // send a dummy event to myself to get the timestamp from X server.
+ xcb_window_t rootWindow = screens().at(primaryScreen())->root();
+ xcb_change_property(xcb_connection(), XCB_PROP_MODE_APPEND, rootWindow, atom(QXcbAtom::CLIP_TEMPORARY),
+ XCB_ATOM_INTEGER, 32, 0, NULL);
+
+ connection()->flush();
+ PropertyNotifyEvent checker(rootWindow, atom(QXcbAtom::CLIP_TEMPORARY));
+
+ xcb_generic_event_t *event = 0;
+ // lets keep this inside a loop to avoid a possible race condition, where
+ // reader thread has not yet had the time to acquire the mutex in order
+ // to add the new set of events to its event queue
+ while (true) {
+ connection()->sync();
+ if (event = checkEvent(checker))
+ break;
+ }
+
+ xcb_property_notify_event_t *pn = (xcb_property_notify_event_t *)event;
+ xcb_timestamp_t timestamp = pn->time;
+ free(event);
+
+ xcb_delete_property(xcb_connection(), rootWindow, atom(QXcbAtom::CLIP_TEMPORARY));
+
+ return timestamp;
+}
+
void QXcbConnection::processXcbEvents()
{
QXcbEventArray *eventqueue = m_reader->lock();
diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h
index 08dd304b3d..8a6c418788 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.h
+++ b/src/plugins/platforms/xcb/qxcbconnection.h
@@ -319,7 +319,6 @@ public:
QByteArray atomName(xcb_atom_t atom);
const char *displayName() const { return m_displayName.constData(); }
-
xcb_connection_t *xcb_connection() const { return m_connection; }
const xcb_setup_t *setup() const { return m_setup; }
const xcb_format_t *formatForDepth(uint8_t depth) const;
@@ -380,6 +379,8 @@ public:
bool hasXRandr() const { return has_randr_extension; }
bool hasInputShape() const { return has_input_shape; }
+ xcb_timestamp_t getTimestamp();
+
private slots:
void processXcbEvents();
diff --git a/src/plugins/platforms/xcb/qxcbdrag.cpp b/src/plugins/platforms/xcb/qxcbdrag.cpp
index 1a2de82fd3..5d887cd06d 100644
--- a/src/plugins/platforms/xcb/qxcbdrag.cpp
+++ b/src/plugins/platforms/xcb/qxcbdrag.cpp
@@ -53,6 +53,7 @@
#include <qguiapplication.h>
#include <qrect.h>
#include <qpainter.h>
+#include <qtimer.h>
#include <qpa/qwindowsysteminterface.h>
@@ -140,8 +141,7 @@ QXcbDrag::QXcbDrag(QXcbConnection *c) : QXcbObject(c)
init();
heartbeat = -1;
-
- transaction_expiry_timer = -1;
+ cleanup_timer = -1;
}
QXcbDrag::~QXcbDrag()
@@ -510,17 +510,21 @@ void QXcbDrag::drop(const QMouseEvent *event)
if (w && (w->window()->windowType() == Qt::Desktop) /*&& !w->acceptDrops()*/)
w = 0;
-
Transaction t = {
connection()->time(),
current_target,
current_proxy_target,
(w ? w->window() : 0),
-// current_embedding_widget,
- currentDrag()
+// current_embeddig_widget,
+ currentDrag(),
+ QTime::currentTime()
};
transactions.append(t);
- restartDropExpiryTimer();
+
+ // timer is needed only for drops that came from other processes.
+ if (!t.targetWindow && cleanup_timer == -1) {
+ cleanup_timer = startTimer(XdndDropTransactionTimeout);
+ }
if (w) {
handleDrop(w->window(), &drop);
@@ -563,16 +567,6 @@ xcb_atom_t QXcbDrag::toXdndAction(Qt::DropAction a) const
}
}
-// timer used to discard old XdndDrop transactions
-enum { XdndDropTransactionTimeout = 5000 }; // 5 seconds
-
-void QXcbDrag::restartDropExpiryTimer()
-{
- if (transaction_expiry_timer != -1)
- killTimer(transaction_expiry_timer);
- transaction_expiry_timer = startTimer(XdndDropTransactionTimeout);
-}
-
int QXcbDrag::findTransactionByWindow(xcb_window_t window)
{
int at = -1;
@@ -771,8 +765,6 @@ void QXcbDrag::handle_xdnd_position(QWindow *w, const xcb_client_message_event_t
response.data.data32[3] = 0; // w, h
response.data.data32[4] = toXdndAction(qt_response.acceptedAction()); // action
-
-
if (answerRect.left() < 0)
answerRect.setLeft(0);
if (answerRect.right() > 4096)
@@ -1015,7 +1007,6 @@ void QXcbDrag::handleFinished(const xcb_client_message_event_t *event)
if (l[0]) {
int at = findTransactionByWindow(l[0]);
if (at != -1) {
- restartDropExpiryTimer();
Transaction t = transactions.takeAt(at);
// QDragManager *manager = QDragManager::self();
@@ -1044,12 +1035,13 @@ void QXcbDrag::handleFinished(const xcb_client_message_event_t *event)
// current_proxy_target = proxy_target;
// current_embedding_widget = embedding_widget;
// manager->object = currentObject;
+ } else {
+ qWarning("QXcbDrag::handleFinished - drop data has expired");
}
}
waiting_for_status = false;
}
-
void QXcbDrag::timerEvent(QTimerEvent* e)
{
if (e->timerId() == heartbeat && source_sameanswer.isNull()) {
@@ -1057,19 +1049,35 @@ void QXcbDrag::timerEvent(QTimerEvent* e)
QMouseEvent me(QEvent::MouseMove, pos, pos, pos, Qt::LeftButton,
QGuiApplication::mouseButtons(), QGuiApplication::keyboardModifiers());
move(&me);
- } else if (e->timerId() == transaction_expiry_timer) {
+ } else if (e->timerId() == cleanup_timer) {
+ bool stopTimer = true;
for (int i = 0; i < transactions.count(); ++i) {
const Transaction &t = transactions.at(i);
if (t.targetWindow) {
- // dnd within the same process, don't delete these
+ // dnd within the same process, don't delete, these are taken care of
+ // in handleFinished()
continue;
}
- t.drag->deleteLater();
- transactions.removeAt(i--);
- }
+ QTime currentTime = QTime::currentTime();
+ int delta = t.time.msecsTo(currentTime);
+ if (delta > XdndDropTransactionTimeout) {
+ /* delete transactions which are older than XdndDropTransactionTimeout. It could mean
+ one of these:
+ - client has crashed and as a result we have never received XdndFinished
+ - showing dialog box on drop event where user's response takes more time than XdndDropTransactionTimeout (QTBUG-14493)
+ - dnd takes unusually long time to process data
+ */
+ t.drag->deleteLater();
+ transactions.removeAt(i--);
+ } else {
+ stopTimer = false;
+ }
- killTimer(transaction_expiry_timer);
- transaction_expiry_timer = -1;
+ }
+ if (stopTimer && cleanup_timer != -1) {
+ killTimer(cleanup_timer);
+ cleanup_timer = -1;
+ }
}
}
@@ -1123,7 +1131,6 @@ void QXcbDrag::handleSelectionRequest(const xcb_selection_request_event_t *event
QDrag *transactionDrag = 0;
if (at >= 0) {
- restartDropExpiryTimer();
transactionDrag = transactions.at(at).drag;
} else if (at == -2) {
transactionDrag = currentDrag();
diff --git a/src/plugins/platforms/xcb/qxcbdrag.h b/src/plugins/platforms/xcb/qxcbdrag.h
index 99c1e2d78f..41d15505ce 100644
--- a/src/plugins/platforms/xcb/qxcbdrag.h
+++ b/src/plugins/platforms/xcb/qxcbdrag.h
@@ -52,7 +52,7 @@
#include <qsharedpointer.h>
#include <qpointer.h>
#include <qvector.h>
-
+#include <qdatetime.h>
#include <qpixmap.h>
#include <qbackingstore.h>
@@ -146,6 +146,10 @@ private:
// timer used when target wants "continuous" move messages (eg. scroll)
int heartbeat;
+ // 10 minute timer used to discard old XdndDrop transactions
+ enum { XdndDropTransactionTimeout = 600000 };
+ int cleanup_timer;
+
QVector<xcb_atom_t> drag_types;
struct Transaction
@@ -156,6 +160,7 @@ private:
QWindow *targetWindow;
// QWidget *embedding_widget;
QDrag *drag;
+ QTime time;
};
QList<Transaction> transactions;
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index 64cb9afcc6..cefe1a7786 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -740,7 +740,7 @@ void QXcbWindow::setNetWmStates(NetWmStates states)
xcb_flush(xcb_connection());
}
-Qt::WindowFlags QXcbWindow::setWindowFlags(Qt::WindowFlags flags)
+void QXcbWindow::setWindowFlags(Qt::WindowFlags flags)
{
Qt::WindowType type = static_cast<Qt::WindowType>(int(flags & Qt::WindowType_Mask));
@@ -763,8 +763,6 @@ Qt::WindowFlags QXcbWindow::setWindowFlags(Qt::WindowFlags flags)
setTransparentForMouseEvents(flags & Qt::WindowTransparentForInput);
updateDoesNotAcceptFocus(flags & Qt::WindowDoesNotAcceptFocus);
-
- return flags;
}
void QXcbWindow::setMotifWindowFlags(Qt::WindowFlags flags)
diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h
index ab18b502be..e2f62401dc 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.h
+++ b/src/plugins/platforms/xcb/qxcbwindow.h
@@ -81,7 +81,7 @@ public:
QMargins frameMargins() const;
void setVisible(bool visible);
- Qt::WindowFlags setWindowFlags(Qt::WindowFlags flags);
+ void setWindowFlags(Qt::WindowFlags flags);
Qt::WindowState setWindowState(Qt::WindowState state);
WId winId() const;
void setParent(const QPlatformWindow *window);
diff --git a/src/plugins/printsupport/cups/qcupsprintersupport_p.h b/src/plugins/printsupport/cups/qcupsprintersupport_p.h
index 1321e83586..17fd1cf89e 100644
--- a/src/plugins/printsupport/cups/qcupsprintersupport_p.h
+++ b/src/plugins/printsupport/cups/qcupsprintersupport_p.h
@@ -42,6 +42,7 @@
#ifndef QCUPSPRINTERSUPPORT_H
#define QCUPSPRINTERSUPPORT_H
+#include <QtCore/qfeatures.h> // Some feature dependencies might define QT_NO_PRINTER
#ifndef QT_NO_PRINTER
#include <qpa/qplatformprintersupport.h>
diff --git a/src/printsupport/kernel/qcups.cpp b/src/printsupport/kernel/qcups.cpp
index dd385526d7..ea18f1edf6 100644
--- a/src/printsupport/kernel/qcups.cpp
+++ b/src/printsupport/kernel/qcups.cpp
@@ -135,7 +135,7 @@ QCUPSSupport::QCUPSSupport()
if (!isAvailable())
return;
- prnCount = _cupsGetDests(&printers);
+ qt_cups_num_printers = prnCount = _cupsGetDests(&printers);
for (int i = 0; i < prnCount; ++i) {
if (printers[i].is_default) {
diff --git a/src/printsupport/kernel/qprintengine_win.cpp b/src/printsupport/kernel/qprintengine_win.cpp
index 759a76de09..27351dee48 100644
--- a/src/printsupport/kernel/qprintengine_win.cpp
+++ b/src/printsupport/kernel/qprintengine_win.cpp
@@ -1174,16 +1174,6 @@ void QWin32PrintEnginePrivate::doReinit()
if (state == QPrinter::Active) {
reinit = true;
} else {
- if (!name.isEmpty()) {
- HANDLE hCheckPrinter;
- if (!OpenPrinter((LPWSTR)name.utf16(), (LPHANDLE)&hCheckPrinter, 0)) {
- initialize();
- return;
- } else {
- ClosePrinter(hCheckPrinter);
- hCheckPrinter = 0;
- }
- }
resetDC();
initDevRects();
reinit = false;
@@ -1306,12 +1296,9 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &
case PPK_PrinterName:
d->name = value.toString();
- if (d->name.isEmpty()) {
+ if (d->name.isEmpty())
d->queryDefault();
- d->initialize();
- } else {
- d->doReinit();
- }
+ d->initialize();
break;
case PPK_Resolution:
diff --git a/src/sql/kernel/qsql.qdoc b/src/sql/kernel/qsql.qdoc
index 3354244c67..3b0e848af1 100644
--- a/src/sql/kernel/qsql.qdoc
+++ b/src/sql/kernel/qsql.qdoc
@@ -81,19 +81,15 @@
/*!
\enum QSql::NumericalPrecisionPolicy
- This enum type describes at which precision levels numercial values are read from
- a database.
-
- Some databases support numerical values with a precision that is not storable in a
- C++ basic data type. The default behavior is to bind these values as a QString.
- This enum can be used to override this behavior.
+ Numerical values in a database can have precisions greater than their corresponding
+ C++ types. This enum lists the policies for representing such values in the application.
\value LowPrecisionInt32 Force 32bit integer values. In case of floating point numbers,
the fractional part is silently discarded.
\value LowPrecisionInt64 Force 64bit integer values. In case of floating point numbers,
the fractional part is silently discarded.
- \value LowPrecisionDouble Force \c double values.
- \value HighPrecision The default behavior - try to preserve maximum precision.
+ \value LowPrecisionDouble Force \c double values. This is the default policy.
+ \value HighPrecision Strings will be used to preserve precision.
Note: The actual behaviour if an overflow occurs is driver specific. The Oracle database
just returns an error in this case.
diff --git a/src/sql/models/qsqltablemodel.h b/src/sql/models/qsqltablemodel.h
index 0b038e1d70..df1946fb9f 100644
--- a/src/sql/models/qsqltablemodel.h
+++ b/src/sql/models/qsqltablemodel.h
@@ -66,9 +66,6 @@ public:
explicit QSqlTableModel(QObject *parent = 0, QSqlDatabase db = QSqlDatabase());
virtual ~QSqlTableModel();
- virtual bool select();
- virtual bool selectRow(int row);
-
virtual void setTable(const QString &tableName);
QString tableName() const;
@@ -111,6 +108,9 @@ public:
virtual void revertRow(int row);
public Q_SLOTS:
+ virtual bool select();
+ virtual bool selectRow(int row);
+
bool submit();
void revert();
diff --git a/src/testlib/doc/src/qttestlib-manual.qdoc b/src/testlib/doc/src/qttestlib-manual.qdoc
index 008c0b271e..e7ee787d08 100644
--- a/src/testlib/doc/src/qttestlib-manual.qdoc
+++ b/src/testlib/doc/src/qttestlib-manual.qdoc
@@ -84,11 +84,6 @@
\li Custom types can easily be added to the test data and test output.
\endtable
- \note For higher-level GUI and application testing needs, please
- see the \l{Partner Directory} for Qt testing products provided by
- Nokia partners.
-
-
\section1 QTestLib API
All public methods are in the \l QTest namespace. In addition, the
@@ -835,6 +830,3 @@
for more information on these tools and a simple graphing example.
*/
-
-
-
diff --git a/src/tools/moc/preprocessor.cpp b/src/tools/moc/preprocessor.cpp
index fd8813ee88..566be9c039 100644
--- a/src/tools/moc/preprocessor.cpp
+++ b/src/tools/moc/preprocessor.cpp
@@ -193,9 +193,12 @@ static Symbols tokenize(const QByteArray &input, int lineNum = 1, TokenizeMode m
token = keywords[state].ident;
if (token == NOTOKEN) {
- // an error really
++data;
- continue;
+ // an error really, but let's ignore this input
+ // to not confuse moc later. However in pre-processor
+ // only mode let's continue.
+ if (!Preprocessor::preprocessOnly)
+ continue;
}
++column;
@@ -1198,8 +1201,18 @@ void Preprocessor::parseDefineArguments(Macro *m)
t = next();
if (t == PP_RPAREN)
break;
- if (t != PP_COMMA)
- error("Unexpected character in macro argument list.");
+ if (t == PP_COMMA)
+ continue;
+ if (lexem() == "...") {
+ //GCC extension: #define FOO(x, y...) x(y)
+ // The last argument was already parsed. Just mark the macro as variadic.
+ m->isVariadic = true;
+ while (test(PP_WHITESPACE));
+ if (!test(PP_RPAREN))
+ error("missing ')' in macro argument list");
+ break;
+ }
+ error("Unexpected character in macro argument list.");
}
m->arguments = arguments;
while (test(PP_WHITESPACE));
diff --git a/src/tools/qdoc/location.cpp b/src/tools/qdoc/location.cpp
index 942fc0f70c..ceb5709aae 100644
--- a/src/tools/qdoc/location.cpp
+++ b/src/tools/qdoc/location.cpp
@@ -360,7 +360,9 @@ void Location::emitMessage(MessageType type,
result += "\n[" + details + QLatin1Char(']');
result.replace("\n", "\n ");
if (type == Error)
- result.prepend(tr("error: "));
+ result.prepend(tr(": error: "));
+ else if (type == Warning)
+ result.prepend(tr(": warning: "));
result.prepend(toString());
fprintf(stderr, "%s\n", result.toLatin1().data());
fflush(stderr);
@@ -397,7 +399,6 @@ QString Location::toString() const
}
str += top();
}
- str += QLatin1String(": ");
return str;
}
diff --git a/src/tools/uic/qclass_lib_map.h b/src/tools/uic/qclass_lib_map.h
index 02cd04ca48..e35697399d 100644
--- a/src/tools/uic/qclass_lib_map.h
+++ b/src/tools/uic/qclass_lib_map.h
@@ -456,7 +456,7 @@ QT_CLASS_LIB(QAxAggregated, ActiveQt, qaxaggregated.h)
QT_CLASS_LIB(QAxBindable, ActiveQt, qaxbindable.h)
QT_CLASS_LIB(QAxFactory, ActiveQt, qaxfactory.h)
QT_CLASS_LIB(QAxClass, ActiveQt, qaxfactory.h)
-QT_CLASS_LIB(QGraphicsWebView, QtWebKit, qgraphicswebview.h)
+QT_CLASS_LIB(QGraphicsWebView, QtWebKitWidgets, qgraphicswebview.h)
QT_CLASS_LIB(QWebDatabase, QtWebKit, qwebdatabase.h)
QT_CLASS_LIB(QWebElement, QtWebKit, qwebelement.h)
QT_CLASS_LIB(QWebElementCollection, QtWebKit, qwebelement.h)
@@ -470,7 +470,7 @@ QT_CLASS_LIB(QWebPage, QtWebKit, qwebpage.h)
QT_CLASS_LIB(QWebPluginFactory, QtWebKit, qwebpluginfactory.h)
QT_CLASS_LIB(QWebSecurityOrigin, QtWebKit, qwebsecurityorigin.h)
QT_CLASS_LIB(QWebSettings, QtWebKit, qwebsettings.h)
-QT_CLASS_LIB(QWebView, QtWebKit, qwebview.h)
+QT_CLASS_LIB(QWebView, QtWebKitWidgets, qwebview.h)
QT_CLASS_LIB(QAudio, QtMultimedia, qaudio.h)
QT_CLASS_LIB(QAudioDeviceInfo, QtMultimedia, qaudiodeviceinfo.h)
QT_CLASS_LIB(QAbstractAudioDeviceInfo, QtMultimedia, qaudioengine.h)
diff --git a/src/widgets/dialogs/qfiledialog.ui b/src/widgets/dialogs/qfiledialog.ui
index f7fe68fbbf..6545fc05d4 100644
--- a/src/widgets/dialogs/qfiledialog.ui
+++ b/src/widgets/dialogs/qfiledialog.ui
@@ -1,4 +1,5 @@
-<ui version="4.0" >
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
<comment>*********************************************************************
**
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
@@ -40,8 +41,8 @@
**
*********************************************************************</comment>
<class>QFileDialog</class>
- <widget class="QDialog" name="QFileDialog" >
- <property name="geometry" >
+ <widget class="QDialog" name="QFileDialog">
+ <property name="geometry">
<rect>
<x>0</x>
<y>0</y>
@@ -49,28 +50,28 @@
<height>316</height>
</rect>
</property>
- <property name="sizeGripEnabled" >
+ <property name="sizeGripEnabled">
<bool>true</bool>
</property>
- <layout class="QGridLayout" >
- <item row="0" column="0" >
- <widget class="QLabel" name="lookInLabel" >
- <property name="text" >
+ <layout class="QGridLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="lookInLabel">
+ <property name="text">
<string>Look in:</string>
</property>
</widget>
</item>
- <item row="0" column="1" colspan="2" >
- <layout class="QHBoxLayout" >
+ <item row="0" column="1" colspan="2">
+ <layout class="QHBoxLayout">
<item>
- <widget class="QFileDialogComboBox" name="lookInCombo" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Ignored" >
+ <widget class="QFileDialogComboBox" name="lookInCombo">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Ignored" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="minimumSize" >
+ <property name="minimumSize">
<size>
<width>50</width>
<height>0</height>
@@ -79,8 +80,8 @@
</widget>
</item>
<item>
- <widget class="QToolButton" name="backButton" >
- <property name="toolTip" >
+ <widget class="QToolButton" name="backButton">
+ <property name="toolTip">
<string>Back</string>
</property>
<property name="accessibleName">
@@ -92,8 +93,8 @@
</widget>
</item>
<item>
- <widget class="QToolButton" name="forwardButton" >
- <property name="toolTip" >
+ <widget class="QToolButton" name="forwardButton">
+ <property name="toolTip">
<string>Forward</string>
</property>
<property name="accessibleName">
@@ -105,8 +106,8 @@
</widget>
</item>
<item>
- <widget class="QToolButton" name="toParentButton" >
- <property name="toolTip" >
+ <widget class="QToolButton" name="toParentButton">
+ <property name="toolTip">
<string>Parent Directory</string>
</property>
<property name="accessibleName">
@@ -118,8 +119,8 @@
</widget>
</item>
<item>
- <widget class="QToolButton" name="newFolderButton" >
- <property name="toolTip" >
+ <widget class="QToolButton" name="newFolderButton">
+ <property name="toolTip">
<string>Create New Folder</string>
</property>
<property name="accessibleName">
@@ -131,8 +132,8 @@
</widget>
</item>
<item>
- <widget class="QToolButton" name="listModeButton" >
- <property name="toolTip" >
+ <widget class="QToolButton" name="listModeButton">
+ <property name="toolTip">
<string>List View</string>
</property>
<property name="accessibleName">
@@ -144,8 +145,8 @@
</widget>
</item>
<item>
- <widget class="QToolButton" name="detailModeButton" >
- <property name="toolTip" >
+ <widget class="QToolButton" name="detailModeButton">
+ <property name="toolTip">
<string>Detail View</string>
</property>
<property name="accessibleName">
@@ -158,87 +159,102 @@
</item>
</layout>
</item>
- <item row="1" column="0" colspan="3" >
- <widget class="QSplitter" name="splitter" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
+ <item row="1" column="0" colspan="3">
+ <widget class="QSplitter" name="splitter">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="orientation" >
+ <property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
- <widget class="QSidebar" name="sidebar" />
- <widget class="QFrame" name="frame" >
- <property name="frameShape" >
+ <widget class="QSidebar" name="sidebar">
+ <property name="accessibleName">
+ <string>Sidebar</string>
+ </property>
+ <property name="accessibleDescription">
+ <string>List of places and bookmarks</string>
+ </property>
+ </widget>
+ <widget class="QFrame" name="frame">
+ <property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
- <property name="frameShadow" >
+ <property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
- <layout class="QVBoxLayout" >
- <property name="spacing" >
+ <layout class="QVBoxLayout">
+ <property name="spacing">
<number>0</number>
</property>
- <property name="leftMargin" >
+ <property name="leftMargin">
<number>0</number>
</property>
- <property name="topMargin" >
+ <property name="topMargin">
<number>0</number>
</property>
- <property name="rightMargin" >
+ <property name="rightMargin">
<number>0</number>
</property>
- <property name="bottomMargin" >
+ <property name="bottomMargin">
<number>0</number>
</property>
<item>
- <widget class="QStackedWidget" name="stackedWidget" >
- <property name="currentIndex" >
+ <widget class="QStackedWidget" name="stackedWidget">
+ <property name="currentIndex">
<number>0</number>
</property>
- <widget class="QWidget" name="page" >
- <layout class="QVBoxLayout" >
- <property name="spacing" >
+ <widget class="QWidget" name="page">
+ <layout class="QVBoxLayout">
+ <property name="spacing">
<number>0</number>
</property>
- <property name="leftMargin" >
+ <property name="leftMargin">
<number>0</number>
</property>
- <property name="topMargin" >
+ <property name="topMargin">
<number>0</number>
</property>
- <property name="rightMargin" >
+ <property name="rightMargin">
<number>0</number>
</property>
- <property name="bottomMargin" >
+ <property name="bottomMargin">
<number>0</number>
</property>
<item>
- <widget class="QFileDialogListView" name="listView" />
+ <widget class="QFileDialogListView" name="listView">
+ <property name="accessibleName">
+ <string>Files</string>
+ </property>
+ </widget>
</item>
</layout>
</widget>
- <widget class="QWidget" name="page_2" >
- <layout class="QVBoxLayout" >
- <property name="spacing" >
+ <widget class="QWidget" name="page_2">
+ <layout class="QVBoxLayout">
+ <property name="spacing">
<number>0</number>
</property>
- <property name="leftMargin" >
+ <property name="leftMargin">
<number>0</number>
</property>
- <property name="topMargin" >
+ <property name="topMargin">
<number>0</number>
</property>
- <property name="rightMargin" >
+ <property name="rightMargin">
<number>0</number>
</property>
- <property name="bottomMargin" >
+ <property name="bottomMargin">
<number>0</number>
</property>
<item>
- <widget class="QFileDialogTreeView" name="treeView" />
+ <widget class="QFileDialogTreeView" name="treeView">
+ <property name="accessibleName">
+ <string>Files</string>
+ </property>
+ </widget>
</item>
</layout>
</widget>
@@ -248,15 +264,15 @@
</widget>
</widget>
</item>
- <item row="2" column="0" >
- <widget class="QLabel" name="fileNameLabel" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Preferred" hsizetype="Minimum" >
+ <item row="2" column="0">
+ <widget class="QLabel" name="fileNameLabel">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="minimumSize" >
+ <property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
@@ -264,43 +280,43 @@
</property>
</widget>
</item>
- <item row="2" column="1" >
- <widget class="QFileDialogLineEdit" name="fileNameEdit" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
+ <item row="2" column="1">
+ <widget class="QFileDialogLineEdit" name="fileNameEdit">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
- <item rowspan="2" row="2" column="2" >
- <widget class="QDialogButtonBox" name="buttonBox" >
- <property name="orientation" >
+ <item row="2" column="2" rowspan="2">
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="orientation">
<enum>Qt::Vertical</enum>
</property>
- <property name="standardButtons" >
- <set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
- <item row="3" column="0" >
- <widget class="QLabel" name="fileTypeLabel" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
+ <item row="3" column="0">
+ <widget class="QLabel" name="fileTypeLabel">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="text" >
+ <property name="text">
<string>Files of type:</string>
</property>
</widget>
</item>
- <item row="3" column="1" >
- <widget class="QComboBox" name="fileTypeCombo" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
+ <item row="3" column="1">
+ <widget class="QComboBox" name="fileTypeCombo">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@@ -345,11 +361,11 @@
<tabstop>listModeButton</tabstop>
<tabstop>detailModeButton</tabstop>
<tabstop>sidebar</tabstop>
+ <tabstop>treeView</tabstop>
<tabstop>listView</tabstop>
<tabstop>fileNameEdit</tabstop>
- <tabstop>fileTypeCombo</tabstop>
<tabstop>buttonBox</tabstop>
- <tabstop>treeView</tabstop>
+ <tabstop>fileTypeCombo</tabstop>
</tabstops>
<resources/>
<connections/>
diff --git a/src/widgets/doc/src/modelview.qdoc b/src/widgets/doc/src/modelview.qdoc
index c133005b54..304af0058d 100644
--- a/src/widgets/doc/src/modelview.qdoc
+++ b/src/widgets/doc/src/modelview.qdoc
@@ -100,8 +100,8 @@
Let's have a closer look at a standard table widget. A table widget is a 2D
array of the data elements that the user can change. The table widget can be
integrated into a program flow by reading and writing the data elements that
- the table widget provides.
- This method is very intuitive and useful in many applications, but displaying
+ the table widget provides.
+ This method is very intuitive and useful in many applications, but displaying
and editing a database table with a standard table widget can be problematic.
Two copies of the data have to be coordinated: one outside the
widget; one inside the widget. The developer is responsible for
@@ -180,12 +180,12 @@
\section1 2. A Simple Model/View Application
- If you want to develop a model/view application, where should you start?
- We recommend starting with a simple example and extending it step-by-step.
- This makes understanding the architecture a lot easier. Trying to understand
- the model/view architecture in detail before invoking the IDE has proven
- to be less convenient for many developers. It is substantially easier to
- start with a simple model/view application that has demo data. Give it a
+ If you want to develop a model/view application, where should you start?
+ We recommend starting with a simple example and extending it step-by-step.
+ This makes understanding the architecture a lot easier. Trying to understand
+ the model/view architecture in detail before invoking the IDE has proven
+ to be less convenient for many developers. It is substantially easier to
+ start with a simple model/view application that has demo data. Give it a
try! Simply replace the data in the examples below with your own.
Below are 7 very simple and independent applications that show different
@@ -202,7 +202,7 @@
We have the usual \l {modelview-part2-main-cpp.html}{main()} function:
- Here is the interesting part: We create an instance of MyModel and use
+ Here is the interesting part: We create an instance of MyModel and use
\l{QTableView::setModel()}{tableView.setModel(&myModel);} to pass a
pointer of it to \l{QTableView}{tableView}. \l{QTableView}{tableView}
will invoke the methods of the pointer it has received to find out two
@@ -606,12 +606,9 @@
\e{Open Source Press}, ISBN 3-937514-12-0.
\li \b{Foundations of Qt Development} / Johan Thelin, \e{Apress}, ISBN 1-59059-831-8.
\li \b{Advanced Qt Programming} / Mark Summerfield, \e{Prentice Hall}, ISBN 0-321-63590-6.
- This book covers Model/View programming on more than 150 pages.
+ This book covers Model/View programming on more than 150 pages.
\endlist
- More information about these books is available on the
- \l{Books about Qt Programming}{Qt Web site}.
-
The following list provides an overview of example programs contained in the first three
books listed above. Some of them make very good templates for developing similar
applications.
diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp
index b30bdbbc6b..8cb6d70d15 100644
--- a/src/widgets/itemviews/qabstractitemview.cpp
+++ b/src/widgets/itemviews/qabstractitemview.cpp
@@ -1108,14 +1108,11 @@ void QAbstractItemView::reset()
if (d->selectionModel)
d->selectionModel->reset();
#ifndef QT_NO_ACCESSIBILITY
-#ifdef Q_WS_X11
if (QAccessible::isActive()) {
- QAccessible::queryAccessibleInterface(this)->table2Interface()->modelReset();
- QAccessibleEvent event(this, QAccessible::TableModelChanged);
- QAccessible::updateAccessibility(&event);
+ QAccessibleTableModelChangeEvent accessibleEvent(this, QAccessibleTableModelChangeEvent::ModelReset);
+ QAccessible::updateAccessibility(&accessibleEvent);
}
#endif
-#endif
}
/*!
@@ -3243,12 +3240,22 @@ void QAbstractItemView::dataChanged(const QModelIndex &topLeft, const QModelInde
// otherwise the items will be update later anyway
update(topLeft);
}
- return;
+ } else {
+ d->updateEditorData(topLeft, bottomRight);
+ if (isVisible() && !d->delayedPendingLayout)
+ d->viewport->update();
}
- d->updateEditorData(topLeft, bottomRight);
- if (!isVisible() || d->delayedPendingLayout)
- return; // no need to update
- d->viewport->update();
+
+#ifndef QT_NO_ACCESSIBILITY
+ if (QAccessible::isActive()) {
+ QAccessibleTableModelChangeEvent accessibleEvent(this, QAccessibleTableModelChangeEvent::DataChanged);
+ accessibleEvent.setFirstRow(topLeft.row());
+ accessibleEvent.setFirstColumn(topLeft.column());
+ accessibleEvent.setLastRow(bottomRight.row());
+ accessibleEvent.setLastColumn(bottomRight.column());
+ QAccessible::updateAccessibility(&accessibleEvent);
+ }
+#endif
}
/*!
@@ -3343,14 +3350,13 @@ void QAbstractItemViewPrivate::_q_rowsRemoved(const QModelIndex &index, int star
q->updateEditorGeometries();
q->setState(QAbstractItemView::NoState);
#ifndef QT_NO_ACCESSIBILITY
-#ifdef Q_WS_X11
if (QAccessible::isActive()) {
- QAccessible::queryAccessibleInterface(q)->table2Interface()->rowsRemoved(index, start, end);
- QAccessibleEvent event(QAccessible::TableModelChanged, q, 0);
- QAccessible::updateAccessibility(&event);
+ QAccessibleTableModelChangeEvent accessibleEvent(q, QAccessibleTableModelChangeEvent::RowsRemoved);
+ accessibleEvent.setFirstRow(start);
+ accessibleEvent.setLastRow(end);
+ QAccessible::updateAccessibility(&accessibleEvent);
}
#endif
-#endif
}
/*!
@@ -3424,14 +3430,13 @@ void QAbstractItemViewPrivate::_q_columnsRemoved(const QModelIndex &index, int s
q->updateEditorGeometries();
q->setState(QAbstractItemView::NoState);
#ifndef QT_NO_ACCESSIBILITY
-#ifdef Q_WS_X11
if (QAccessible::isActive()) {
- QAccessible::queryAccessibleInterface(q)->table2Interface()->columnsRemoved(index, start, end);
- QAccessibleEvent event(QAccessible::TableModelChanged, q, 0);
- QAccessible::updateAccessibility(&event);
+ QAccessibleTableModelChangeEvent accessibleEvent(q, QAccessibleTableModelChangeEvent::ColumnsRemoved);
+ accessibleEvent.setFirstColumn(start);
+ accessibleEvent.setLastColumn(end);
+ QAccessible::updateAccessibility(&accessibleEvent);
}
#endif
-#endif
}
@@ -3447,15 +3452,14 @@ void QAbstractItemViewPrivate::_q_rowsInserted(const QModelIndex &index, int sta
Q_UNUSED(end)
#ifndef QT_NO_ACCESSIBILITY
-#ifdef Q_WS_X11
Q_Q(QAbstractItemView);
if (QAccessible::isActive()) {
- QAccessible::queryAccessibleInterface(q)->table2Interface()->rowsInserted(index, start, end);
- QAccessibleEvent event(QAccessible::TableModelChanged, q, 0);
- QAccessible::updateAccessibility(&event);
+ QAccessibleTableModelChangeEvent accessibleEvent(q, QAccessibleTableModelChangeEvent::RowsInserted);
+ accessibleEvent.setFirstRow(start);
+ accessibleEvent.setLastRow(end);
+ QAccessible::updateAccessibility(&accessibleEvent);
}
#endif
-#endif
}
/*!
@@ -3473,14 +3477,13 @@ void QAbstractItemViewPrivate::_q_columnsInserted(const QModelIndex &index, int
if (q->isVisible())
q->updateEditorGeometries();
#ifndef QT_NO_ACCESSIBILITY
-#ifdef Q_WS_X11
if (QAccessible::isActive()) {
- QAccessible::queryAccessibleInterface(q)->table2Interface()->columnsInserted(index, start, end);
- QAccessibleEvent event(QAccessible::TableModelChanged, q, 0);
- QAccessible::updateAccessibility(&event);
+ QAccessibleTableModelChangeEvent accessibleEvent(q, QAccessibleTableModelChangeEvent::ColumnsInserted);
+ accessibleEvent.setFirstColumn(start);
+ accessibleEvent.setLastColumn(end);
+ QAccessible::updateAccessibility(&accessibleEvent);
}
#endif
-#endif
}
/*!
@@ -3501,15 +3504,12 @@ void QAbstractItemViewPrivate::_q_layoutChanged()
{
doDelayedItemsLayout();
#ifndef QT_NO_ACCESSIBILITY
-#ifdef Q_WS_X11
Q_Q(QAbstractItemView);
if (QAccessible::isActive()) {
- QAccessible::queryAccessibleInterface(q)->table2Interface()->modelReset();
- QAccessibleEvent event(QAccessible::TableModelChanged, q, 0);
- QAccessible::updateAccessibility(&event);
+ QAccessibleTableModelChangeEvent accessibleEvent(q, QAccessibleTableModelChangeEvent::ModelReset);
+ QAccessible::updateAccessibility(&accessibleEvent);
}
#endif
-#endif
}
void QAbstractItemViewPrivate::_q_rowsMoved(const QModelIndex &, int, int, const QModelIndex &, int)
diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp
index 097802c909..ff703c9d8a 100644
--- a/src/widgets/itemviews/qlistview.cpp
+++ b/src/widgets/itemviews/qlistview.cpp
@@ -123,7 +123,7 @@ QT_BEGIN_NAMESPACE
that can be taken for views that are intended to display items with equal sizes
is to set the \l uniformItemSizes property to true.
- \sa {View Classes}, QTreeView, QTableView, QListWidget
+ \sa {View Classes}, {Item Views Puzzle Example}, QTreeView, QTableView, QListWidget
*/
/*!
diff --git a/src/widgets/kernel/qapplication_qpa.cpp b/src/widgets/kernel/qapplication_qpa.cpp
index 6b04c18b9d..5dc68e47e0 100644
--- a/src/widgets/kernel/qapplication_qpa.cpp
+++ b/src/widgets/kernel/qapplication_qpa.cpp
@@ -77,6 +77,7 @@ extern QWidget *qt_button_down;
extern QWidget *qt_popup_down;
extern bool qt_replay_popup_mouse_event;
int openPopupCount = 0;
+extern QPointer<QWidget> qt_last_mouse_receiver;
void QApplicationPrivate::createEventDispatcher()
{
@@ -249,6 +250,12 @@ void QApplicationPrivate::openPopup(QWidget *popup)
QApplication::sendEvent(fw, &e);
}
}
+
+ // Dispatch leave for last mouse receiver to update undermouse states
+ if (qt_last_mouse_receiver && !QWidget::mouseGrabber()) {
+ QApplicationPrivate::dispatchEnterLeave(0, qt_last_mouse_receiver.data());
+ qt_last_mouse_receiver = 0;
+ }
}
void QApplicationPrivate::initializeMultitouch_sys()
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 362a8f4e55..29083b0670 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -7807,7 +7807,7 @@ bool QWidget::event(QEvent *event)
{
Q_D(QWidget);
- // ignore mouse events when disabled
+ // ignore mouse and key events when disabled
if (!isEnabled()) {
switch(event->type()) {
case QEvent::TabletPress:
@@ -7822,6 +7822,8 @@ bool QWidget::event(QEvent *event)
case QEvent::TouchEnd:
case QEvent::TouchCancel:
case QEvent::ContextMenu:
+ case QEvent::KeyPress:
+ case QEvent::KeyRelease:
#ifndef QT_NO_WHEELEVENT
case QEvent::Wheel:
#endif
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp
index 85d46bb0a3..5c34caef6b 100644
--- a/src/widgets/styles/qcommonstyle.cpp
+++ b/src/widgets/styles/qcommonstyle.cpp
@@ -712,6 +712,24 @@ static void drawArrow(const QStyle *style, const QStyleOptionToolButton *toolbut
#ifndef QT_NO_ITEMVIEWS
+static QSizeF viewItemTextLayout(QTextLayout &textLayout, int lineWidth)
+{
+ qreal height = 0;
+ qreal widthUsed = 0;
+ textLayout.beginLayout();
+ while (true) {
+ QTextLine line = textLayout.createLine();
+ if (!line.isValid())
+ break;
+ line.setLineWidth(lineWidth);
+ line.setPosition(QPointF(0, height));
+ height += line.height();
+ widthUsed = qMax(widthUsed, line.naturalTextWidth());
+ }
+ textLayout.endLayout();
+ return QSizeF(widthUsed, height);
+}
+
QSize QCommonStylePrivate::viewItemSize(const QStyleOptionViewItem *option, int role) const
{
const QWidget *widget = option->widget;
@@ -725,10 +743,8 @@ QSize QCommonStylePrivate::viewItemSize(const QStyleOptionViewItem *option, int
if (option->features & QStyleOptionViewItem::HasDisplay) {
QTextOption textOption;
textOption.setWrapMode(QTextOption::WordWrap);
- QTextLayout textLayout;
+ QTextLayout textLayout(option->text, option->font);
textLayout.setTextOption(textOption);
- textLayout.setFont(option->font);
- textLayout.setText(option->text);
const bool wrapText = option->features & QStyleOptionViewItem::WrapText;
const int textMargin = proxyStyle->pixelMetric(QStyle::PM_FocusFrameHMargin, option, widget) + 1;
QRect bounds = option->rect;
@@ -745,20 +761,9 @@ QSize QCommonStylePrivate::viewItemSize(const QStyleOptionViewItem *option, int
break;
}
- qreal height = 0, widthUsed = 0;
- textLayout.beginLayout();
- while (true) {
- QTextLine line = textLayout.createLine();
- if (!line.isValid())
- break;
- line.setLineWidth(bounds.width());
- line.setPosition(QPointF(0, height));
- height += line.height();
- widthUsed = qMax(widthUsed, line.naturalTextWidth());
- }
- textLayout.endLayout();
- const QSize size(qCeil(widthUsed), qCeil(height));
- return QSize(size.width() + 2 * textMargin, size.height());
+ const int lineWidth = bounds.width();
+ const QSizeF size = viewItemTextLayout(textLayout, lineWidth);
+ return QSize(qCeil(size.width()) + 2 * textMargin, qCeil(size.height()));
}
break;
case Qt::DecorationRole:
@@ -773,25 +778,6 @@ QSize QCommonStylePrivate::viewItemSize(const QStyleOptionViewItem *option, int
return QSize(0, 0);
}
-static QSizeF viewItemTextLayout(QTextLayout &textLayout, int lineWidth)
-{
- qreal height = 0;
- qreal widthUsed = 0;
- textLayout.beginLayout();
- while (true) {
- QTextLine line = textLayout.createLine();
- if (!line.isValid())
- break;
- line.setLineWidth(lineWidth);
- line.setPosition(QPointF(0, height));
- height += line.height();
- widthUsed = qMax(widthUsed, line.naturalTextWidth());
- }
- textLayout.endLayout();
- return QSizeF(widthUsed, height);
-}
-
-
void QCommonStylePrivate::viewItemDrawText(QPainter *p, const QStyleOptionViewItem *option, const QRect &rect) const
{
const QWidget *widget = option->widget;
@@ -803,10 +789,8 @@ void QCommonStylePrivate::viewItemDrawText(QPainter *p, const QStyleOptionViewIt
textOption.setWrapMode(wrapText ? QTextOption::WordWrap : QTextOption::ManualWrap);
textOption.setTextDirection(option->direction);
textOption.setAlignment(QStyle::visualAlignment(option->direction, option->displayAlignment));
- QTextLayout textLayout;
+ QTextLayout textLayout(option->text, option->font);
textLayout.setTextOption(textOption);
- textLayout.setFont(option->font);
- textLayout.setText(option->text);
viewItemTextLayout(textLayout, textRect.width());
diff --git a/src/widgets/styles/qgtkstyle.cpp b/src/widgets/styles/qgtkstyle.cpp
index 552e2354c5..9bcf45e928 100644
--- a/src/widgets/styles/qgtkstyle.cpp
+++ b/src/widgets/styles/qgtkstyle.cpp
@@ -1935,7 +1935,6 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
gint interiorFocus = true;
d->gtk_widget_style_get(gtkToggleButton, "interior-focus", &interiorFocus, NULL);
- GtkStyle *gtkToggleButtonStyle = gtkToggleButtonStyle;
int xt = interiorFocus ? gtkToggleButtonStyle->xthickness : 0;
int yt = interiorFocus ? gtkToggleButtonStyle->ythickness : 0;
if (focus && ((option->state & State_KeyboardFocusChange) || styleHint(SH_UnderlineShortcut, option, widget)))
diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm
index 3376c3cd52..ecb3e7f222 100644
--- a/src/widgets/styles/qmacstyle_mac.mm
+++ b/src/widgets/styles/qmacstyle_mac.mm
@@ -1836,6 +1836,7 @@ void QMacStylePrivate::animate()
}
if (!scrollBars.isEmpty()) {
int i = 0;
+ const qint64 dt = QDateTime::currentMSecsSinceEpoch();
while (i < scrollBars.size()) {
QWidget *maybeScroll = scrollBars.at(i);
if (!maybeScroll) {
@@ -1843,9 +1844,8 @@ void QMacStylePrivate::animate()
} else {
if (QScrollBar *sb = qobject_cast<QScrollBar *>(maybeScroll)) {
const OverlayScrollBarInfo& info = scrollBarInfos[sb];
- const QDateTime dt = QDateTime::currentDateTime();
- const qreal elapsed = qMax(info.lastHovered.msecsTo(dt),
- info.lastUpdate.msecsTo(dt));
+ const qreal elapsed = qMax(dt - info.lastHovered,
+ dt - info.lastUpdate);
const CGFloat opacity = 1.0 - qMax(0.0, (elapsed - ScrollBarFadeOutDelay) /
ScrollBarFadeOutDuration);
if ((opacity > 0.0 || !info.cleared) && (elapsed > ScrollBarFadeOutDelay)) {
@@ -1888,7 +1888,8 @@ bool QMacStyle::eventFilter(QObject *o, QEvent *e)
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7 &&
[NSScroller preferredScrollerStyle] == NSScrollerStyleOverlay && scrollArea) {
QMacStylePrivate::OverlayScrollBarInfo& info = d->scrollBarInfos[sb];
- const qreal elapsed = info.lastUpdate.msecsTo(QDateTime::currentDateTime());
+ const qint64 dt = QDateTime::currentMSecsSinceEpoch();
+ const qreal elapsed = dt - info.lastUpdate;
const CGFloat opacity = 1.0 - qMax(0.0, (elapsed - QMacStylePrivate::ScrollBarFadeOutDelay)
/ QMacStylePrivate::ScrollBarFadeOutDuration);
switch (e->type()) {
@@ -1897,8 +1898,8 @@ bool QMacStyle::eventFilter(QObject *o, QEvent *e)
// the fade out is stopped and it's set to 100% opaque
if (opacity > 0.0) {
info.hovered = true;
- info.lastUpdate = QDateTime::currentDateTime();
- info.lastHovered = QDateTime::currentDateTime();
+ info.lastUpdate = dt;
+ info.lastHovered = info.lastUpdate;
sb->update();
break;
}
@@ -5113,6 +5114,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
}
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
+ const qint64 dt = QDateTime::currentMSecsSinceEpoch();
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7 &&
[NSScroller preferredScrollerStyle] == NSScrollerStyleOverlay &&
scrollBarsScrollArea(qobject_cast<const QScrollBar *>(widget)) &&
@@ -5127,7 +5129,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
info.lastMinimum = slider->minimum;
info.lastSize = slider->rect.size();
info.lastMaximum = slider->maximum;
- info.lastUpdate = QDateTime::currentDateTime();
+ info.lastUpdate = dt;
showSiblings = true;
}
@@ -5139,18 +5141,18 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
d->scrollBarInfos.value(sibling).lastUpdate);
info.cleared = false;
if (d->scrollBarInfos.value(sibling).hovered)
- info.lastUpdate = QDateTime::currentDateTime();
+ info.lastUpdate = dt;
}
- qreal elapsed = info.lastHovered.msecsTo(QDateTime::currentDateTime());
+ qreal elapsed = dt - info.lastHovered;
CGFloat opacity = 1.0 - qMax(0.0,
(elapsed - QMacStylePrivate::ScrollBarFadeOutDelay) /
QMacStylePrivate::ScrollBarFadeOutDuration);
const bool isHorizontal = slider->orientation == Qt::Horizontal;
if (info.hovered) {
- info.lastHovered = QDateTime::currentDateTime();
- info.lastUpdate = QDateTime::currentDateTime();
+ info.lastHovered = dt;
+ info.lastUpdate = dt;
opacity = 1.0;
// if the current scroll bar is hovered, none of the others might fade out
Q_FOREACH (const QScrollBar *sibling, siblings) {
@@ -5206,7 +5208,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
// afterwards we draw the knob, since we cannot drow the know w/o the track,
// we simulate a scrollbar with a knob from 0.0 to 1.0
- elapsed = info.lastUpdate.msecsTo(QDateTime::currentDateTime());
+ elapsed = dt - info.lastUpdate;
opacity = 1.0 - qMax(0.0, (elapsed - QMacStylePrivate::ScrollBarFadeOutDelay) /
QMacStylePrivate::ScrollBarFadeOutDuration);
info.cleared = opacity <= 0.0;
diff --git a/src/widgets/styles/qmacstyle_mac_p.h b/src/widgets/styles/qmacstyle_mac_p.h
index 2c129aa49d..ac482b8fc7 100644
--- a/src/widgets/styles/qmacstyle_mac_p.h
+++ b/src/widgets/styles/qmacstyle_mac_p.h
@@ -215,18 +215,18 @@ public:
: lastValue(-1),
lastMinimum(-1),
lastMaximum(-1),
- lastUpdate(QDateTime::currentDateTime()),
+ lastUpdate(QDateTime::currentMSecsSinceEpoch()),
hovered(false),
- lastHovered(QDateTime::fromTime_t(0)),
+ lastHovered(0),
cleared(false)
{}
int lastValue;
int lastMinimum;
int lastMaximum;
QSize lastSize;
- QDateTime lastUpdate;
+ qint64 lastUpdate;
bool hovered;
- QDateTime lastHovered;
+ qint64 lastHovered;
bool cleared;
};
mutable QMap<const QWidget*, OverlayScrollBarInfo> scrollBarInfos;
diff --git a/src/widgets/styles/qmotifstyle_p.h b/src/widgets/styles/qmotifstyle_p.h
deleted file mode 100644
index 76f8c01119..0000000000
--- a/src/widgets/styles/qmotifstyle_p.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMOTIFSTYLE_P_H
-#define QMOTIFSTYLE_P_H
-#include <qlist.h>
-#include <qdatetime.h>
-#include <qprogressbar.h>
-#include "qmotifstyle.h"
-#include "qcommonstyle_p.h"
-
-QT_BEGIN_NAMESPACE
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header
-// file may change from version to version without notice, or even be removed.
-//
-// We mean it.
-//
-
-// Private class
-class QMotifStylePrivate : public QCommonStylePrivate
-{
- Q_DECLARE_PUBLIC(QMotifStyle)
-public:
- QMotifStylePrivate();
-
-public:
-#ifndef QT_NO_PROGRESSBAR
- QList<QProgressBar *> bars;
- int animationFps;
- int animateTimer;
- QTime startTime;
- int animateStep;
-#endif // QT_NO_PROGRESSBAR
-};
-
-QT_END_NAMESPACE
-
-#endif //QMOTIFSTYLE_P_H
diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp
index 98bcf7d6f2..870e25b241 100644
--- a/src/widgets/widgets/qcombobox.cpp
+++ b/src/widgets/widgets/qcombobox.cpp
@@ -2007,10 +2007,13 @@ void QComboBoxPrivate::setCurrentIndex(const QModelIndex &mi)
/*!
\property QComboBox::currentText
- \brief the text of the current item
+ \brief the current text
- By default, for an empty combo box or a combo box in which no current
- item is set, this property contains an empty string.
+ If the combo box is editable, the current text is the value displayed
+ by the line edit. Otherwise, it is the value of the current item or
+ an empty string if the combo box is empty or no current item is set.
+
+ \sa editable
*/
QString QComboBox::currentText() const
{
diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp
index cba4271ba0..12f957412f 100644
--- a/src/widgets/widgets/qdockwidget.cpp
+++ b/src/widgets/widgets/qdockwidget.cpp
@@ -1052,7 +1052,7 @@ void QDockWidgetPrivate::setWindowState(bool floating, bool unplug, const QRect
}
}
- if (unplug && floating && nativeDeco)
+ if (floating && nativeDeco)
if (const QWindow *window = q->windowHandle())
if (QPlatformWindow *platformWindow = window->handle())
platformWindow->setFrameStrutEventsEnabled(true);