summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/concurrent/qtconcurrentmedian.h1
-rw-r--r--src/corelib/thread/qthread_unix.cpp13
-rw-r--r--src/corelib/tools/qstring.cpp9
-rw-r--r--src/gui/kernel/qguiapplication.cpp87
-rw-r--r--src/platformsupport/windowsuiautomation/uiaattributeids_p.h11
-rw-r--r--src/platformsupport/windowsuiautomation/uiaclientinterfaces_p.h11
-rw-r--r--src/platformsupport/windowsuiautomation/uiacontroltypeids_p.h11
-rw-r--r--src/platformsupport/windowsuiautomation/uiaerrorids_p.h11
-rw-r--r--src/platformsupport/windowsuiautomation/uiaeventids_p.h11
-rw-r--r--src/platformsupport/windowsuiautomation/uiageneralids_p.h11
-rw-r--r--src/platformsupport/windowsuiautomation/uiapatternids_p.h11
-rw-r--r--src/platformsupport/windowsuiautomation/uiapropertyids_p.h11
-rw-r--r--src/platformsupport/windowsuiautomation/uiaserverinterfaces_p.h11
-rw-r--r--src/platformsupport/windowsuiautomation/uiatypes_p.h11
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm6
-rw-r--r--src/plugins/platforms/xcb/qxcbbackingstore.cpp3
-rw-r--r--src/plugins/sqldrivers/psql/qsql_psql.cpp11
-rw-r--r--src/widgets/graphicsview/qgraphicsitem.cpp25
-rw-r--r--src/widgets/graphicsview/qgraphicsitem_p.h1
-rw-r--r--src/widgets/graphicsview/qgraphicsscene.cpp26
20 files changed, 209 insertions, 83 deletions
diff --git a/src/concurrent/qtconcurrentmedian.h b/src/concurrent/qtconcurrentmedian.h
index 87e6b2935d..864b2d33d5 100644
--- a/src/concurrent/qtconcurrentmedian.h
+++ b/src/concurrent/qtconcurrentmedian.h
@@ -135,6 +135,7 @@ public:
MedianDouble()
: currentMedian(), currentIndex(0), valid(false), dirty(true)
{
+ std::fill_n(values, static_cast<int>(BufferSize), 0.0);
}
void reset()
diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp
index 6248842d78..9ad32b162d 100644
--- a/src/corelib/thread/qthread_unix.cpp
+++ b/src/corelib/thread/qthread_unix.cpp
@@ -83,19 +83,6 @@
#include <sys/pstat.h>
#endif
-#if defined(Q_OS_MAC)
-# ifdef qDebug
-# define old_qDebug qDebug
-# undef qDebug
-# endif
-
-# ifdef old_qDebug
-# undef qDebug
-# define qDebug QT_NO_QDEBUG_MACRO
-# undef old_qDebug
-# endif
-#endif
-
#if defined(Q_OS_LINUX) && !defined(QT_LINUXBASE)
#include <sys/prctl.h>
#endif
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index b465bdc0f4..ed56f99771 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -568,10 +568,6 @@ static int ucstricmp(const QChar *a, const QChar *ae, const QChar *b, const QCha
{
if (a == b)
return (ae - be);
- if (a == 0)
- return be - b;
- if (b == 0)
- return a - ae;
const QChar *e = ae;
if (be - b < ae - a)
@@ -600,11 +596,6 @@ static int ucstricmp(const QChar *a, const QChar *ae, const QChar *b, const QCha
// Case-insensitive comparison between a Unicode string and a QLatin1String
static int ucstricmp(const QChar *a, const QChar *ae, const char *b, const char *be)
{
- if (!a)
- return be - b;
- if (!b)
- return a - ae;
-
auto e = ae;
if (be - b < ae - a)
e = a + (be - b);
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index f7da94d111..12390928f0 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -525,21 +525,21 @@ static QWindowGeometrySpecification windowGeometrySpecification = Q_WINDOW_GEOME
\li \c{-platform} \e {platformName[:options]}, specifies the
\l{Qt Platform Abstraction} (QPA) plugin.
- Overridden by the \c QT_QPA_PLATFORM environment variable.
+ Overrides the \c QT_QPA_PLATFORM environment variable.
\li \c{-platformpluginpath} \e path, specifies the path to platform
plugins.
- Overridden by the \c QT_QPA_PLATFORM_PLUGIN_PATH environment
- variable.
+ Overrides the \c QT_QPA_PLATFORM_PLUGIN_PATH environment variable.
\li \c{-platformtheme} \e platformTheme, specifies the platform theme.
- Overridden by the \c QT_QPA_PLATFORMTHEME environment variable.
+ Overrides the \c QT_QPA_PLATFORMTHEME environment variable.
\li \c{-plugin} \e plugin, specifies additional plugins to load. The argument
may appear multiple times.
- Overridden by the \c QT_QPA_GENERIC_PLUGINS environment variable.
+ Concatenated with the plugins in the \c QT_QPA_GENERIC_PLUGINS environment
+ variable.
\li \c{-qmljsdebugger=}, activates the QML/JS debugger with a specified port.
The value must be of format \c{port:1234}\e{[,block]}, where
@@ -1125,6 +1125,8 @@ QWindow *QGuiApplication::topLevelAt(const QPoint &pos)
\li \c openwfd
\li \c qnx
\li \c windows
+ \li \c wayland is a platform plugin for modern Linux desktops and some
+ embedded systems.
\li \c xcb is the X11 plugin used on regular desktop Linux platforms.
\endlist
@@ -1138,33 +1140,47 @@ QString QGuiApplication::platformName()
*QGuiApplicationPrivate::platform_name : QString();
}
-static void init_platform(const QString &pluginArgument, const QString &platformPluginPath, const QString &platformThemeName, int &argc, char **argv)
-{
- // Split into platform name and arguments
- QStringList arguments = pluginArgument.split(QLatin1Char(':'));
- const QString name = arguments.takeFirst().toLower();
- QString argumentsKey = name;
- argumentsKey[0] = argumentsKey.at(0).toUpper();
- arguments.append(QLibraryInfo::platformPluginArguments(argumentsKey));
+Q_LOGGING_CATEGORY(lcQpaPluginLoading, "qt.qpa.plugin");
+
+static void init_platform(const QString &pluginNamesWithArguments, const QString &platformPluginPath, const QString &platformThemeName, int &argc, char **argv)
+{
+ QStringList plugins = pluginNamesWithArguments.split(QLatin1Char(';'));
+ QStringList platformArguments;
+ QStringList availablePlugins = QPlatformIntegrationFactory::keys(platformPluginPath);
+ for (auto pluginArgument : plugins) {
+ // Split into platform name and arguments
+ QStringList arguments = pluginArgument.split(QLatin1Char(':'));
+ const QString name = arguments.takeFirst().toLower();
+ QString argumentsKey = name;
+ argumentsKey[0] = argumentsKey.at(0).toUpper();
+ arguments.append(QLibraryInfo::platformPluginArguments(argumentsKey));
+
+ // Create the platform integration.
+ QGuiApplicationPrivate::platform_integration = QPlatformIntegrationFactory::create(name, arguments, argc, argv, platformPluginPath);
+ if (Q_UNLIKELY(!QGuiApplicationPrivate::platform_integration)) {
+ if (availablePlugins.contains(name)) {
+ qCInfo(lcQpaPluginLoading).nospace().noquote()
+ << "Could not load the Qt platform plugin \"" << name << "\" in \""
+ << QDir::toNativeSeparators(platformPluginPath) << "\" even though it was found.";
+ } else {
+ qCWarning(lcQpaPluginLoading).nospace().noquote()
+ << "Could not find the Qt platform plugin \"" << name << "\" in \""
+ << QDir::toNativeSeparators(platformPluginPath) << "\"";
+ }
+ } else {
+ QGuiApplicationPrivate::platform_name = new QString(name);
+ platformArguments = arguments;
+ break;
+ }
+ }
- // Create the platform integration.
- QGuiApplicationPrivate::platform_integration = QPlatformIntegrationFactory::create(name, arguments, argc, argv, platformPluginPath);
if (Q_UNLIKELY(!QGuiApplicationPrivate::platform_integration)) {
- QStringList keys = QPlatformIntegrationFactory::keys(platformPluginPath);
+ QString fatalMessage = QStringLiteral("This application failed to start because no Qt platform plugin could be initialized. "
+ "Reinstalling the application may fix this problem.\n");
- QString fatalMessage;
- if (keys.contains(name)) {
- fatalMessage = QStringLiteral("This application failed to start because it could not load the Qt platform plugin \"%2\"\nin \"%3\", even though it was found. ").arg(name, QDir::toNativeSeparators(platformPluginPath));
- fatalMessage += QStringLiteral("This is usually due to missing dependencies, which you can verify by setting the env variable QT_DEBUG_PLUGINS to 1.\n\n");
- } else {
- fatalMessage = QStringLiteral("This application failed to start because it could not find the Qt platform plugin \"%2\"\nin \"%3\".\n\n").arg(name, QDir::toNativeSeparators(platformPluginPath));
- }
+ if (!availablePlugins.isEmpty())
+ fatalMessage += QStringLiteral("\nAvailable platform plugins are: %1.\n").arg(availablePlugins.join(QLatin1String(", ")));
- if (!keys.isEmpty()) {
- fatalMessage += QStringLiteral("Available platform plugins are: %1.\n\n").arg(
- keys.join(QLatin1String(", ")));
- }
- fatalMessage += QStringLiteral("Reinstalling the application may fix this problem.");
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
// Windows: Display message box unless it is a console application
// or debug build showing an assert box.
@@ -1172,11 +1188,10 @@ static void init_platform(const QString &pluginArgument, const QString &platform
MessageBox(0, (LPCTSTR)fatalMessage.utf16(), (LPCTSTR)(QCoreApplication::applicationName().utf16()), MB_OK | MB_ICONERROR);
#endif // Q_OS_WIN && !Q_OS_WINRT
qFatal("%s", qPrintable(fatalMessage));
+
return;
}
- QGuiApplicationPrivate::platform_name = new QString(name);
-
// Many platforms have created QScreens at this point. Finish initializing
// QHighDpiScaling to be prepared for early calls to qt_defaultDpi().
if (QGuiApplication::primaryScreen()) {
@@ -1223,9 +1238,9 @@ static void init_platform(const QString &pluginArgument, const QString &platform
#ifndef QT_NO_PROPERTIES
// Set arguments as dynamic properties on the native interface as
// boolean 'foo' or strings: 'foo=bar'
- if (!arguments.isEmpty()) {
+ if (!platformArguments.isEmpty()) {
if (QObject *nativeInterface = QGuiApplicationPrivate::platform_integration->nativeInterface()) {
- for (const QString &argument : qAsConst(arguments)) {
+ for (const QString &argument : qAsConst(platformArguments)) {
const int equalsPos = argument.indexOf(QLatin1Char('='));
const QByteArray name =
equalsPos != -1 ? argument.left(equalsPos).toUtf8() : argument.toUtf8();
@@ -1289,7 +1304,7 @@ void QGuiApplicationPrivate::createPlatformIntegration()
argv[j++] = argv[i];
continue;
}
- const bool isXcb = platformName == "xcb";
+ const bool xcbIsDefault = platformName.startsWith("xcb");
const char *arg = argv[i];
if (arg[1] == '-') // startsWith("--")
++arg;
@@ -1302,13 +1317,13 @@ void QGuiApplicationPrivate::createPlatformIntegration()
} else if (strcmp(arg, "-platformtheme") == 0) {
if (++i < argc)
platformThemeName = QString::fromLocal8Bit(argv[i]);
- } else if (strcmp(arg, "-qwindowgeometry") == 0 || (isXcb && strcmp(arg, "-geometry") == 0)) {
+ } else if (strcmp(arg, "-qwindowgeometry") == 0 || (xcbIsDefault && strcmp(arg, "-geometry") == 0)) {
if (++i < argc)
windowGeometrySpecification = QWindowGeometrySpecification::fromArgument(argv[i]);
- } else if (strcmp(arg, "-qwindowtitle") == 0 || (isXcb && strcmp(arg, "-title") == 0)) {
+ } else if (strcmp(arg, "-qwindowtitle") == 0 || (xcbIsDefault && strcmp(arg, "-title") == 0)) {
if (++i < argc)
firstWindowTitle = QString::fromLocal8Bit(argv[i]);
- } else if (strcmp(arg, "-qwindowicon") == 0 || (isXcb && strcmp(arg, "-icon") == 0)) {
+ } else if (strcmp(arg, "-qwindowicon") == 0 || (xcbIsDefault && strcmp(arg, "-icon") == 0)) {
if (++i < argc) {
icon = QString::fromLocal8Bit(argv[i]);
}
diff --git a/src/platformsupport/windowsuiautomation/uiaattributeids_p.h b/src/platformsupport/windowsuiautomation/uiaattributeids_p.h
index 52e7306a67..795cb9e551 100644
--- a/src/platformsupport/windowsuiautomation/uiaattributeids_p.h
+++ b/src/platformsupport/windowsuiautomation/uiaattributeids_p.h
@@ -40,6 +40,17 @@
#ifndef UIAATTRIBUTEIDS_H
#define UIAATTRIBUTEIDS_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#define UIA_AnimationStyleAttributeId 40000
#define UIA_BackgroundColorAttributeId 40001
#define UIA_BulletStyleAttributeId 40002
diff --git a/src/platformsupport/windowsuiautomation/uiaclientinterfaces_p.h b/src/platformsupport/windowsuiautomation/uiaclientinterfaces_p.h
index b95c05f6a4..5ed79cdb47 100644
--- a/src/platformsupport/windowsuiautomation/uiaclientinterfaces_p.h
+++ b/src/platformsupport/windowsuiautomation/uiaclientinterfaces_p.h
@@ -40,6 +40,17 @@
#ifndef UIACLIENTINTERFACES_H
#define UIACLIENTINTERFACES_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <Unknwn.h>
#ifndef __IUIAutomationElement_INTERFACE_DEFINED__
diff --git a/src/platformsupport/windowsuiautomation/uiacontroltypeids_p.h b/src/platformsupport/windowsuiautomation/uiacontroltypeids_p.h
index d77fc68da9..b5c5a0a4ff 100644
--- a/src/platformsupport/windowsuiautomation/uiacontroltypeids_p.h
+++ b/src/platformsupport/windowsuiautomation/uiacontroltypeids_p.h
@@ -40,6 +40,17 @@
#ifndef UIACONTROLTYPEIDS_H
#define UIACONTROLTYPEIDS_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#define UIA_ButtonControlTypeId 50000
#define UIA_CalendarControlTypeId 50001
#define UIA_CheckBoxControlTypeId 50002
diff --git a/src/platformsupport/windowsuiautomation/uiaerrorids_p.h b/src/platformsupport/windowsuiautomation/uiaerrorids_p.h
index c25453007d..8c2a24dbc7 100644
--- a/src/platformsupport/windowsuiautomation/uiaerrorids_p.h
+++ b/src/platformsupport/windowsuiautomation/uiaerrorids_p.h
@@ -40,6 +40,17 @@
#ifndef UIAERRORIDS_H
#define UIAERRORIDS_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#define UIA_E_ELEMENTNOTENABLED 0x80040200
#define UIA_E_ELEMENTNOTAVAILABLE 0x80040201
#define UIA_E_NOCLICKABLEPOINT 0x80040202
diff --git a/src/platformsupport/windowsuiautomation/uiaeventids_p.h b/src/platformsupport/windowsuiautomation/uiaeventids_p.h
index 2b414968ed..ed6c36834e 100644
--- a/src/platformsupport/windowsuiautomation/uiaeventids_p.h
+++ b/src/platformsupport/windowsuiautomation/uiaeventids_p.h
@@ -40,6 +40,17 @@
#ifndef UIAEVENTIDS_H
#define UIAEVENTIDS_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#define UIA_ToolTipOpenedEventId 20000
#define UIA_ToolTipClosedEventId 20001
#define UIA_StructureChangedEventId 20002
diff --git a/src/platformsupport/windowsuiautomation/uiageneralids_p.h b/src/platformsupport/windowsuiautomation/uiageneralids_p.h
index 62c795b94a..220554f885 100644
--- a/src/platformsupport/windowsuiautomation/uiageneralids_p.h
+++ b/src/platformsupport/windowsuiautomation/uiageneralids_p.h
@@ -40,6 +40,17 @@
#ifndef UIAGENERALIDS_H
#define UIAGENERALIDS_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#define UiaAppendRuntimeId 3
#define UiaRootObjectId -25
diff --git a/src/platformsupport/windowsuiautomation/uiapatternids_p.h b/src/platformsupport/windowsuiautomation/uiapatternids_p.h
index 114aabcaa5..d3f4c9bd7a 100644
--- a/src/platformsupport/windowsuiautomation/uiapatternids_p.h
+++ b/src/platformsupport/windowsuiautomation/uiapatternids_p.h
@@ -40,6 +40,17 @@
#ifndef UIAPATTERNIDS_H
#define UIAPATTERNIDS_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#define UIA_InvokePatternId 10000
#define UIA_SelectionPatternId 10001
#define UIA_ValuePatternId 10002
diff --git a/src/platformsupport/windowsuiautomation/uiapropertyids_p.h b/src/platformsupport/windowsuiautomation/uiapropertyids_p.h
index 5c35c956f8..74e84147f6 100644
--- a/src/platformsupport/windowsuiautomation/uiapropertyids_p.h
+++ b/src/platformsupport/windowsuiautomation/uiapropertyids_p.h
@@ -40,6 +40,17 @@
#ifndef UIAPROPERTYIDS_H
#define UIAPROPERTYIDS_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#define UIA_RuntimeIdPropertyId 30000
#define UIA_BoundingRectanglePropertyId 30001
#define UIA_ProcessIdPropertyId 30002
diff --git a/src/platformsupport/windowsuiautomation/uiaserverinterfaces_p.h b/src/platformsupport/windowsuiautomation/uiaserverinterfaces_p.h
index caae84755b..a6a2e4c20d 100644
--- a/src/platformsupport/windowsuiautomation/uiaserverinterfaces_p.h
+++ b/src/platformsupport/windowsuiautomation/uiaserverinterfaces_p.h
@@ -40,6 +40,17 @@
#ifndef UIASERVERINTERFACES_H
#define UIASERVERINTERFACES_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <Unknwn.h>
#ifndef __IRawElementProviderSimple_INTERFACE_DEFINED__
diff --git a/src/platformsupport/windowsuiautomation/uiatypes_p.h b/src/platformsupport/windowsuiautomation/uiatypes_p.h
index 25d8b8cb2b..ea58417943 100644
--- a/src/platformsupport/windowsuiautomation/uiatypes_p.h
+++ b/src/platformsupport/windowsuiautomation/uiatypes_p.h
@@ -40,6 +40,17 @@
#ifndef UIATYPES_H
#define UIATYPES_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
typedef int PROPERTYID;
typedef int PATTERNID;
typedef int EVENTID;
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index 471a19adb0..3bc9055650 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -1126,13 +1126,11 @@ void QCocoaWindow::handleGeometryChange()
// Guard against processing window system events during QWindow::setGeometry
// calls, which Qt and Qt applications do not expect.
if (!m_inSetGeometry)
- QWindowSystemInterface::flushWindowSystemEvents();
+ QWindowSystemInterface::flushWindowSystemEvents(QEventLoop::ExcludeUserInputEvents | QEventLoop::ExcludeSocketNotifiers);
}
void QCocoaWindow::handleExposeEvent(const QRegion &region)
{
- const QRect previouslyExposedRect = m_exposedRect;
-
// Ideally we'd implement isExposed() in terms of these properties,
// plus the occlusionState of the NSWindow, and let the expose event
// pull the exposed state out when needed. However, when the window
@@ -1326,7 +1324,7 @@ void QCocoaWindow::recreateWindowIfNeeded()
void QCocoaWindow::requestUpdate()
{
qCDebug(lcQpaCocoaDrawing) << "QCocoaWindow::requestUpdate" << window();
- [m_view requestUpdate];
+ [qnsview_cast(m_view) requestUpdate];
}
void QCocoaWindow::requestActivateWindow()
diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.cpp b/src/plugins/platforms/xcb/qxcbbackingstore.cpp
index eae0ee7613..6ae52d9fd3 100644
--- a/src/plugins/platforms/xcb/qxcbbackingstore.cpp
+++ b/src/plugins/platforms/xcb/qxcbbackingstore.cpp
@@ -343,6 +343,9 @@ void QXcbShmImage::createShmSegment(size_t segmentSize)
void QXcbShmImage::destroyShmSegment(size_t segmentSize)
{
+#ifndef XCB_USE_SHM_FD
+ Q_UNUSED(segmentSize)
+#endif
auto cookie = xcb_shm_detach_checked(xcb_connection(), m_shm_info.shmseg);
xcb_generic_error_t *error = xcb_request_check(xcb_connection(), cookie);
if (error)
diff --git a/src/plugins/sqldrivers/psql/qsql_psql.cpp b/src/plugins/sqldrivers/psql/qsql_psql.cpp
index 6f105f79ca..368b777ca5 100644
--- a/src/plugins/sqldrivers/psql/qsql_psql.cpp
+++ b/src/plugins/sqldrivers/psql/qsql_psql.cpp
@@ -204,6 +204,7 @@ public:
void setDatestyle();
void setByteaOutput();
void detectBackslashEscape();
+ mutable QHash<int, QString> oidToTable;
};
void QPSQLDriverPrivate::appendTables(QStringList &tl, QSqlQuery &t, QChar type)
@@ -815,18 +816,20 @@ QSqlRecord QPSQLResult::record() const
f.setName(QString::fromUtf8(PQfname(d->result, i)));
else
f.setName(QString::fromLocal8Bit(PQfname(d->result, i)));
-
+ const int tableOid = PQftable(d->result, i);
+ auto &tableName = d->drv_d_func()->oidToTable[tableOid];
// WARNING: We cannot execute any other SQL queries on
// the same db connection while forward-only mode is active
// (this would discard all results of forward-only query).
// So we just skip this...
- if (!isForwardOnly()) {
+ if (tableName.isEmpty() && !isForwardOnly()) {
QSqlQuery qry(driver()->createResult());
if (qry.exec(QStringLiteral("SELECT relname FROM pg_class WHERE pg_class.oid = %1")
- .arg(PQftable(d->result, i))) && qry.next()) {
- f.setTableName(qry.value(0).toString());
+ .arg(tableOid)) && qry.next()) {
+ tableName = qry.value(0).toString();
}
}
+ f.setTableName(tableName);
int ptype = PQftype(d->result, i);
f.setType(qDecodePSQLType(ptype));
int len = PQfsize(d->result, i);
diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp
index 0bc3af2f77..cef1d1b6da 100644
--- a/src/widgets/graphicsview/qgraphicsitem.cpp
+++ b/src/widgets/graphicsview/qgraphicsitem.cpp
@@ -1134,19 +1134,26 @@ void QGraphicsItemPrivate::remapItemPos(QEvent *event, QGraphicsItem *item)
is untransformable, this function will correctly map \a pos from the scene using the
view's transformation.
*/
-QPointF QGraphicsItemPrivate::genericMapFromScene(const QPointF &pos,
- const QWidget *viewport) const
+
+QTransform QGraphicsItemPrivate::genericMapFromSceneTransform(const QWidget *viewport) const
{
Q_Q(const QGraphicsItem);
if (!itemIsUntransformable())
- return q->mapFromScene(pos);
- QGraphicsView *view = 0;
- if (viewport)
- view = qobject_cast<QGraphicsView *>(viewport->parentWidget());
- if (!view)
- return q->mapFromScene(pos);
+ return sceneTransform.inverted();
+ const QGraphicsView *view = viewport
+ ? qobject_cast<QGraphicsView *>(viewport->parentWidget())
+ : nullptr;
+ if (view == nullptr)
+ return sceneTransform.inverted();
// ### More ping pong than needed.
- return q->deviceTransform(view->viewportTransform()).inverted().map(view->mapFromScene(pos));
+ const QTransform viewportTransform = view->viewportTransform();
+ return viewportTransform * q->deviceTransform(viewportTransform).inverted();
+}
+
+QPointF QGraphicsItemPrivate::genericMapFromScene(const QPointF &pos,
+ const QWidget *viewport) const
+{
+ return genericMapFromSceneTransform(viewport).map(pos);
}
/*!
diff --git a/src/widgets/graphicsview/qgraphicsitem_p.h b/src/widgets/graphicsview/qgraphicsitem_p.h
index bae38473f9..9fc6c0794a 100644
--- a/src/widgets/graphicsview/qgraphicsitem_p.h
+++ b/src/widgets/graphicsview/qgraphicsitem_p.h
@@ -190,6 +190,7 @@ public:
void updateAncestorFlags();
void setIsMemberOfGroup(bool enabled);
void remapItemPos(QEvent *event, QGraphicsItem *item);
+ QTransform genericMapFromSceneTransform(const QWidget *viewport = nullptr) const;
QPointF genericMapFromScene(const QPointF &pos, const QWidget *viewport) const;
inline bool itemIsUntransformable() const
{
diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp
index 25b77aa02f..37c631483a 100644
--- a/src/widgets/graphicsview/qgraphicsscene.cpp
+++ b/src/widgets/graphicsview/qgraphicsscene.cpp
@@ -1286,10 +1286,11 @@ void QGraphicsScenePrivate::sendHoverEvent(QEvent::Type type, QGraphicsItem *ite
{
QGraphicsSceneHoverEvent event(type);
event.setWidget(hoverEvent->widget());
- event.setPos(item->d_ptr->genericMapFromScene(hoverEvent->scenePos(), hoverEvent->widget()));
+ const QTransform mapFromScene = item->d_ptr->genericMapFromSceneTransform(hoverEvent->widget());
+ event.setPos(mapFromScene.map(hoverEvent->scenePos()));
event.setScenePos(hoverEvent->scenePos());
event.setScreenPos(hoverEvent->screenPos());
- event.setLastPos(item->d_ptr->genericMapFromScene(hoverEvent->lastScenePos(), hoverEvent->widget()));
+ event.setLastPos(mapFromScene.map(hoverEvent->lastScenePos()));
event.setLastScenePos(hoverEvent->lastScenePos());
event.setLastScreenPos(hoverEvent->lastScreenPos());
event.setModifiers(hoverEvent->modifiers());
@@ -1312,14 +1313,16 @@ void QGraphicsScenePrivate::sendMouseEvent(QGraphicsSceneMouseEvent *mouseEvent)
if (item->isBlockedByModalPanel())
return;
+ const QTransform mapFromScene = item->d_ptr->genericMapFromSceneTransform(mouseEvent->widget());
+ const QPointF itemPos = mapFromScene.map(mouseEvent->scenePos());
for (int i = 0x1; i <= 0x10; i <<= 1) {
Qt::MouseButton button = Qt::MouseButton(i);
- mouseEvent->setButtonDownPos(button, mouseGrabberButtonDownPos.value(button, item->d_ptr->genericMapFromScene(mouseEvent->scenePos(), mouseEvent->widget())));
+ mouseEvent->setButtonDownPos(button, mouseGrabberButtonDownPos.value(button, itemPos));
mouseEvent->setButtonDownScenePos(button, mouseGrabberButtonDownScenePos.value(button, mouseEvent->scenePos()));
mouseEvent->setButtonDownScreenPos(button, mouseGrabberButtonDownScreenPos.value(button, mouseEvent->screenPos()));
}
- mouseEvent->setPos(item->d_ptr->genericMapFromScene(mouseEvent->scenePos(), mouseEvent->widget()));
- mouseEvent->setLastPos(item->d_ptr->genericMapFromScene(mouseEvent->lastScenePos(), mouseEvent->widget()));
+ mouseEvent->setPos(itemPos);
+ mouseEvent->setLastPos(mapFromScene.map(mouseEvent->lastScenePos()));
sendEvent(item, mouseEvent);
}
@@ -5858,10 +5861,17 @@ void QGraphicsScenePrivate::removeView(QGraphicsView *view)
void QGraphicsScenePrivate::updateTouchPointsForItem(QGraphicsItem *item, QTouchEvent *touchEvent)
{
+ const QTransform mapFromScene =
+ item->d_ptr->genericMapFromSceneTransform(static_cast<const QWidget *>(touchEvent->target()));
+
for (auto &touchPoint : touchEvent->_touchPoints) {
- touchPoint.setRect(item->mapFromScene(touchPoint.sceneRect()).boundingRect());
- touchPoint.setStartPos(item->d_ptr->genericMapFromScene(touchPoint.startScenePos(), static_cast<QWidget *>(touchEvent->target())));
- touchPoint.setLastPos(item->d_ptr->genericMapFromScene(touchPoint.lastScenePos(), static_cast<QWidget *>(touchEvent->target())));
+ // Deprecated TouchPoint::setRect clobbers ellipseDiameters, restore
+ const QSizeF ellipseDiameters = touchPoint.ellipseDiameters();
+ touchPoint.setRect(mapFromScene.map(touchPoint.sceneRect()).boundingRect());
+ touchPoint.setEllipseDiameters(ellipseDiameters);
+ touchPoint.setPos(mapFromScene.map(touchPoint.scenePos()));
+ touchPoint.setStartPos(mapFromScene.map(touchPoint.startScenePos()));
+ touchPoint.setLastPos(mapFromScene.map(touchPoint.lastScenePos()));
}
}