summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/cocoa/qcocoaclipboard.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoacursor.h3
-rw-r--r--src/plugins/platforms/cocoa/qcocoacursor.mm25
-rw-r--r--src/plugins/platforms/cocoa/qcocoaeventdispatcher.h1
-rw-r--r--src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm22
-rw-r--r--src/plugins/platforms/cocoa/qcocoaglcontext.h4
-rw-r--r--src/plugins/platforms/cocoa/qcocoaglcontext.mm20
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm5
-rw-r--r--src/plugins/platforms/cocoa/qmacclipboard.mm8
-rw-r--r--src/plugins/platforms/qnx/qqnxscreeneventthread.cpp24
-rw-r--r--src/plugins/platforms/qnx/qqnxscreeneventthread.h2
-rw-r--r--src/plugins/platforms/wasm/qwasmscreen.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowscursor.cpp25
-rw-r--r--src/plugins/platforms/windows/qwindowscursor.h2
-rw-r--r--src/plugins/platforms/windows/qwindowssystemtrayicon.cpp10
-rw-r--r--src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp3
-rw-r--r--src/plugins/platforms/xcb/qxcbscreen.cpp11
-rw-r--r--src/plugins/sqldrivers/psql/qsql_psql.cpp1
18 files changed, 158 insertions, 12 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaclipboard.mm b/src/plugins/platforms/cocoa/qcocoaclipboard.mm
index a35c153084..141940cc50 100644
--- a/src/plugins/platforms/cocoa/qcocoaclipboard.mm
+++ b/src/plugins/platforms/cocoa/qcocoaclipboard.mm
@@ -67,7 +67,7 @@ void QCocoaClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode)
}
pasteBoard->sync();
- pasteBoard->setMimeData(data);
+ pasteBoard->setMimeData(data, QMacPasteboard::LazyRequest);
emitChanged(mode);
}
}
diff --git a/src/plugins/platforms/cocoa/qcocoacursor.h b/src/plugins/platforms/cocoa/qcocoacursor.h
index 58b9ef2151..5b008eff35 100644
--- a/src/plugins/platforms/cocoa/qcocoacursor.h
+++ b/src/plugins/platforms/cocoa/qcocoacursor.h
@@ -56,6 +56,9 @@ public:
void changeCursor(QCursor *cursor, QWindow *window) override;
QPoint pos() const override;
void setPos(const QPoint &position) override;
+
+ QSize size() const override;
+
private:
QHash<Qt::CursorShape, NSCursor *> m_cursors;
NSCursor *convertCursor(QCursor *cursor);
diff --git a/src/plugins/platforms/cocoa/qcocoacursor.mm b/src/plugins/platforms/cocoa/qcocoacursor.mm
index 87a57c78c8..e0d623fc4c 100644
--- a/src/plugins/platforms/cocoa/qcocoacursor.mm
+++ b/src/plugins/platforms/cocoa/qcocoacursor.mm
@@ -85,6 +85,31 @@ void QCocoaCursor::setPos(const QPoint &position)
CFRelease(e);
}
+
+QSize QCocoaCursor::size() const
+{
+ NSCursor *cocoaCursor = NSCursor.currentSystemCursor;
+ if (!cocoaCursor)
+ return QPlatformCursor::size();
+ NSImage *cursorImage = cocoaCursor.image;
+ if (!cursorImage)
+ return QPlatformCursor::size();
+
+ QSizeF size = QSizeF::fromCGSize(cursorImage.size);
+ NSUserDefaults *defaults = NSUserDefaults.standardUserDefaults;
+ NSDictionary *accessSettings = [defaults persistentDomainForName:@"com.apple.universalaccess"];
+ if (accessSettings == nil)
+ return size.toSize();
+
+ float sizeScale = [accessSettings[@"mouseDriverCursorSize"] floatValue];
+ if (sizeScale > 0) {
+ size.rwidth() *= sizeScale;
+ size.rheight() *= sizeScale;
+ }
+
+ return size.toSize();
+}
+
NSCursor *QCocoaCursor::convertCursor(QCursor *cursor)
{
if (!cursor)
diff --git a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.h b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.h
index 69587a24be..b8d2532b8e 100644
--- a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.h
+++ b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.h
@@ -186,6 +186,7 @@ public:
QAtomicInt serialNumber;
int lastSerial;
bool interrupt;
+ bool propagateInterrupt = false;
static void postedEventsSourceCallback(void *info);
static void waitingObserverCallback(CFRunLoopObserverRef observer,
diff --git a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm
index 110c82bf1f..94b9e62eab 100644
--- a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm
+++ b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm
@@ -84,13 +84,12 @@
#include "private/qthread_p.h"
#include "private/qguiapplication_p.h"
#include <qdebug.h>
+#include <qscopeguard.h>
#include <AppKit/AppKit.h>
QT_BEGIN_NAMESPACE
-QT_USE_NAMESPACE
-
static inline CFRunLoopRef mainRunLoop()
{
return CFRunLoopGetMain();
@@ -348,6 +347,16 @@ static inline void qt_mac_waitForMoreEvents(NSString *runLoopMode = NSDefaultRun
bool QCocoaEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags flags)
{
Q_D(QCocoaEventDispatcher);
+
+ // In rare rather corner cases a user's application messes with
+ // QEventLoop::exec()/exit() and QCoreApplication::processEvents(),
+ // we have to undo what bool blocker normally does.
+ d->propagateInterrupt = false;
+ const auto boolBlockerUndo = qScopeGuard([d](){
+ if (d->propagateInterrupt)
+ d->interrupt = true;
+ d->propagateInterrupt = false;
+ });
QBoolBlocker interruptBlocker(d->interrupt, false);
bool interruptLater = false;
@@ -496,7 +505,16 @@ bool QCocoaEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags flags)
if ((d->processEventsFlags & QEventLoop::EventLoopExec) == 0) {
// When called "manually", always process posted events and timers
+ bool oldInterrupt = d->interrupt;
d->processPostedEvents();
+ if (!oldInterrupt && d->interrupt && !d->currentModalSession()) {
+ // We had direct processEvent call, coming not from QEventLoop::exec().
+ // One of the posted events triggered an application to interrupt the loop.
+ // But bool blocker will reset d->interrupt to false, so the real event
+ // loop will never notice it was interrupted. Now we'll have to fix it by
+ // enforcing the value of d->interrupt.
+ d->propagateInterrupt = true;
+ }
retVal = d->processTimers() || retVal;
}
diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.h b/src/plugins/platforms/cocoa/qcocoaglcontext.h
index 4210a4ed3f..238067568b 100644
--- a/src/plugins/platforms/cocoa/qcocoaglcontext.h
+++ b/src/plugins/platforms/cocoa/qcocoaglcontext.h
@@ -86,6 +86,10 @@ private:
QSurfaceFormat m_format;
QVarLengthArray<QMacNotificationObserver, 3> m_updateObservers;
QAtomicInt m_needsUpdate = false;
+
+#ifndef QT_NO_DEBUG_STREAM
+ friend QDebug operator<<(QDebug debug, const QCocoaGLContext *screen);
+#endif
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.mm b/src/plugins/platforms/cocoa/qcocoaglcontext.mm
index b312e033cd..6db4bdb9fd 100644
--- a/src/plugins/platforms/cocoa/qcocoaglcontext.mm
+++ b/src/plugins/platforms/cocoa/qcocoaglcontext.mm
@@ -158,6 +158,8 @@ void QCocoaGLContext::initialize()
[m_context setValues:&order forParameter:NSOpenGLCPSurfaceOrder];
updateSurfaceFormat();
+
+ qCDebug(lcQpaOpenGLContext).verbosity(3) << "Created" << this << "based on requested" << context()->format();
}
NSOpenGLPixelFormat *QCocoaGLContext::pixelFormatForSurfaceFormat(const QSurfaceFormat &format)
@@ -355,7 +357,7 @@ QCocoaGLContext::~QCocoaGLContext()
bool QCocoaGLContext::makeCurrent(QPlatformSurface *surface)
{
- qCDebug(lcQpaOpenGLContext) << "Making" << m_context << "current"
+ qCDebug(lcQpaOpenGLContext) << "Making" << this << "current"
<< "in" << QThread::currentThread() << "for" << surface;
Q_ASSERT(surface->surface()->supportsOpenGL());
@@ -555,4 +557,20 @@ QFunctionPointer QCocoaGLContext::getProcAddress(const char *procName)
return (QFunctionPointer)dlsym(RTLD_DEFAULT, procName);
}
+#ifndef QT_NO_DEBUG_STREAM
+QDebug operator<<(QDebug debug, const QCocoaGLContext *context)
+{
+ QDebugStateSaver saver(debug);
+ debug.nospace();
+ debug << "QCocoaGLContext(" << (const void *)context;
+ if (context) {
+ if (debug.verbosity() > QDebug::DefaultVerbosity)
+ debug << ", " << context->format();
+ debug << ", " << context->nativeContext();
+ }
+ debug << ')';
+ return debug;
+}
+#endif // !QT_NO_DEBUG_STREAM
+
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index 643eac1e92..ad232d6d80 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -559,7 +559,10 @@ void QCocoaWindow::setWindowFlags(Qt::WindowFlags flags)
Qt::WindowType type = static_cast<Qt::WindowType>(int(flags & Qt::WindowType_Mask));
if ((type & Qt::Popup) != Qt::Popup && (type & Qt::Dialog) != Qt::Dialog) {
NSWindowCollectionBehavior behavior = m_view.window.collectionBehavior;
- if ((flags & Qt::WindowFullscreenButtonHint) || m_view.window.qt_fullScreen) {
+ const bool enableFullScreen = m_view.window.qt_fullScreen
+ || !(flags & Qt::CustomizeWindowHint)
+ || (flags & Qt::WindowFullscreenButtonHint);
+ if (enableFullScreen) {
behavior |= NSWindowCollectionBehaviorFullScreenPrimary;
behavior &= ~NSWindowCollectionBehaviorFullScreenAuxiliary;
} else {
diff --git a/src/plugins/platforms/cocoa/qmacclipboard.mm b/src/plugins/platforms/cocoa/qmacclipboard.mm
index 358a6b49fd..654647b35a 100644
--- a/src/plugins/platforms/cocoa/qmacclipboard.mm
+++ b/src/plugins/platforms/cocoa/qmacclipboard.mm
@@ -138,8 +138,12 @@ QMacPasteboard::QMacPasteboard(CFStringRef name, uchar mt)
QMacPasteboard::~QMacPasteboard()
{
- // commit all promises for paste after exit close
- resolvingBeforeDestruction = true;
+ /*
+ Commit all promises for paste when shutting down,
+ unless we are the stack-allocated clipboard used by QCocoaDrag.
+ */
+ if (mime_type == QMacInternalPasteboardMime::MIME_DND)
+ resolvingBeforeDestruction = true;
PasteboardResolvePromises(paste);
if (paste)
CFRelease(paste);
diff --git a/src/plugins/platforms/qnx/qqnxscreeneventthread.cpp b/src/plugins/platforms/qnx/qqnxscreeneventthread.cpp
index 1b5f3b4954..491c314488 100644
--- a/src/plugins/platforms/qnx/qqnxscreeneventthread.cpp
+++ b/src/plugins/platforms/qnx/qqnxscreeneventthread.cpp
@@ -60,6 +60,18 @@ static const int c_screenCode = _PULSE_CODE_MINAVAIL + 0;
static const int c_armCode = _PULSE_CODE_MINAVAIL + 1;
static const int c_quitCode = _PULSE_CODE_MINAVAIL + 2;
+#if !defined(screen_register_event)
+int screen_register_event(screen_context_t, struct sigevent *event)
+{
+ return MsgRegisterEvent(event, -1);
+}
+
+int screen_unregister_event(struct sigevent *event)
+{
+ return MsgUnregisterEvent(event);
+}
+#endif
+
QQnxScreenEventThread::QQnxScreenEventThread(screen_context_t context)
: QThread()
, m_screenContext(context)
@@ -75,10 +87,14 @@ QQnxScreenEventThread::QQnxScreenEventThread(screen_context_t context)
qFatal("QQnxScreenEventThread: Can't continue without a channel connection");
}
- struct sigevent screenEvent;
- SIGEV_PULSE_INIT(&screenEvent, m_connectionId, SIGEV_PULSE_PRIO_INHERIT, c_screenCode, 0);
+ SIGEV_PULSE_INIT(&m_screenEvent, m_connectionId, SIGEV_PULSE_PRIO_INHERIT, c_screenCode, 0);
+ if (screen_register_event(m_screenContext, &m_screenEvent) == -1) {
+ ConnectDetach(m_connectionId);
+ ChannelDestroy(m_channelId);
+ qFatal("QQnxScreenEventThread: Can't continue without a registered event");
+ }
- screen_notify(m_screenContext, SCREEN_NOTIFY_EVENT, nullptr, &screenEvent);
+ screen_notify(m_screenContext, SCREEN_NOTIFY_EVENT, nullptr, &m_screenEvent);
}
QQnxScreenEventThread::~QQnxScreenEventThread()
@@ -86,6 +102,8 @@ QQnxScreenEventThread::~QQnxScreenEventThread()
// block until thread terminates
shutdown();
+ screen_notify(m_screenContext, SCREEN_NOTIFY_EVENT, nullptr, nullptr);
+ screen_unregister_event(&m_screenEvent);
ConnectDetach(m_connectionId);
ChannelDestroy(m_channelId);
}
diff --git a/src/plugins/platforms/qnx/qqnxscreeneventthread.h b/src/plugins/platforms/qnx/qqnxscreeneventthread.h
index 3c8d197545..e5b762369c 100644
--- a/src/plugins/platforms/qnx/qqnxscreeneventthread.h
+++ b/src/plugins/platforms/qnx/qqnxscreeneventthread.h
@@ -45,6 +45,7 @@
#include <QtCore/QMutex>
#include <screen/screen.h>
+#include <sys/siginfo.h>
QT_BEGIN_NAMESPACE
@@ -73,6 +74,7 @@ private:
int m_channelId;
int m_connectionId;
+ struct sigevent m_screenEvent;
screen_context_t m_screenContext;
bool m_emitNeededOnNextScreenPulse = true;
int m_screenPulsesSinceLastArmPulse = 0;
diff --git a/src/plugins/platforms/wasm/qwasmscreen.cpp b/src/plugins/platforms/wasm/qwasmscreen.cpp
index 37f1ea832a..b6c9b9e377 100644
--- a/src/plugins/platforms/wasm/qwasmscreen.cpp
+++ b/src/plugins/platforms/wasm/qwasmscreen.cpp
@@ -54,6 +54,8 @@ QWasmScreen::QWasmScreen(const QString &canvasId)
m_compositor = new QWasmCompositor(this);
m_eventTranslator = new QWasmEventTranslator(this);
updateQScreenAndCanvasRenderSize();
+ emscripten::val canvas = emscripten::val::global(m_canvasId.toUtf8().constData());
+ canvas.call<void>("focus");
}
QWasmScreen::~QWasmScreen()
diff --git a/src/plugins/platforms/windows/qwindowscursor.cpp b/src/plugins/platforms/windows/qwindowscursor.cpp
index 17e8cffb76..59457f1720 100644
--- a/src/plugins/platforms/windows/qwindowscursor.cpp
+++ b/src/plugins/platforms/windows/qwindowscursor.cpp
@@ -50,6 +50,7 @@
#include <QtGui/qscreen.h>
#include <QtGui/private/qguiapplication_p.h> // getPixmapCursor()
#include <QtGui/private/qhighdpiscaling_p.h>
+#include <QtCore/private/qwinregistry_p.h>
#include <QtCore/qdebug.h>
#include <QtCore/qscopedpointer.h>
@@ -686,6 +687,30 @@ void QWindowsCursor::setPos(const QPoint &pos)
SetCursorPos(pos.x() , pos.y());
}
+/*
+ The standard size is 32x32, even though the cursor is actually just
+ 16 pixels large. If a large cursor is set in the accessibility settings,
+ then the cursor increases with 8 pixels for each step.
+*/
+QSize QWindowsCursor::size() const
+{
+ const QPair<DWORD,bool> cursorSizeSetting =
+ QWinRegistryKey(HKEY_CURRENT_USER, LR"(Control Panel\Cursors)")
+ .dwordValue(L"CursorBaseSize");
+ const int baseSize = screenCursorSize(m_screen).width() / 2;
+ if (!cursorSizeSetting.second)
+ return QSize(baseSize / 2, baseSize / 2);
+
+ // The registry values are dpi-independent, so we need to scale the result.
+ int cursorSizeValue = cursorSizeSetting.first * m_screen->logicalDpi().first
+ / m_screen->logicalBaseDpi().first;
+
+ // map from registry value 32-256 to 0-14, and from there to pixels
+ cursorSizeValue = (cursorSizeValue - 2 * baseSize) / baseSize;
+ const int cursorSize = baseSize + cursorSizeValue * (baseSize / 2);
+ return QSize(cursorSize, cursorSize);
+}
+
QPixmap QWindowsCursor::dragDefaultCursor(Qt::DropAction action) const
{
switch (action) {
diff --git a/src/plugins/platforms/windows/qwindowscursor.h b/src/plugins/platforms/windows/qwindowscursor.h
index b896f4c7a9..cf3635bd6b 100644
--- a/src/plugins/platforms/windows/qwindowscursor.h
+++ b/src/plugins/platforms/windows/qwindowscursor.h
@@ -113,6 +113,8 @@ public:
QPoint pos() const override;
void setPos(const QPoint &pos) override;
+ QSize size() const override;
+
static HCURSOR createPixmapCursor(QPixmap pixmap, const QPoint &hotSpot, qreal scaleFactor = 1);
static HCURSOR createPixmapCursor(const PixmapCursor &pc, qreal scaleFactor = 1) { return createPixmapCursor(pc.pixmap, pc.hotSpot, scaleFactor); }
static PixmapCursor customCursor(Qt::CursorShape cursorShape, const QPlatformScreen *screen = nullptr);
diff --git a/src/plugins/platforms/windows/qwindowssystemtrayicon.cpp b/src/plugins/platforms/windows/qwindowssystemtrayicon.cpp
index f2dba4d06b..ab830e1461 100644
--- a/src/plugins/platforms/windows/qwindowssystemtrayicon.cpp
+++ b/src/plugins/platforms/windows/qwindowssystemtrayicon.cpp
@@ -57,11 +57,13 @@
#include "qwindowsmenu.h"
#include "qwindowsscreen.h"
+#include <QtGui/qguiapplication.h>
#include <QtGui/qpixmap.h>
#include <QtCore/qdebug.h>
#include <QtCore/qrect.h>
#include <QtCore/qvector.h>
#include <QtCore/qsettings.h>
+#include <qpa/qwindowsysteminterface.h>
#include <qt_windows.h>
#include <commctrl.h>
@@ -134,9 +136,12 @@ static int indexOfHwnd(HWND hwnd)
extern "C" LRESULT QT_WIN_CALLBACK qWindowsTrayIconWndProc(HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam)
{
+ // QTBUG-79248: Trigger screen update if there are no other windows.
+ if (message == WM_DPICHANGED && QGuiApplication::topLevelWindows().isEmpty())
+ QWindowsContext::instance()->screenManager().handleScreenChanges();
if (message == MYWM_TASKBARCREATED || message == MYWM_NOTIFYICON
|| message == WM_INITMENU || message == WM_INITMENUPOPUP
- || message == WM_COMMAND) {
+ || message == WM_CLOSE || message == WM_COMMAND) {
const int index = indexOfHwnd(hwnd);
if (index >= 0) {
MSG msg;
@@ -439,6 +444,9 @@ bool QWindowsSystemTrayIcon::winEvent(const MSG &message, long *result)
case WM_INITMENUPOPUP:
QWindowsPopupMenu::notifyAboutToShow(reinterpret_cast<HMENU>(message.wParam));
break;
+ case WM_CLOSE:
+ QWindowSystemInterface::handleApplicationTermination<QWindowSystemInterface::SynchronousDelivery>();
+ break;
case WM_COMMAND:
QWindowsPopupMenu::notifyTriggered(LOWORD(message.wParam));
break;
diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp b/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp
index e5a9f275ae..cc293b777c 100644
--- a/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp
+++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp
@@ -289,7 +289,8 @@ HRESULT QWindowsUiaMainProvider::GetPatternProvider(PATTERNID idPattern, IUnknow
break;
case UIA_TogglePatternId:
// Checkbox controls.
- if (accessible->role() == QAccessible::CheckBox) {
+ if (accessible->role() == QAccessible::CheckBox
+ || (accessible->role() == QAccessible::MenuItem && accessible->state().checkable)) {
*pRetVal = new QWindowsUiaToggleProvider(id());
}
break;
diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp
index 8bcaa78122..cc84e836b4 100644
--- a/src/plugins/platforms/xcb/qxcbscreen.cpp
+++ b/src/plugins/platforms/xcb/qxcbscreen.cpp
@@ -41,6 +41,7 @@
#include "qxcbwindow.h"
#include "qxcbcursor.h"
#include "qxcbimage.h"
+#include "qxcbintegration.h"
#include "qnamespace.h"
#include "qxcbxsettings.h"
@@ -49,6 +50,7 @@
#include <QDebug>
#include <QtAlgorithms>
+#include <qpa/qplatformservices.h>
#include <qpa/qwindowsysteminterface.h>
#include <private/qmath_p.h>
#include <QtGui/private/qhighdpiscaling_p.h>
@@ -356,6 +358,15 @@ static QFontEngine::SubpixelAntialiasingType parseXftRgba(const QByteArray& stri
void QXcbVirtualDesktop::readXResources()
{
+ const QPlatformServices *services = QXcbIntegration::instance()->services();
+ bool useXftConf = false;
+ if (services) {
+ const QList<QByteArray> desktopEnv = services->desktopEnvironment().split(':');
+ useXftConf = desktopEnv.contains("GNOME") || desktopEnv.contains("UNITY") || desktopEnv.contains("XFCE");
+ }
+ if (!useXftConf)
+ return;
+
int offset = 0;
QByteArray resources;
while (true) {
diff --git a/src/plugins/sqldrivers/psql/qsql_psql.cpp b/src/plugins/sqldrivers/psql/qsql_psql.cpp
index 68313b7ff0..3d8ed29b54 100644
--- a/src/plugins/sqldrivers/psql/qsql_psql.cpp
+++ b/src/plugins/sqldrivers/psql/qsql_psql.cpp
@@ -838,6 +838,7 @@ QSqlRecord QPSQLResult::record() const
}
int ptype = PQftype(d->result, i);
f.setType(qDecodePSQLType(ptype));
+ f.setValue(QVariant(f.type())); // only set in setType() when it's invalid before
int len = PQfsize(d->result, i);
int precision = PQfmod(d->result, i);