summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-10-06 13:04:47 +0200
committerLiang Qi <liang.qi@qt.io>2016-10-06 20:12:27 +0200
commitef25620ac1acbe7a723b6b213d7d50468a748119 (patch)
treeabdff2aed36655dfb0305d232b0ac48f8ad67391 /src
parent669add92d9adc15ecfa0b2d62dd90ea9066d401e (diff)
parent6feec9da93032d11a768802ac2187d9d4153b1ec (diff)
Merge remote-tracking branch 'origin/5.7' into 5.8
Conflicts: mkspecs/features/mac/default_pre.prf mkspecs/features/qpa/genericunixfontdatabase.prf mkspecs/features/uikit/default_post.prf mkspecs/features/uikit/resolve_config.prf mkspecs/macx-ios-clang/features/default_post.prf mkspecs/macx-ios-clang/features/resolve_config.prf src/corelib/io/qiodevice.cpp Change-Id: I6f210f71f177a3c3278a4f380542195e14e4b491
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/atspi2/xml/Cache.xml4
-rw-r--r--src/corelib/global/qglobal.cpp2
-rw-r--r--src/corelib/global/qnamespace.qdoc13
-rw-r--r--src/corelib/io/qiodevice.cpp19
-rw-r--r--src/corelib/kernel/qfunctions_winrt.h8
-rw-r--r--src/corelib/tools/qlist.cpp2
-rw-r--r--src/corelib/tools/qvector.cpp2
-rw-r--r--src/gui/text/qtextengine.cpp9
-rw-r--r--src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm2
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm9
-rw-r--r--src/plugins/platforms/ios/qiosinputcontext.h1
-rw-r--r--src/plugins/platforms/ios/qiosmenu.mm1
-rw-r--r--src/plugins/platforms/ios/qiostextresponder.mm11
-rw-r--r--src/plugins/platforms/xcb/qxcbclipboard.cpp12
-rw-r--r--src/plugins/platforms/xcb/qxcbclipboard.h2
-rw-r--r--src/plugins/platforms/xcb/qxcbcursor.cpp24
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp22
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.h3
-rw-r--r--src/sql/kernel/qsqlrecord.cpp2
-rw-r--r--src/testlib/qtestcase.h54
-rw-r--r--src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp38
-rw-r--r--src/widgets/dialogs/qfilesystemmodel.cpp4
-rw-r--r--src/widgets/doc/src/model-view-programming.qdoc6
-rw-r--r--src/widgets/kernel/qlayoutitem.cpp14
-rw-r--r--src/widgets/styles/qdrawutil.cpp1
25 files changed, 167 insertions, 98 deletions
diff --git a/src/3rdparty/atspi2/xml/Cache.xml b/src/3rdparty/atspi2/xml/Cache.xml
index 9d0c5801a9..01c52810ac 100644
--- a/src/3rdparty/atspi2/xml/Cache.xml
+++ b/src/3rdparty/atspi2/xml/Cache.xml
@@ -9,12 +9,12 @@
<signal name="AddAccessible">
<arg name="nodeAdded" type="((so)(so)a(so)assusau)"/>
- <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QSpiAccessibleCacheItem"/>
+ <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QSpiAccessibleCacheItem"/>
</signal>
<signal name="RemoveAccessible">
<arg name="nodeRemoved" type="(so)"/>
- <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QSpiObjectReference"/>
+ <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QSpiObjectReference"/>
</signal>
</interface>
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index 743d9d14a5..c1a0bc9867 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -3441,7 +3441,7 @@ Q_GLOBAL_STATIC(AndroidRandomStorage, randomTLS)
pseudo random integers to be returned by qrand().
The sequence of random numbers generated is deterministic per thread. For example,
- if two threads call qsrand(1) and subsequently calls qrand(), the threads will get
+ if two threads call qsrand(1) and subsequently call qrand(), the threads will get
the same random number sequence.
\sa qrand()
diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc
index d8df25dcc6..7768070e4f 100644
--- a/src/corelib/global/qnamespace.qdoc
+++ b/src/corelib/global/qnamespace.qdoc
@@ -1761,17 +1761,6 @@
\value Key_Zoom
\value Key_Exit
\value Key_Cancel
- \value Key_MicVolumeUp
- \value Key_Find
- \value Key_Open
- \value Key_MicVolumeDown
- \value Key_New
- \value Key_Settings
- \value Key_Redo
- \value Key_Exit
- \value Key_Info
- \value Key_Undo
- \value Key_Guide
\sa QKeyEvent::key()
*/
@@ -2300,7 +2289,7 @@
\enum Qt::ItemSelectionMode
This enum is used in QGraphicsItem, QGraphicsScene and QGraphicsView to
- specify how items are selected, or how to determine if a shapes and items
+ specify how items are selected, or how to determine if shapes and items
collide.
\value ContainsItemShape The output list contains only items whose
diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp
index c560bc7a03..52a78ad1c4 100644
--- a/src/corelib/io/qiodevice.cpp
+++ b/src/corelib/io/qiodevice.cpp
@@ -120,6 +120,14 @@ static void checkWarnMessage(const QIODevice *device, const char *function, cons
} \
} while (0)
+#define CHECK_MAXBYTEARRAYSIZE(function) \
+ do { \
+ if (maxSize >= MaxByteArraySize) { \
+ checkWarnMessage(this, #function, "maxSize argument exceeds QByteArray size limit"); \
+ maxSize = MaxByteArraySize - 1; \
+ } \
+ } while (0)
+
#define CHECK_WRITABLE(function, returnType) \
do { \
if ((d->openMode & WriteOnly) == 0) { \
@@ -1178,10 +1186,7 @@ QByteArray QIODevice::read(qint64 maxSize)
}
CHECK_MAXLEN(read, result);
- if (maxSize >= MaxByteArraySize) {
- checkWarnMessage(this, "read", "maxSize argument exceeds QByteArray size limit");
- maxSize = MaxByteArraySize - 1;
- }
+ CHECK_MAXBYTEARRAYSIZE(read);
result.resize(int(maxSize));
qint64 readBytes = read(result.data(), result.size());
@@ -1402,17 +1407,13 @@ QByteArray QIODevice::readLine(qint64 maxSize)
QByteArray result;
CHECK_MAXLEN(readLine, result);
+ CHECK_MAXBYTEARRAYSIZE(readLine);
#if defined QIODEVICE_DEBUG
printf("%p QIODevice::readLine(%lld), d->pos = %lld, d->buffer.size() = %lld\n",
this, maxSize, d->pos, d->buffer.size());
#endif
- if (maxSize >= MaxByteArraySize) {
- qWarning("QIODevice::read: maxSize argument exceeds QByteArray size limit");
- maxSize = MaxByteArraySize - 1;
- }
-
result.resize(int(maxSize));
qint64 readBytes = 0;
if (!result.size()) {
diff --git a/src/corelib/kernel/qfunctions_winrt.h b/src/corelib/kernel/qfunctions_winrt.h
index e0777b8df8..9b33f8b120 100644
--- a/src/corelib/kernel/qfunctions_winrt.h
+++ b/src/corelib/kernel/qfunctions_winrt.h
@@ -180,7 +180,7 @@ static inline HRESULT _await_impl(const Microsoft::WRL::ComPtr<T> &asyncOp, Awai
t.start();
switch (awaitStyle) {
case ProcessMainThreadEvents:
- while (SUCCEEDED(hr = asyncInfo->get_Status(&status)) && status == Started) {
+ while (SUCCEEDED(hr = asyncInfo->get_Status(&status)) && status == AsyncStatus::Started) {
QCoreApplication::processEvents();
if (timeout && t.hasExpired(timeout))
return ERROR_TIMEOUT;
@@ -188,7 +188,7 @@ static inline HRESULT _await_impl(const Microsoft::WRL::ComPtr<T> &asyncOp, Awai
break;
case ProcessThreadEvents:
if (QAbstractEventDispatcher *dispatcher = QThread::currentThread()->eventDispatcher()) {
- while (SUCCEEDED(hr = asyncInfo->get_Status(&status)) && status == Started) {
+ while (SUCCEEDED(hr = asyncInfo->get_Status(&status)) && status == AsyncStatus::Started) {
dispatcher->processEvents(QEventLoop::AllEvents);
if (timeout && t.hasExpired(timeout))
return ERROR_TIMEOUT;
@@ -198,7 +198,7 @@ static inline HRESULT _await_impl(const Microsoft::WRL::ComPtr<T> &asyncOp, Awai
// fall through
default:
case YieldThread:
- while (SUCCEEDED(hr = asyncInfo->get_Status(&status)) && status == Started) {
+ while (SUCCEEDED(hr = asyncInfo->get_Status(&status)) && status == AsyncStatus::Started) {
QThread::yieldCurrentThread();
if (timeout && t.hasExpired(timeout))
return ERROR_TIMEOUT;
@@ -206,7 +206,7 @@ static inline HRESULT _await_impl(const Microsoft::WRL::ComPtr<T> &asyncOp, Awai
break;
}
- if (FAILED(hr) || status != Completed) {
+ if (FAILED(hr) || status != AsyncStatus::Completed) {
HRESULT ec;
hr = asyncInfo->get_ErrorCode(&ec);
if (FAILED(hr))
diff --git a/src/corelib/tools/qlist.cpp b/src/corelib/tools/qlist.cpp
index 1762da2c8f..5f26e704c4 100644
--- a/src/corelib/tools/qlist.cpp
+++ b/src/corelib/tools/qlist.cpp
@@ -370,7 +370,7 @@ void **QListData::erase(void **xi)
application must interface with a C API.
\note Iterators into a QLinkedList and references into
- heap-allocating QLists remain valid long as the referenced items
+ heap-allocating QLists remain valid as long as the referenced items
remain in the container. This is not true for iterators and
references into a QVector and non-heap-allocating QLists.
diff --git a/src/corelib/tools/qvector.cpp b/src/corelib/tools/qvector.cpp
index ef1c9c17b0..0ea47b1a1a 100644
--- a/src/corelib/tools/qvector.cpp
+++ b/src/corelib/tools/qvector.cpp
@@ -77,7 +77,7 @@
application must interface with a C API.
\note Iterators into a QLinkedList and references into
- heap-allocating QLists remain valid long as the referenced items
+ heap-allocating QLists remain valid as long as the referenced items
remain in the container. This is not true for iterators and
references into a QVector and non-heap-allocating QLists.
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index 5dbeccff7f..742b01dd1f 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -2067,6 +2067,9 @@ QFontEngine *QTextEngine::fontEngine(const QScriptItem &si, QFixed *ascent, QFix
font = font.resolve(fnt);
}
engine = font.d->engineForScript(script);
+ if (engine)
+ engine->ref.ref();
+
QTextCharFormat::VerticalAlignment valign = f.verticalAlignment();
if (valign == QTextCharFormat::AlignSuperScript || valign == QTextCharFormat::AlignSubScript) {
if (font.pointSize() != -1)
@@ -2074,16 +2077,14 @@ QFontEngine *QTextEngine::fontEngine(const QScriptItem &si, QFixed *ascent, QFix
else
font.setPixelSize((font.pixelSize() * 2) / 3);
scaledEngine = font.d->engineForScript(script);
+ if (scaledEngine)
+ scaledEngine->ref.ref();
}
- if (engine)
- engine->ref.ref();
if (feCache.prevFontEngine)
releaseCachedFontEngine(feCache.prevFontEngine);
feCache.prevFontEngine = engine;
- if (scaledEngine)
- scaledEngine->ref.ref();
if (feCache.prevScaledFontEngine)
releaseCachedFontEngine(feCache.prevScaledFontEngine);
feCache.prevScaledFontEngine = scaledEngine;
diff --git a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm
index 5f54110777..5c27cf8059 100644
--- a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm
+++ b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm
@@ -348,7 +348,7 @@ static inline void qt_mac_waitForMoreEvents(NSString *runLoopMode = NSDefaultRun
bool QCocoaEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags flags)
{
Q_D(QCocoaEventDispatcher);
- d->interrupt = false;
+ QBoolBlocker interruptBlocker(d->interrupt, false);
bool interruptLater = false;
QtCocoaInterruptDispatcher::cancelInterruptLater();
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index 641be50156..7ac3cafc3c 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -739,7 +739,10 @@ static bool _q_dontOverrideCtrlLMB = false;
- (void)handleMouseEvent:(NSEvent *)theEvent
{
- bool isTabletEvent = [self handleTabletEvent: theEvent];
+ // Tablet events may come in via the mouse event handlers,
+ // check if this is a valid tablet event first.
+ if ([self handleTabletEvent: theEvent])
+ return;
QPointF qtWindowPoint;
QPointF qtScreenPoint;
@@ -768,8 +771,8 @@ static bool _q_dontOverrideCtrlLMB = false;
nativeDrag->setLastMouseEvent(theEvent, self);
Qt::KeyboardModifiers keyboardModifiers = [QNSView convertKeyModifiers:[theEvent modifierFlags]];
- QWindowSystemInterface::handleMouseEvent(targetView->m_window, timestamp, qtWindowPoint, qtScreenPoint, m_buttons, keyboardModifiers,
- isTabletEvent ? Qt::MouseEventSynthesizedByQt : Qt::MouseEventNotSynthesized);
+ QWindowSystemInterface::handleMouseEvent(targetView->m_window, timestamp, qtWindowPoint, qtScreenPoint,
+ m_buttons, keyboardModifiers, Qt::MouseEventNotSynthesized);
}
- (void)handleFrameStrutMouseEvent:(NSEvent *)theEvent
diff --git a/src/plugins/platforms/ios/qiosinputcontext.h b/src/plugins/platforms/ios/qiosinputcontext.h
index 9fdf021d07..966d1a7e80 100644
--- a/src/plugins/platforms/ios/qiosinputcontext.h
+++ b/src/plugins/platforms/ios/qiosinputcontext.h
@@ -49,6 +49,7 @@
const char kImePlatformDataInputView[] = "inputView";
const char kImePlatformDataInputAccessoryView[] = "inputAccessoryView";
+const char kImePlatformDataHideShortcutsBar[] = "hideShortcutsBar";
const char kImePlatformDataReturnKeyType[] = "returnKeyType";
@class QIOSLocaleListener;
diff --git a/src/plugins/platforms/ios/qiosmenu.mm b/src/plugins/platforms/ios/qiosmenu.mm
index 02deab59b5..01cb3badea 100644
--- a/src/plugins/platforms/ios/qiosmenu.mm
+++ b/src/plugins/platforms/ios/qiosmenu.mm
@@ -521,6 +521,7 @@ bool QIOSMenu::eventFilter(QObject *obj, QEvent *event)
QVariantMap imPlatformData = queryEvent->value(Qt::ImPlatformData).toMap();
imPlatformData.insert(kImePlatformDataInputView, QVariant::fromValue(static_cast<void *>(m_pickerView)));
imPlatformData.insert(kImePlatformDataInputAccessoryView, QVariant::fromValue(static_cast<void *>(m_pickerView.toolbar)));
+ imPlatformData.insert(kImePlatformDataHideShortcutsBar, true);
queryEvent->setValue(Qt::ImPlatformData, imPlatformData);
queryEvent->setValue(Qt::ImEnabled, true);
diff --git a/src/plugins/platforms/ios/qiostextresponder.mm b/src/plugins/platforms/ios/qiostextresponder.mm
index 3c95083e45..d7b0a323ad 100644
--- a/src/plugins/platforms/ios/qiostextresponder.mm
+++ b/src/plugins/platforms/ios/qiostextresponder.mm
@@ -236,6 +236,17 @@
self.inputView = [[[WrapperView alloc] initWithView:inputView] autorelease];
if (UIView *accessoryView = static_cast<UIView *>(platformData.value(kImePlatformDataInputAccessoryView).value<void *>()))
self.inputAccessoryView = [[[WrapperView alloc] initWithView:accessoryView] autorelease];
+ if (QSysInfo::MacintoshVersion >= QSysInfo::MV_IOS_9_0) {
+ if (platformData.value(kImePlatformDataHideShortcutsBar).toBool()) {
+ // According to the docs, leadingBarButtonGroups/trailingBarButtonGroups should be set to nil to hide the shortcuts bar.
+ // However, starting with iOS 10, the API has been surrounded with NS_ASSUME_NONNULL, which contradicts this and causes
+ // compiler warnings. And assigning just an empty array causes layout asserts. Hence, we assign empty button groups instead.
+ UIBarButtonItemGroup *leading = [[[UIBarButtonItemGroup alloc] initWithBarButtonItems:@[] representativeItem:nil] autorelease];
+ UIBarButtonItemGroup *trailing = [[[UIBarButtonItemGroup alloc] initWithBarButtonItems:@[] representativeItem:nil] autorelease];
+ self.inputAssistantItem.leadingBarButtonGroups = @[leading];
+ self.inputAssistantItem.trailingBarButtonGroups = @[trailing];
+ }
+ }
self.undoManager.groupsByEvent = NO;
[self rebuildUndoStack];
diff --git a/src/plugins/platforms/xcb/qxcbclipboard.cpp b/src/plugins/platforms/xcb/qxcbclipboard.cpp
index b95ad4b5c9..f9c32cd0a4 100644
--- a/src/plugins/platforms/xcb/qxcbclipboard.cpp
+++ b/src/plugins/platforms/xcb/qxcbclipboard.cpp
@@ -275,8 +275,6 @@ QXcbClipboard::QXcbClipboard(QXcbConnection *c)
{
Q_ASSERT(QClipboard::Clipboard == 0);
Q_ASSERT(QClipboard::Selection == 1);
- m_xClipboard[QClipboard::Clipboard] = 0;
- m_xClipboard[QClipboard::Selection] = 0;
m_clientClipboard[QClipboard::Clipboard] = 0;
m_clientClipboard[QClipboard::Selection] = 0;
m_timestamp[QClipboard::Clipboard] = XCB_CURRENT_TIME;
@@ -329,6 +327,10 @@ QXcbClipboard::~QXcbClipboard()
}
free(reply);
}
+
+ if (m_clientClipboard[QClipboard::Clipboard] != m_clientClipboard[QClipboard::Selection])
+ delete m_clientClipboard[QClipboard::Clipboard];
+ delete m_clientClipboard[QClipboard::Selection];
}
void QXcbClipboard::incrTransactionPeeker(xcb_generic_event_t *ge, bool &accepted)
@@ -378,9 +380,9 @@ QMimeData * QXcbClipboard::mimeData(QClipboard::Mode mode)
return m_clientClipboard[mode];
} else {
if (!m_xClipboard[mode])
- m_xClipboard[mode] = new QXcbClipboardMime(mode, this);
+ m_xClipboard[mode].reset(new QXcbClipboardMime(mode, this));
- return m_xClipboard[mode];
+ return m_xClipboard[mode].data();
}
}
@@ -730,7 +732,7 @@ void QXcbClipboard::handleXFixesSelectionRequest(xcb_xfixes_selection_notify_eve
// here we care only about the xfixes events that come from non Qt processes
if (event->owner != XCB_NONE && event->owner != owner()) {
if (!m_xClipboard[mode]) {
- m_xClipboard[mode] = new QXcbClipboardMime(mode, this);
+ m_xClipboard[mode].reset(new QXcbClipboardMime(mode, this));
} else {
m_xClipboard[mode]->reset();
}
diff --git a/src/plugins/platforms/xcb/qxcbclipboard.h b/src/plugins/platforms/xcb/qxcbclipboard.h
index 58c7f32c4c..ffd565c56f 100644
--- a/src/plugins/platforms/xcb/qxcbclipboard.h
+++ b/src/plugins/platforms/xcb/qxcbclipboard.h
@@ -98,7 +98,7 @@ private:
QClipboard::Mode modeForAtom(xcb_atom_t atom) const;
// Selection and Clipboard
- QXcbClipboardMime *m_xClipboard[2];
+ QScopedPointer<QXcbClipboardMime> m_xClipboard[2];
QMimeData *m_clientClipboard[2];
xcb_timestamp_t m_timestamp[2];
diff --git a/src/plugins/platforms/xcb/qxcbcursor.cpp b/src/plugins/platforms/xcb/qxcbcursor.cpp
index 11e0c998b1..4de4be43d1 100644
--- a/src/plugins/platforms/xcb/qxcbcursor.cpp
+++ b/src/plugins/platforms/xcb/qxcbcursor.cpp
@@ -359,17 +359,27 @@ void QXcbCursor::changeCursor(QCursor *cursor, QWindow *widget)
return;
xcb_cursor_t c = XCB_CURSOR_NONE;
+ bool isBitmapCursor = false;
+
if (cursor) {
- const QXcbCursorCacheKey key(*cursor);
- CursorHash::iterator it = m_cursorHash.find(key);
- if (it == m_cursorHash.end()) {
- const Qt::CursorShape shape = cursor->shape();
- it = m_cursorHash.insert(key, shape == Qt::BitmapCursor ? createBitmapCursor(cursor) : createFontCursor(shape));
+ const Qt::CursorShape shape = cursor->shape();
+ isBitmapCursor = shape == Qt::BitmapCursor;
+
+ if (!isBitmapCursor) {
+ const QXcbCursorCacheKey key(*cursor);
+ CursorHash::iterator it = m_cursorHash.find(key);
+ if (it == m_cursorHash.end()) {
+ it = m_cursorHash.insert(key, createFontCursor(shape));
+ }
+ c = it.value();
+ } else {
+ // Do not cache bitmap cursors, as otherwise they have unclear
+ // lifetime (we effectively leak xcb_cursor_t).
+ c = createBitmapCursor(cursor);
}
- c = it.value();
}
- w->setCursor(c);
+ w->setCursor(c, isBitmapCursor);
}
static int cursorIdForShape(int cshape)
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index c703fbef22..d22ea00d8a 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -326,6 +326,7 @@ QXcbWindow::QXcbWindow(QWindow *window)
, m_lastWindowStateEvent(-1)
, m_syncState(NoSyncNeeded)
, m_pendingSyncRequest(0)
+ , m_currentBitmapCursor(XCB_CURSOR_NONE)
{
setConnection(xcbScreen()->connection());
}
@@ -600,6 +601,9 @@ void QXcbWindow::create()
QXcbWindow::~QXcbWindow()
{
+ if (m_currentBitmapCursor != XCB_CURSOR_NONE) {
+ xcb_free_cursor(xcb_connection(), m_currentBitmapCursor);
+ }
if (window()->type() != Qt::ForeignWindow)
destroy();
else {
@@ -2679,10 +2683,22 @@ bool QXcbWindow::setMouseGrabEnabled(bool grab)
return result;
}
-void QXcbWindow::setCursor(xcb_cursor_t cursor)
+void QXcbWindow::setCursor(xcb_cursor_t cursor, bool isBitmapCursor)
{
- xcb_change_window_attributes(xcb_connection(), m_window, XCB_CW_CURSOR, &cursor);
- xcb_flush(xcb_connection());
+ xcb_connection_t *conn = xcb_connection();
+
+ xcb_change_window_attributes(conn, m_window, XCB_CW_CURSOR, &cursor);
+ xcb_flush(conn);
+
+ if (m_currentBitmapCursor != XCB_CURSOR_NONE) {
+ xcb_free_cursor(conn, m_currentBitmapCursor);
+ }
+
+ if (isBitmapCursor) {
+ m_currentBitmapCursor = cursor;
+ } else {
+ m_currentBitmapCursor = XCB_CURSOR_NONE;
+ }
}
void QXcbWindow::windowEvent(QEvent *event)
diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h
index 41dccbe4af..92f3f7a67c 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.h
+++ b/src/plugins/platforms/xcb/qxcbwindow.h
@@ -103,7 +103,7 @@ public:
bool setKeyboardGrabEnabled(bool grab) Q_DECL_OVERRIDE;
bool setMouseGrabEnabled(bool grab) Q_DECL_OVERRIDE;
- void setCursor(xcb_cursor_t cursor);
+ void setCursor(xcb_cursor_t cursor, bool isBitmapCursor);
QSurfaceFormat format() const Q_DECL_OVERRIDE;
@@ -272,6 +272,7 @@ protected:
SyncState m_syncState;
QXcbSyncWindowRequest *m_pendingSyncRequest;
+ xcb_cursor_t m_currentBitmapCursor;
};
QT_END_NAMESPACE
diff --git a/src/sql/kernel/qsqlrecord.cpp b/src/sql/kernel/qsqlrecord.cpp
index ef60cd4cf5..d5adff67a4 100644
--- a/src/sql/kernel/qsqlrecord.cpp
+++ b/src/sql/kernel/qsqlrecord.cpp
@@ -94,7 +94,7 @@ QString QSqlRecordPrivate::createField(int index, const QString &prefix) const
view within the database). QSqlRecord supports adding and
removing fields as well as setting and retrieving field values.
- The values of a record's fields' can be set by name or position
+ The values of a record's fields can be set by name or position
with setValue(); if you want to set a field to null use
setNull(). To find the position of a field by name use indexOf(),
and to find the name of a field at a particular position use
diff --git a/src/testlib/qtestcase.h b/src/testlib/qtestcase.h
index 106fa7abd5..045431fcaf 100644
--- a/src/testlib/qtestcase.h
+++ b/src/testlib/qtestcase.h
@@ -130,57 +130,57 @@ do {\
#endif // !QT_NO_EXCEPTIONS
-#define QTRY_LOOP_IMPL(__expr, __timeoutValue, __step) \
- if (!(__expr)) { \
+#define QTRY_LOOP_IMPL(expr, timeoutValue, step) \
+ if (!(expr)) { \
QTest::qWait(0); \
} \
- int __i = 0; \
- for (; __i < __timeoutValue && !(__expr); __i += __step) { \
- QTest::qWait(__step); \
+ int qt_test_i = 0; \
+ for (; qt_test_i < timeoutValue && !(expr); qt_test_i += step) { \
+ QTest::qWait(step); \
}
-#define QTRY_TIMEOUT_DEBUG_IMPL(__expr, __timeoutValue, __step)\
- if (!(__expr)) { \
- QTRY_LOOP_IMPL((__expr), (2 * __timeoutValue), __step);\
- if (__expr) { \
+#define QTRY_TIMEOUT_DEBUG_IMPL(expr, timeoutValue, step)\
+ if (!(expr)) { \
+ QTRY_LOOP_IMPL((expr), (2 * timeoutValue), step);\
+ if (expr) { \
QString msg = QString::fromUtf8("QTestLib: This test case check (\"%1\") failed because the requested timeout (%2 ms) was too short, %3 ms would have been sufficient this time."); \
- msg = msg.arg(QString::fromUtf8(#__expr)).arg(__timeoutValue).arg(__timeoutValue + __i); \
+ msg = msg.arg(QString::fromUtf8(#expr)).arg(timeoutValue).arg(timeoutValue + qt_test_i); \
QFAIL(qPrintable(msg)); \
} \
}
-#define QTRY_IMPL(__expr, __timeout)\
- const int __step = 50; \
- const int __timeoutValue = __timeout; \
- QTRY_LOOP_IMPL((__expr), __timeoutValue, __step); \
- QTRY_TIMEOUT_DEBUG_IMPL((__expr), __timeoutValue, __step)\
+#define QTRY_IMPL(expr, timeout)\
+ const int qt_test_step = 50; \
+ const int qt_test_timeoutValue = timeout; \
+ QTRY_LOOP_IMPL((expr), qt_test_timeoutValue, qt_test_step); \
+ QTRY_TIMEOUT_DEBUG_IMPL((expr), qt_test_timeoutValue, qt_test_step)\
// Will try to wait for the expression to become true while allowing event processing
-#define QTRY_VERIFY_WITH_TIMEOUT(__expr, __timeout) \
+#define QTRY_VERIFY_WITH_TIMEOUT(expr, timeout) \
do { \
- QTRY_IMPL((__expr), __timeout);\
- QVERIFY(__expr); \
+ QTRY_IMPL((expr), timeout);\
+ QVERIFY(expr); \
} while (0)
-#define QTRY_VERIFY(__expr) QTRY_VERIFY_WITH_TIMEOUT((__expr), 5000)
+#define QTRY_VERIFY(expr) QTRY_VERIFY_WITH_TIMEOUT((expr), 5000)
// Will try to wait for the expression to become true while allowing event processing
-#define QTRY_VERIFY2_WITH_TIMEOUT(__expr, __messageExpression, __timeout) \
+#define QTRY_VERIFY2_WITH_TIMEOUT(expr, messageExpression, timeout) \
do { \
- QTRY_IMPL((__expr), __timeout);\
- QVERIFY2(__expr, __messageExpression); \
+ QTRY_IMPL((expr), timeout);\
+ QVERIFY2(expr, messageExpression); \
} while (0)
-#define QTRY_VERIFY2(__expr, __messageExpression) QTRY_VERIFY2_WITH_TIMEOUT((__expr), (__messageExpression), 5000)
+#define QTRY_VERIFY2(expr, messageExpression) QTRY_VERIFY2_WITH_TIMEOUT((expr), (messageExpression), 5000)
// Will try to wait for the comparison to become successful while allowing event processing
-#define QTRY_COMPARE_WITH_TIMEOUT(__expr, __expected, __timeout) \
+#define QTRY_COMPARE_WITH_TIMEOUT(expr, expected, timeout) \
do { \
- QTRY_IMPL(((__expr) == (__expected)), __timeout);\
- QCOMPARE((__expr), __expected); \
+ QTRY_IMPL(((expr) == (expected)), timeout);\
+ QCOMPARE((expr), expected); \
} while (0)
-#define QTRY_COMPARE(__expr, __expected) QTRY_COMPARE_WITH_TIMEOUT((__expr), __expected, 5000)
+#define QTRY_COMPARE(expr, expected) QTRY_COMPARE_WITH_TIMEOUT((expr), expected, 5000)
#define QSKIP_INTERNAL(statement) \
do {\
diff --git a/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp b/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp
index 8dbb1bf350..bd94017821 100644
--- a/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp
+++ b/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp
@@ -204,7 +204,10 @@ static QString classNameForInterface(const QString &interface, ClassType classTy
return retval;
}
-static QByteArray qtTypeName(const QString &signature, const QDBusIntrospection::Annotations &annotations, int paramId = -1, const char *direction = "Out")
+// ### Qt6 Remove the two isSignal ifs
+// They are only here because before signal arguments where previously searched as "In" so to maintain compatibility
+// we first search for "Out" and if not found we search for "In"
+static QByteArray qtTypeName(const QString &signature, const QDBusIntrospection::Annotations &annotations, int paramId = -1, const char *direction = "Out", bool isSignal = false)
{
int type = QDBusMetaType::signatureToType(signature.toLatin1());
if (type == QVariant::Invalid) {
@@ -221,9 +224,15 @@ static QByteArray qtTypeName(const QString &signature, const QDBusIntrospection:
qttype = annotations.value(oldAnnotationName);
if (qttype.isEmpty()) {
- fprintf(stderr, "Got unknown type `%s'\n", qPrintable(signature));
- fprintf(stderr, "You should add <annotation name=\"%s\" value=\"<type>\"/> to the XML description\n",
- qPrintable(annotationName));
+ if (!isSignal || qstrcmp(direction, "Out") == 0) {
+ fprintf(stderr, "Got unknown type `%s'\n", qPrintable(signature));
+ fprintf(stderr, "You should add <annotation name=\"%s\" value=\"<type>\"/> to the XML description\n",
+ qPrintable(annotationName));
+ }
+
+ if (isSignal)
+ return qtTypeName(signature, annotations, paramId, "In", isSignal);
+
exit(1);
}
@@ -323,6 +332,23 @@ static void writeArgList(QTextStream &ts, const QStringList &argNames,
}
}
+static void writeSignalArgList(QTextStream &ts, const QStringList &argNames,
+ const QDBusIntrospection::Annotations &annotations,
+ const QDBusIntrospection::Arguments &outputArgs)
+{
+ bool first = true;
+ int argPos = 0;
+ for (int i = 0; i < outputArgs.count(); ++i) {
+ const QDBusIntrospection::Argument &arg = outputArgs.at(i);
+ QString type = constRefArg(qtTypeName(arg.type, annotations, i, "Out", true /* isSignal */));
+
+ if (!first)
+ ts << ", ";
+ ts << type << argNames.at(argPos++);
+ first = false;
+ }
+}
+
static QString propertyGetter(const QDBusIntrospection::Property &property)
{
QString getter = property.annotations.value(QLatin1String("org.qtproject.QtDBus.PropertyGetter"));
@@ -637,7 +663,7 @@ static void writeProxy(const QString &filename, const QDBusIntrospection::Interf
hs << "void " << signal.name << "(";
QStringList argNames = makeArgNames(signal.outputArgs);
- writeArgList(hs, argNames, signal.annotations, signal.outputArgs);
+ writeSignalArgList(hs, argNames, signal.annotations, signal.outputArgs);
hs << ");" << endl; // finished for header
}
@@ -981,7 +1007,7 @@ static void writeAdaptor(const QString &filename, const QDBusIntrospection::Inte
hs << "void " << signal.name << "(";
QStringList argNames = makeArgNames(signal.outputArgs);
- writeArgList(hs, argNames, signal.annotations, signal.outputArgs);
+ writeSignalArgList(hs, argNames, signal.annotations, signal.outputArgs);
hs << ");" << endl; // finished for header
}
diff --git a/src/widgets/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp
index d2b909d201..6e1bee94c4 100644
--- a/src/widgets/dialogs/qfilesystemmodel.cpp
+++ b/src/widgets/dialogs/qfilesystemmodel.cpp
@@ -903,15 +903,13 @@ bool QFileSystemModel::setData(const QModelIndex &idx, const QVariant &value, in
QFileSystemModelPrivate::QFileSystemNode *parentNode = indexNode->parent;
int visibleLocation = parentNode->visibleLocation(parentNode->children.value(indexNode->fileName)->fileName);
- d->addNode(parentNode, newName,indexNode->info->fileInfo());
parentNode->visibleChildren.removeAt(visibleLocation);
QFileSystemModelPrivate::QFileSystemNode * oldValue = parentNode->children.value(oldName);
parentNode->children[newName] = oldValue;
- QFileInfo info(parentPath, newName);
oldValue->fileName = newName;
oldValue->parent = parentNode;
#ifndef QT_NO_FILESYSTEMWATCHER
- oldValue->populate(d->fileInfoGatherer.getInfo(info));
+ oldValue->populate(d->fileInfoGatherer.getInfo(QFileInfo(parentPath, newName)));
#endif
oldValue->isVisible = true;
diff --git a/src/widgets/doc/src/model-view-programming.qdoc b/src/widgets/doc/src/model-view-programming.qdoc
index f172679d04..6a4aaa489a 100644
--- a/src/widgets/doc/src/model-view-programming.qdoc
+++ b/src/widgets/doc/src/model-view-programming.qdoc
@@ -253,7 +253,7 @@
\snippet shareddirmodel/main.cpp 0
The model is set up to use data from a certain file system. The call to
- \l{QFileSystemModel::}{setRootPath()} tell the model which drive on the
+ \l{QFileSystemModel::}{setRootPath()} tells the model which drive on the
file system to expose to the views.
We create two views so that we can examine the items held in the model in two
@@ -304,7 +304,7 @@
signals and slots mechanism.
This section describes some basic concepts that are central to the way
- item of data are accessed by other components via a model class. More
+ items of data are accessed by other components via a model class. More
advanced concepts are discussed in later sections.
\section3 Model indexes
@@ -1869,7 +1869,7 @@
\codeline
\snippet qsortfilterproxymodel/main.cpp 1
- Since proxy models are inherit from QAbstractItemModel, they can be connected to
+ Since proxy models inherit from QAbstractItemModel, they can be connected to
any kind of view, and can be shared between views. They can also be used to
process the information obtained from other proxy models in a pipeline arrangement.
diff --git a/src/widgets/kernel/qlayoutitem.cpp b/src/widgets/kernel/qlayoutitem.cpp
index 76568a2c33..ee0c28ec76 100644
--- a/src/widgets/kernel/qlayoutitem.cpp
+++ b/src/widgets/kernel/qlayoutitem.cpp
@@ -306,6 +306,8 @@ void QLayoutItem::invalidate()
/*!
If this item is a QLayout, it is returned as a QLayout; otherwise
0 is returned. This function provides type-safe casting.
+
+ \sa spacerItem(), widget()
*/
QLayout * QLayoutItem::layout()
{
@@ -315,6 +317,8 @@ QLayout * QLayoutItem::layout()
/*!
If this item is a QSpacerItem, it is returned as a QSpacerItem;
otherwise 0 is returned. This function provides type-safe casting.
+
+ \sa layout(), widget()
*/
QSpacerItem * QLayoutItem::spacerItem()
{
@@ -345,8 +349,14 @@ QSpacerItem * QSpacerItem::spacerItem()
*/
/*!
- If this item is a QWidget, it is returned as a QWidget; otherwise
- 0 is returned. This function provides type-safe casting.
+ If this item manages a QWidget, returns that widget. Otherwise,
+ \c nullptr is returned.
+
+ \note While the functions layout() and spacerItem() perform casts, this
+ function returns another object: QLayout and QSpacerItem inherit QLayoutItem,
+ while QWidget does not.
+
+ \sa layout(), spacerItem()
*/
QWidget * QLayoutItem::widget()
{
diff --git a/src/widgets/styles/qdrawutil.cpp b/src/widgets/styles/qdrawutil.cpp
index a8f58eabb3..fa80a7a6ca 100644
--- a/src/widgets/styles/qdrawutil.cpp
+++ b/src/widgets/styles/qdrawutil.cpp
@@ -769,7 +769,6 @@ void qDrawPlainRect(QPainter *p, const QRect &r, const QColor &c,
\fn void qDrawBorderPixmap(QPainter *painter, const QRect &target, const QMargins &margins, const QPixmap &pixmap)
\relates <qdrawutil.h>
\since 4.6
- \overload
\brief The qDrawBorderPixmap function is for drawing a pixmap into
the margins of a rectangle.