summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-02-28 00:00:37 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2019-02-28 01:47:50 +0000
commit55b464196297afc11cb9836f61f737e6fdaf04dc (patch)
tree778b67ed3f17c28e9226d4dbe90e7e22033c8c23 /src
parent15adc79bbcaa909f43c2da3c61306cc2138567fa (diff)
parent043f99954faa8355c9f0d78d441099a6f7e1ad8b (diff)
Merge "Merge remote-tracking branch 'origin/5.12' into 5.13" into refs/staging/5.13
Diffstat (limited to 'src')
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp4
-rw-r--r--src/corelib/kernel/qeventdispatcher_win.cpp10
-rw-r--r--src/corelib/kernel/qeventdispatcher_win_p.h7
-rw-r--r--src/corelib/kernel/qobject.cpp6
-rw-r--r--src/gui/configure.json2
-rw-r--r--src/gui/configure.pri11
-rw-r--r--src/gui/kernel/qwindowsysteminterface.cpp20
-rw-r--r--src/gui/kernel/qwindowsysteminterface_p.h1
-rw-r--r--src/gui/text/qsyntaxhighlighter.cpp2
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfsscreen.cpp3
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfswindow.cpp27
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfswindow_p.h1
-rw-r--r--src/plugins/platforms/haiku/haiku.pro2
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.cpp6
-rw-r--r--src/widgets/itemviews/qabstractitemview.cpp2
-rw-r--r--src/widgets/itemviews/qlistview.cpp4
-rw-r--r--src/widgets/itemviews/qlistview_p.h19
17 files changed, 93 insertions, 34 deletions
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index db66157a0e..c06af79cc7 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -2676,9 +2676,9 @@ QStringList QCoreApplication::libraryPaths()
QStringList *app_libpaths = new QStringList;
coreappdata()->app_libpaths.reset(app_libpaths);
- const QByteArray libPathEnv = qgetenv("QT_PLUGIN_PATH");
+ QString libPathEnv = qEnvironmentVariable("QT_PLUGIN_PATH");
if (!libPathEnv.isEmpty()) {
- QStringList paths = QFile::decodeName(libPathEnv).split(QDir::listSeparator(), QString::SkipEmptyParts);
+ QStringList paths = libPathEnv.split(QDir::listSeparator(), QString::SkipEmptyParts);
for (QStringList::const_iterator it = paths.constBegin(); it != paths.constEnd(); ++it) {
QString canonicalPath = QDir(*it).canonicalPath();
if (!canonicalPath.isEmpty()
diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp
index 343ed70196..685d765adb 100644
--- a/src/corelib/kernel/qeventdispatcher_win.cpp
+++ b/src/corelib/kernel/qeventdispatcher_win.cpp
@@ -95,7 +95,7 @@ class QEventDispatcherWin32Private;
LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp);
QEventDispatcherWin32Private::QEventDispatcherWin32Private()
- : threadId(GetCurrentThreadId()), interrupt(false), closingDown(false), internalHwnd(0),
+ : threadId(GetCurrentThreadId()), interrupt(false), internalHwnd(0),
getMessageHook(0), serialNumber(0), lastSerialNumber(0), sendPostedEventsWindowsTimerId(0),
wakeUps(0), activateNotifiersPosted(false), winEventNotifierActivatedEvent(NULL)
{
@@ -552,7 +552,7 @@ bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags)
wakeUp(); // trigger a call to sendPostedEvents()
}
- d->interrupt = false;
+ d->interrupt.store(false);
emit awake();
bool canWait;
@@ -568,7 +568,7 @@ bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags)
pHandles = &d->winEventNotifierActivatedEvent;
}
QVarLengthArray<MSG> processedTimers;
- while (!d->interrupt) {
+ while (!d->interrupt.load()) {
MSG msg;
bool haveMessage;
@@ -649,7 +649,7 @@ bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags)
// still nothing - wait for message or signalled objects
canWait = (!retVal
- && !d->interrupt
+ && !d->interrupt.load()
&& (flags & QEventLoop::WaitForMoreEvents));
if (canWait) {
emit aboutToBlock();
@@ -1022,7 +1022,7 @@ void QEventDispatcherWin32::wakeUp()
void QEventDispatcherWin32::interrupt()
{
Q_D(QEventDispatcherWin32);
- d->interrupt = true;
+ d->interrupt.store(true);
wakeUp();
}
diff --git a/src/corelib/kernel/qeventdispatcher_win_p.h b/src/corelib/kernel/qeventdispatcher_win_p.h
index 707bc79407..dbad2a5450 100644
--- a/src/corelib/kernel/qeventdispatcher_win_p.h
+++ b/src/corelib/kernel/qeventdispatcher_win_p.h
@@ -165,8 +165,7 @@ public:
DWORD threadId;
- bool interrupt;
- bool closingDown;
+ QAtomicInt interrupt;
// internal window handle used for socketnotifiers/timers/etc
HWND internalHwnd;
@@ -193,9 +192,11 @@ public:
void postActivateSocketNotifiers();
void doWsaAsyncSelect(int socket, long event);
+ bool closingDown = false;
+
+ bool winEventNotifierListModified = false;
HANDLE winEventNotifierActivatedEvent;
QList<QWinEventNotifier *> winEventNotifierList;
- bool winEventNotifierListModified = false;
void activateEventNotifier(QWinEventNotifier * wen);
QList<MSG> queuedUserInputEvents;
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index e67b2306c2..3a3eb726fa 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -2175,8 +2175,10 @@ void QObject::removeEventFilter(QObject *obj)
Note that entering and leaving a new event loop (e.g., by opening a modal
dialog) will \e not perform the deferred deletion; for the object to be
- deleted, the control must return to the event loop from which
- deleteLater() was called.
+ deleted, the control must return to the event loop from which deleteLater()
+ was called. This does not apply to objects deleted while a previous, nested
+ event loop was still running: the Qt event loop will delete those objects
+ as soon as the new nested event loop starts.
\b{Note:} It is safe to call this function more than once; when the
first deferred deletion event is delivered, any pending events for the
diff --git a/src/gui/configure.json b/src/gui/configure.json
index b5bfdc4a33..59c06af97f 100644
--- a/src/gui/configure.json
+++ b/src/gui/configure.json
@@ -448,7 +448,7 @@
],
"sources": [
{ "type": "pkgConfig", "args": "gl", "condition": "!config.darwin" },
- { "type": "makeSpec", "spec": "OPENGL" }
+ { "type": "openglMakeSpec" }
]
},
"opengl_es2": {
diff --git a/src/gui/configure.pri b/src/gui/configure.pri
index 1b95449a10..0db106597e 100644
--- a/src/gui/configure.pri
+++ b/src/gui/configure.pri
@@ -15,6 +15,17 @@ defineTest(qtConfLibrary_freetype) {
return(true)
}
+defineTest(qtConfLibrary_openglMakeSpec) {
+ darwin:sdk {
+ sysrootified =
+ for(val, QMAKE_INCDIR_OPENGL): sysrootified += $${QMAKE_MAC_SDK_PATH}$$val
+ QMAKE_INCDIR_OPENGL = $$sysrootified
+ }
+ $${1}.spec = OPENGL
+ !qtConfLibrary_makeSpec($$1, $$2): return(false)
+ return(true)
+}
+
# Check for Direct X shader compiler 'fxc'.
# Up to Direct X SDK June 2010 and for MinGW, this is pointed to by the
# DXSDK_DIR variable. Starting with Windows Kit 8, it is included in
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp
index 5b32405f5e..7067ece1d8 100644
--- a/src/gui/kernel/qwindowsysteminterface.cpp
+++ b/src/gui/kernel/qwindowsysteminterface.cpp
@@ -695,13 +695,29 @@ QList<QTouchEvent::TouchPoint>
}
if (states == Qt::TouchPointReleased) {
- g_nextPointId = 1;
- g_pointIdMap->clear();
+ // All points on deviceId have been released.
+ // Remove all points associated with that device from g_pointIdMap.
+ // (On other devices, some touchpoints might still be pressed.
+ // But this function is only called with points from one device at a time.)
+ for (auto it = g_pointIdMap->begin(); it != g_pointIdMap->end();) {
+ if (it.key() >> 32 == quint64(deviceId))
+ it = g_pointIdMap->erase(it);
+ else
+ ++it;
+ }
+ if (g_pointIdMap->isEmpty())
+ g_nextPointId = 1;
}
return touchPoints;
}
+void QWindowSystemInterfacePrivate::clearPointIdMap()
+{
+ g_pointIdMap->clear();
+ g_nextPointId = 1;
+}
+
QList<QWindowSystemInterface::TouchPoint>
QWindowSystemInterfacePrivate::toNativeTouchPoints(const QList<QTouchEvent::TouchPoint>& pointList,
const QWindow *window)
diff --git a/src/gui/kernel/qwindowsysteminterface_p.h b/src/gui/kernel/qwindowsysteminterface_p.h
index 563ca8f922..6c818a9030 100644
--- a/src/gui/kernel/qwindowsysteminterface_p.h
+++ b/src/gui/kernel/qwindowsysteminterface_p.h
@@ -537,6 +537,7 @@ public:
static QList<QWindowSystemInterface::TouchPoint>
toNativeTouchPoints(const QList<QTouchEvent::TouchPoint>& pointList,
const QWindow *window);
+ static void clearPointIdMap();
static void installWindowSystemEventHandler(QWindowSystemEventHandler *handler);
static void removeWindowSystemEventhandler(QWindowSystemEventHandler *handler);
diff --git a/src/gui/text/qsyntaxhighlighter.cpp b/src/gui/text/qsyntaxhighlighter.cpp
index 0e07b69868..102a776ed3 100644
--- a/src/gui/text/qsyntaxhighlighter.cpp
+++ b/src/gui/text/qsyntaxhighlighter.cpp
@@ -297,7 +297,7 @@ void QSyntaxHighlighterPrivate::reformatBlock(const QTextBlock &block)
QSyntaxHighlighter::QSyntaxHighlighter(QObject *parent)
: QObject(*new QSyntaxHighlighterPrivate, parent)
{
- if (parent->inherits("QTextEdit")) {
+ if (parent && parent->inherits("QTextEdit")) {
QTextDocument *doc = parent->property("document").value<QTextDocument *>();
if (doc)
setDocument(doc);
diff --git a/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp b/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp
index 285dbd93d3..11b68c0589 100644
--- a/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp
+++ b/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp
@@ -62,9 +62,6 @@ QEglFSScreen::QEglFSScreen(EGLDisplay dpy)
QEglFSScreen::~QEglFSScreen()
{
delete m_cursor;
-#ifndef QT_NO_OPENGL
- QOpenGLCompositor::destroy();
-#endif
}
QRect QEglFSScreen::geometry() const
diff --git a/src/plugins/platforms/eglfs/api/qeglfswindow.cpp b/src/plugins/platforms/eglfs/api/qeglfswindow.cpp
index 29cfd4ea79..98e9ee4728 100644
--- a/src/plugins/platforms/eglfs/api/qeglfswindow.cpp
+++ b/src/plugins/platforms/eglfs/api/qeglfswindow.cpp
@@ -62,6 +62,7 @@ QEglFSWindow::QEglFSWindow(QWindow *w)
: QPlatformWindow(w),
#ifndef QT_NO_OPENGL
m_backingStore(0),
+ m_rasterCompositingContext(0),
#endif
m_raster(false),
m_winId(0),
@@ -144,18 +145,18 @@ void QEglFSWindow::create()
#ifndef QT_NO_OPENGL
if (isRaster()) {
- QOpenGLContext *context = new QOpenGLContext(QGuiApplication::instance());
- context->setShareContext(qt_gl_global_share_context());
- context->setFormat(m_format);
- context->setScreen(window()->screen());
- if (Q_UNLIKELY(!context->create()))
+ m_rasterCompositingContext = new QOpenGLContext;
+ m_rasterCompositingContext->setShareContext(qt_gl_global_share_context());
+ m_rasterCompositingContext->setFormat(m_format);
+ m_rasterCompositingContext->setScreen(window()->screen());
+ if (Q_UNLIKELY(!m_rasterCompositingContext->create()))
qFatal("EGLFS: Failed to create compositing context");
- compositor->setTarget(context, window(), screen->rawGeometry());
+ compositor->setTarget(m_rasterCompositingContext, window(), screen->rawGeometry());
compositor->setRotation(qEnvironmentVariableIntValue("QT_QPA_EGLFS_ROTATION"));
// If there is a "root" window into which raster and QOpenGLWidget content is
// composited, all other contexts must share with its context.
if (!qt_gl_global_share_context()) {
- qt_gl_set_global_share_context(context);
+ qt_gl_set_global_share_context(m_rasterCompositingContext);
// What we set up here is in effect equivalent to the application setting
// AA_ShareOpenGLContexts. Set the attribute to be fully consistent.
QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
@@ -166,6 +167,10 @@ void QEglFSWindow::create()
void QEglFSWindow::destroy()
{
+#ifndef QT_NO_OPENGL
+ QOpenGLCompositor::instance()->removeWindow(this);
+#endif
+
QEglFSScreen *screen = this->screen();
if (m_flags.testFlag(HasNativeWindow)) {
#ifndef QT_NO_OPENGL
@@ -177,12 +182,14 @@ void QEglFSWindow::destroy()
screen->setPrimarySurface(EGL_NO_SURFACE);
invalidateSurface();
- }
- m_flags = 0;
#ifndef QT_NO_OPENGL
- QOpenGLCompositor::instance()->removeWindow(this);
+ QOpenGLCompositor::destroy();
+ delete m_rasterCompositingContext;
#endif
+ }
+
+ m_flags = 0;
}
void QEglFSWindow::invalidateSurface()
diff --git a/src/plugins/platforms/eglfs/api/qeglfswindow_p.h b/src/plugins/platforms/eglfs/api/qeglfswindow_p.h
index c61f04f569..b0091e2a62 100644
--- a/src/plugins/platforms/eglfs/api/qeglfswindow_p.h
+++ b/src/plugins/platforms/eglfs/api/qeglfswindow_p.h
@@ -116,6 +116,7 @@ public:
protected:
#ifndef QT_NO_OPENGL
QOpenGLCompositorBackingStore *m_backingStore;
+ QOpenGLContext *m_rasterCompositingContext;
#endif
bool m_raster;
WId m_winId;
diff --git a/src/plugins/platforms/haiku/haiku.pro b/src/plugins/platforms/haiku/haiku.pro
index fd1f47b963..e7702361ee 100644
--- a/src/plugins/platforms/haiku/haiku.pro
+++ b/src/plugins/platforms/haiku/haiku.pro
@@ -1,6 +1,6 @@
TARGET = qhaiku
-QT += core-private gui-private eventdistpatcher_support-private
+QT += core-private gui-private eventdispatcher_support-private
SOURCES = \
main.cpp \
diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp
index 41655dbd57..80517ffe69 100644
--- a/src/plugins/platforms/windows/qwindowscontext.cpp
+++ b/src/plugins/platforms/windows/qwindowscontext.cpp
@@ -1099,6 +1099,12 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
return false;
case QtWindows::ClipboardEvent:
return false;
+ case QtWindows::CursorEvent: // Sent to windows that do not have capture (see QTBUG-58590).
+ if (QWindowsCursor::hasOverrideCursor()) {
+ QWindowsCursor::enforceOverrideCursor();
+ return true;
+ }
+ break;
case QtWindows::UnknownEvent:
return false;
case QtWindows::AccessibleObjectFromWindowRequest:
diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp
index 63803767c8..59d3ed1d15 100644
--- a/src/widgets/itemviews/qabstractitemview.cpp
+++ b/src/widgets/itemviews/qabstractitemview.cpp
@@ -1912,7 +1912,7 @@ void QAbstractItemView::mouseReleaseEvent(QMouseEvent *event)
bool click = (index == d->pressedIndex && index.isValid());
bool selectedClicked = click && (event->button() == Qt::LeftButton) && d->pressedAlreadySelected;
EditTrigger trigger = (selectedClicked ? SelectedClicked : NoEditTriggers);
- bool edited = edit(index, trigger, event);
+ const bool edited = click ? edit(index, trigger, event) : false;
d->ctrlDragSelectionFlag = QItemSelectionModel::NoUpdate;
diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp
index e7b2aaec29..641b15f85b 100644
--- a/src/widgets/itemviews/qlistview.cpp
+++ b/src/widgets/itemviews/qlistview.cpp
@@ -1315,8 +1315,8 @@ void QListView::setSelection(const QRect &rect, QItemSelectionModel::SelectionFl
if (tl.isValid() && br.isValid()
&& d->isIndexEnabled(tl)
&& d->isIndexEnabled(br)) {
- QRect first = rectForIndex(tl);
- QRect last = rectForIndex(br);
+ QRect first = d->cellRectForIndex(tl);
+ QRect last = d->cellRectForIndex(br);
QRect middle;
if (d->flow == LeftToRight) {
QRect &top = first;
diff --git a/src/widgets/itemviews/qlistview_p.h b/src/widgets/itemviews/qlistview_p.h
index 3f997ef7e3..c6810f8fdc 100644
--- a/src/widgets/itemviews/qlistview_p.h
+++ b/src/widgets/itemviews/qlistview_p.h
@@ -333,14 +333,31 @@ public:
inline QModelIndex listViewItemToIndex(const QListViewItem &item) const
{ return model->index(commonListView->itemIndex(item), column, root); }
+ inline bool hasRectForIndex(const QModelIndex &index) const
+ {
+ return isIndexValid(index) && index.parent() == root && index.column() == column && !isHidden(index.row());
+ }
+
QRect rectForIndex(const QModelIndex &index) const
{
- if (!isIndexValid(index) || index.parent() != root || index.column() != column || isHidden(index.row()))
+ if (!hasRectForIndex(index))
return QRect();
executePostedLayout();
return viewItemRect(indexToListViewItem(index));
}
+ QRect cellRectForIndex(const QModelIndex &index)
+ {
+ if (!hasRectForIndex(index))
+ return QRect();
+ executePostedLayout();
+ auto oldItemAlignment = itemAlignment;
+ itemAlignment = Qt::Alignment();
+ const QRect rect = rectForIndex(index);
+ itemAlignment = oldItemAlignment;
+ return rect;
+ }
+
void viewUpdateGeometries() { q_func()->updateGeometries(); }