Merge remote-tracking branch 'origin/5.6' into 5.7

Conflicts:
	tests/auto/corelib/io/qprocess/tst_qprocess.cpp

Change-Id: Ib6955eb874b516b185b45d6c38cec646fbaa95f4
This commit is contained in:
Liang Qi 2016-02-29 12:34:31 +01:00
commit a224dfc9d1
37 changed files with 456 additions and 170 deletions

View File

@ -105,7 +105,7 @@ QMAKE_LIBS_COMPAT = -ladvapi32 -lshell32 -lcomdlg32 -luser32 -lgdi32 -lws2
QMAKE_LIBS_QT_ENTRY = -lmingw32 -lqtmain QMAKE_LIBS_QT_ENTRY = -lmingw32 -lqtmain
QMAKE_IDL = midl QMAKE_IDL = midl
QMAKE_LIB = $${CROSS_COMPILE}ar -ru QMAKE_LIB = $${CROSS_COMPILE}ar -rc
QMAKE_RC = $${CROSS_COMPILE}windres QMAKE_RC = $${CROSS_COMPILE}windres
QMAKE_STRIP = $${CROSS_COMPILE}strip QMAKE_STRIP = $${CROSS_COMPILE}strip

View File

@ -252,10 +252,11 @@ static inline void convert_to_wchar_t_elided(wchar_t *d, size_t space, const cha
if (len + 1 > space) { if (len + 1 > space) {
const size_t skip = len - space + 4; // 4 for "..." + '\0' const size_t skip = len - space + 4; // 4 for "..." + '\0'
s += skip; s += skip;
len -= skip;
for (int i = 0; i < 3; ++i) for (int i = 0; i < 3; ++i)
*d++ = L'.'; *d++ = L'.';
} }
while (*s) while (len--)
*d++ = *s++; *d++ = *s++;
*d++ = 0; *d++ = 0;
} }

View File

@ -1635,7 +1635,8 @@ public:
}; };
enum ScrollPhase { enum ScrollPhase {
ScrollBegin = 1, NoScrollPhase = 0, // Make public in 5.7 or asap
ScrollBegin,
ScrollUpdate, ScrollUpdate,
ScrollEnd ScrollEnd
}; };

View File

@ -3089,6 +3089,8 @@
This enum describes the phase of scrolling. This enum describes the phase of scrolling.
\omitvalue NoScrollPhase The input device doesn't support scroll phase.
\value ScrollBegin Scrolling is about to begin, but the scrolling \value ScrollBegin Scrolling is about to begin, but the scrolling
distance did not yet change. distance did not yet change.

View File

@ -487,7 +487,7 @@ QMatrix QPixmap::trueMatrix(const QMatrix &m, int w, int h)
bool QPixmap::isQBitmap() const bool QPixmap::isQBitmap() const
{ {
return data->type == QPlatformPixmap::BitmapType; return data && data->type == QPlatformPixmap::BitmapType;
} }
/*! /*!

View File

@ -733,7 +733,8 @@ QHoverEvent::~QHoverEvent()
QWheelEvent::QWheelEvent(const QPointF &pos, int delta, QWheelEvent::QWheelEvent(const QPointF &pos, int delta,
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers,
Qt::Orientation orient) Qt::Orientation orient)
: QInputEvent(Wheel, modifiers), p(pos), qt4D(delta), qt4O(orient), mouseState(buttons) : QInputEvent(Wheel, modifiers), p(pos), qt4D(delta), qt4O(orient), mouseState(buttons),
ph(Qt::NoScrollPhase), src(Qt::MouseEventNotSynthesized)
{ {
g = QCursor::pos(); g = QCursor::pos();
if (orient == Qt::Vertical) if (orient == Qt::Vertical)
@ -767,7 +768,8 @@ QWheelEvent::~QWheelEvent()
QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos, int delta, QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos, int delta,
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers,
Qt::Orientation orient) Qt::Orientation orient)
: QInputEvent(Wheel, modifiers), p(pos), g(globalPos), qt4D(delta), qt4O(orient), mouseState(buttons) : QInputEvent(Wheel, modifiers), p(pos), g(globalPos), qt4D(delta), qt4O(orient), mouseState(buttons),
ph(Qt::NoScrollPhase), src(Qt::MouseEventNotSynthesized)
{ {
if (orient == Qt::Vertical) if (orient == Qt::Vertical)
angleD = QPoint(0, delta); angleD = QPoint(0, delta);
@ -803,7 +805,8 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos,
QPoint pixelDelta, QPoint angleDelta, int qt4Delta, Qt::Orientation qt4Orientation, QPoint pixelDelta, QPoint angleDelta, int qt4Delta, Qt::Orientation qt4Orientation,
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers) Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers)
: QInputEvent(Wheel, modifiers), p(pos), g(globalPos), pixelD(pixelDelta), : QInputEvent(Wheel, modifiers), p(pos), g(globalPos), pixelD(pixelDelta),
angleD(angleDelta), qt4D(qt4Delta), qt4O(qt4Orientation), mouseState(buttons), ph(Qt::ScrollUpdate) angleD(angleDelta), qt4D(qt4Delta), qt4O(qt4Orientation), mouseState(buttons), ph(Qt::NoScrollPhase),
src(Qt::MouseEventNotSynthesized)
{} {}
/*! /*!

View File

@ -224,6 +224,8 @@ protected:
uint ph : 2; uint ph : 2;
uint src: 2; uint src: 2;
int reserved : 28; int reserved : 28;
friend class QApplication;
}; };
#endif #endif

View File

@ -168,7 +168,7 @@ inline QRect toNative(const QRect &rect, qreal scaleFactor, const QPoint &origin
inline QRect fromNative(const QRect &rect, const QScreen *screen, const QPoint &screenOrigin) inline QRect fromNative(const QRect &rect, const QScreen *screen, const QPoint &screenOrigin)
{ {
return toNative(rect, QHighDpiScaling::factor(screen), screenOrigin); return fromNative(rect, QHighDpiScaling::factor(screen), screenOrigin);
} }
inline QRect fromNativeScreenGeometry(const QRect &nativeScreenGeometry, const QScreen *screen) inline QRect fromNativeScreenGeometry(const QRect &nativeScreenGeometry, const QScreen *screen)

View File

@ -492,8 +492,9 @@ QPlatformScreen *QPlatformWindow::screenForGeometry(const QRect &newGeometry) co
QPlatformScreen *fallback = currentScreen; QPlatformScreen *fallback = currentScreen;
// QRect::center can return a value outside the rectangle if it's empty. // QRect::center can return a value outside the rectangle if it's empty.
// Apply mapToGlobal() in case it is a foreign/embedded window. // Apply mapToGlobal() in case it is a foreign/embedded window.
const QPoint center = QPoint center = newGeometry.isEmpty() ? newGeometry.topLeft() : newGeometry.center();
mapToGlobal(newGeometry.isEmpty() ? newGeometry.topLeft() : newGeometry.center()); if (window()->type() == Qt::ForeignWindow)
center = mapToGlobal(center - newGeometry.topLeft());
if (!parent() && currentScreen && !currentScreen->geometry().contains(center)) { if (!parent() && currentScreen && !currentScreen->geometry().contains(center)) {
const auto screens = currentScreen->virtualSiblings(); const auto screens = currentScreen->virtualSiblings();

View File

@ -46,6 +46,7 @@
#include <QtCore/QDebug> #include <QtCore/QDebug>
#include <QtCore/private/qobject_p.h> #include <QtCore/private/qobject_p.h>
#include "qhighdpiscaling_p.h"
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -692,7 +693,19 @@ QPixmap QScreen::grabWindow(WId window, int x, int y, int width, int height)
qWarning("invoked with handle==0"); qWarning("invoked with handle==0");
return QPixmap(); return QPixmap();
} }
return platformScreen->grabWindow(window, x, y, width, height); const qreal factor = QHighDpiScaling::factor(this);
if (qFuzzyCompare(factor, 1))
return platformScreen->grabWindow(window, x, y, width, height);
const QPoint nativePos = QHighDpi::toNative(QPoint(x, y), factor);
QSize nativeSize(width, height);
if (nativeSize.isValid())
nativeSize = QHighDpi::toNative(nativeSize, factor);
QPixmap result =
platformScreen->grabWindow(window, nativePos.x(), nativePos.y(),
nativeSize.width(), nativeSize.height());
result.setDevicePixelRatio(factor);
return result;
} }
#ifndef QT_NO_DEBUG_STREAM #ifndef QT_NO_DEBUG_STREAM

View File

@ -2335,7 +2335,7 @@ QPoint QWindow::mapToGlobal(const QPoint &pos) const
// QTBUG-43252, prefer platform implementation for foreign windows. // QTBUG-43252, prefer platform implementation for foreign windows.
if (d->platformWindow if (d->platformWindow
&& (type() == Qt::ForeignWindow || d->platformWindow->isEmbedded())) { && (type() == Qt::ForeignWindow || d->platformWindow->isEmbedded())) {
return d->platformWindow->mapToGlobal(pos); return QHighDpi::fromNativeLocalPosition(d->platformWindow->mapToGlobal(QHighDpi::toNativeLocalPosition(pos, this)), this);
} }
return pos + d->globalPosition(); return pos + d->globalPosition();
} }
@ -2355,7 +2355,7 @@ QPoint QWindow::mapFromGlobal(const QPoint &pos) const
// QTBUG-43252, prefer platform implementation for foreign windows. // QTBUG-43252, prefer platform implementation for foreign windows.
if (d->platformWindow if (d->platformWindow
&& (type() == Qt::ForeignWindow || d->platformWindow->isEmbedded())) { && (type() == Qt::ForeignWindow || d->platformWindow->isEmbedded())) {
return d->platformWindow->mapFromGlobal(pos); return QHighDpi::fromNativeLocalPosition(d->platformWindow->mapFromGlobal(QHighDpi::toNativeLocalPosition(pos, this)), this);
} }
return pos - d->globalPosition(); return pos - d->globalPosition();
} }

View File

@ -100,8 +100,16 @@ public:
quint32 nativeModifiers, quint32 nativeModifiers,
const QString& text = QString(), bool autorep = false, const QString& text = QString(), bool autorep = false,
ushort count = 1, bool tryShortcutOverride = true); ushort count = 1, bool tryShortcutOverride = true);
static void handleWheelEvent(QWindow *w, const QPointF & local, const QPointF & global, QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods = Qt::NoModifier, Qt::ScrollPhase phase = Qt::ScrollUpdate, Qt::MouseEventSource source = Qt::MouseEventNotSynthesized); static void handleWheelEvent(QWindow *w, const QPointF & local, const QPointF & global,
static void handleWheelEvent(QWindow *w, ulong timestamp, const QPointF & local, const QPointF & global, QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods = Qt::NoModifier, Qt::ScrollPhase phase = Qt::ScrollUpdate, Qt::MouseEventSource source = Qt::MouseEventNotSynthesized); QPoint pixelDelta, QPoint angleDelta,
Qt::KeyboardModifiers mods = Qt::NoModifier,
Qt::ScrollPhase phase = Qt::NoScrollPhase,
Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
static void handleWheelEvent(QWindow *w, ulong timestamp, const QPointF & local, const QPointF & global,
QPoint pixelDelta, QPoint angleDelta,
Qt::KeyboardModifiers mods = Qt::NoModifier,
Qt::ScrollPhase phase = Qt::NoScrollPhase,
Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
// Wheel event compatibility functions. Will be removed: do not use. // Wheel event compatibility functions. Will be removed: do not use.
static void handleWheelEvent(QWindow *w, const QPointF & local, const QPointF & global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods = Qt::NoModifier); static void handleWheelEvent(QWindow *w, const QPointF & local, const QPointF & global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods = Qt::NoModifier);

View File

@ -242,7 +242,7 @@ public:
class WheelEvent : public InputEvent { class WheelEvent : public InputEvent {
public: public:
WheelEvent(QWindow *w, ulong time, const QPointF & local, const QPointF & global, QPoint pixelD, QPoint angleD, int qt4D, Qt::Orientation qt4O, WheelEvent(QWindow *w, ulong time, const QPointF & local, const QPointF & global, QPoint pixelD, QPoint angleD, int qt4D, Qt::Orientation qt4O,
Qt::KeyboardModifiers mods, Qt::ScrollPhase phase = Qt::ScrollUpdate, Qt::MouseEventSource src = Qt::MouseEventNotSynthesized) Qt::KeyboardModifiers mods, Qt::ScrollPhase phase = Qt::NoScrollPhase, Qt::MouseEventSource src = Qt::MouseEventNotSynthesized)
: InputEvent(w, time, Wheel, mods), pixelDelta(pixelD), angleDelta(angleD), qt4Delta(qt4D), qt4Orientation(qt4O), localPos(local), globalPos(global), phase(phase), source(src) { } : InputEvent(w, time, Wheel, mods), pixelDelta(pixelD), angleDelta(angleD), qt4Delta(qt4D), qt4Orientation(qt4O), localPos(local), globalPos(global), phase(phase), source(src) { }
QPoint pixelDelta; QPoint pixelDelta;
QPoint angleDelta; QPoint angleDelta;

View File

@ -274,7 +274,7 @@ void QDBusPlatformMenu::setContainingMenuItem(QDBusPlatformMenuItem *item)
QPlatformMenuItem *QDBusPlatformMenu::menuItemAt(int position) const QPlatformMenuItem *QDBusPlatformMenu::menuItemAt(int position) const
{ {
return m_items.at(position); return m_items.value(position);
} }
QPlatformMenuItem *QDBusPlatformMenu::menuItemForTag(quintptr tag) const QPlatformMenuItem *QDBusPlatformMenu::menuItemForTag(quintptr tag) const

View File

@ -1410,6 +1410,8 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
momentumPhase == NSEventPhaseEnded || momentumPhase == NSEventPhaseCancelled) { momentumPhase == NSEventPhaseEnded || momentumPhase == NSEventPhaseCancelled) {
ph = Qt::ScrollEnd; ph = Qt::ScrollEnd;
m_scrolling = false; m_scrolling = false;
} else if (phase == NSEventPhaseNone && momentumPhase == NSEventPhaseNone) {
ph = Qt::NoScrollPhase;
} }
QWindowSystemInterface::handleWheelEvent(m_window, qt_timestamp, qt_windowPoint, qt_screenPoint, pixelDelta, angleDelta, currentWheelModifiers, ph, source); QWindowSystemInterface::handleWheelEvent(m_window, qt_timestamp, qt_windowPoint, qt_screenPoint, pixelDelta, angleDelta, currentWheelModifiers, ph, source);

View File

@ -476,7 +476,6 @@ void QMacPrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &va
d->embedFonts = value.toBool(); d->embedFonts = value.toBool();
break; break;
case PPK_Resolution: { case PPK_Resolution: {
// TODO It appears the old code didn't actually set the resolution??? Can we delete all this???
int bestResolution = 0; int bestResolution = 0;
int dpi = value.toInt(); int dpi = value.toInt();
int bestDistance = INT_MAX; int bestDistance = INT_MAX;
@ -492,7 +491,17 @@ void QMacPrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &va
} }
} }
} }
PMSessionValidatePageFormat(d->session(), d->format(), kPMDontWantBoolean); PMResolution resolution;
resolution.hRes = resolution.vRes = bestResolution;
if (PMPrinterSetOutputResolution(d->m_printDevice->macPrinter(), d->settings(), &resolution) == noErr) {
// Setting the resolution succeeded.
// Now try to read the actual resolution selected by the OS.
if (PMPrinterGetOutputResolution(d->m_printDevice->macPrinter(), d->settings(), &d->resolution) != noErr) {
// Reading the resolution somehow failed; d->resolution is in undefined state.
// So use the value which was acceptable to PMPrinterSetOutputResolution.
d->resolution = resolution;
}
}
break; break;
} }
case PPK_CollateCopies: case PPK_CollateCopies:

View File

@ -64,15 +64,15 @@ static DATE QDateTimeToDATE(const QDateTime &dt)
QDate date = dt.date(); QDate date = dt.date();
QTime time = dt.time(); QTime time = dt.time();
if (date.isValid() && !date.isNull()) { if (date.isValid() && !date.isNull()) {
stime.wDay = date.day(); stime.wDay = WORD(date.day());
stime.wMonth = date.month(); stime.wMonth = WORD(date.month());
stime.wYear = date.year(); stime.wYear = WORD(date.year());
} }
if (time.isValid() && !time.isNull()) { if (time.isValid() && !time.isNull()) {
stime.wMilliseconds = time.msec(); stime.wMilliseconds = WORD(time.msec());
stime.wSecond = time.second(); stime.wSecond = WORD(time.second());
stime.wMinute = time.minute(); stime.wMinute = WORD(time.minute());
stime.wHour = time.hour(); stime.wHour = WORD(time.hour());
} }
double vtime; double vtime;
@ -98,8 +98,8 @@ bool QVariant2VARIANT(const QVariant &var, VARIANT &arg, const QByteArray &typeN
proptype = QVariant::Double; proptype = QVariant::Double;
} }
if (proptype != QVariant::Invalid && proptype != QVariant::UserType && proptype != qvar.type()) { if (proptype != QVariant::Invalid && proptype != QVariant::UserType && proptype != qvar.type()) {
if (qvar.canConvert(proptype)) if (qvar.canConvert(int(proptype)))
qvar.convert(proptype); qvar.convert(int(proptype));
else else
qvar = QVariant(proptype); qvar = QVariant(proptype);
} }

View File

@ -53,14 +53,9 @@ class QVariant;
// Originally QVariantToVARIANT copied from ActiveQt - renamed to avoid conflicts in static builds. // Originally QVariantToVARIANT copied from ActiveQt - renamed to avoid conflicts in static builds.
bool QVariant2VARIANT(const QVariant &var, VARIANT &arg, const QByteArray &typeName, bool out); bool QVariant2VARIANT(const QVariant &var, VARIANT &arg, const QByteArray &typeName, bool out);
inline QString BSTRToQString(const BSTR &bstr)
{
return QString((QChar*)bstr);
}
inline BSTR QStringToBSTR(const QString &str) inline BSTR QStringToBSTR(const QString &str)
{ {
return SysAllocStringLen((OLECHAR*)str.unicode(), str.length()); return SysAllocStringLen(reinterpret_cast<const OLECHAR *>(str.unicode()), UINT(str.length()));
} }
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -47,8 +47,16 @@
#include <QtGui/qguiapplication.h> #include <QtGui/qguiapplication.h>
#include <QtCore/qdebug.h> #include <QtCore/qdebug.h>
#include <algorithm>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
template <class T>
static inline T *coTaskMemAllocArray(int size)
{
return static_cast<T *>(::CoTaskMemAlloc(sizeof(T) * size_t(size)));
}
/**************************************************************\ /**************************************************************\
* AccessibleApplication * * AccessibleApplication *
**************************************************************/ **************************************************************/
@ -58,7 +66,7 @@ HRESULT STDMETHODCALLTYPE AccessibleApplication::QueryInterface(REFIID id, LPVOI
*iface = 0; *iface = 0;
if (id == IID_IUnknown) { if (id == IID_IUnknown) {
qCDebug(lcQpaAccessibility) << "AccessibleApplication::QI(): IID_IUnknown"; qCDebug(lcQpaAccessibility) << "AccessibleApplication::QI(): IID_IUnknown";
*iface = (IUnknown*)this; *iface = static_cast<IUnknown *>(this);
} else if (id == IID_IAccessibleApplication) { } else if (id == IID_IAccessibleApplication) {
qCDebug(lcQpaAccessibility) << "AccessibleApplication::QI(): IID_IAccessibleApplication"; qCDebug(lcQpaAccessibility) << "AccessibleApplication::QI(): IID_IAccessibleApplication";
*iface = static_cast<IAccessibleApplication*>(this); *iface = static_cast<IAccessibleApplication*>(this);
@ -128,7 +136,7 @@ HRESULT STDMETHODCALLTYPE AccessibleRelation::QueryInterface(REFIID id, LPVOID *
{ {
*iface = 0; *iface = 0;
if (id == IID_IUnknown || id == IID_IAccessibleRelation) if (id == IID_IUnknown || id == IID_IAccessibleRelation)
*iface = (IUnknown*)this; *iface = static_cast<IUnknown *>(this);
if (*iface) { if (*iface) {
AddRef(); AddRef();
@ -206,7 +214,7 @@ HRESULT STDMETHODCALLTYPE AccessibleRelation::get_targets(
/* [retval][out] */ long *nTargets) /* [retval][out] */ long *nTargets)
{ {
const int numTargets = qMin((int)maxTargets, m_targets.count()); const int numTargets = qMin(int(maxTargets), m_targets.count());
for (int i = 0; i < numTargets; ++i) { for (int i = 0; i < numTargets; ++i) {
QAccessibleInterface *iface = m_targets.at(i); QAccessibleInterface *iface = m_targets.at(i);
IAccessible *iacc = QWindowsAccessibility::wrap(iface); IAccessible *iacc = QWindowsAccessibility::wrap(iface);
@ -235,42 +243,40 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::QueryInterface(REFIID id, LPVOI
HRESULT hr = QWindowsMsaaAccessible::QueryInterface(id, iface); HRESULT hr = QWindowsMsaaAccessible::QueryInterface(id, iface);
if (!SUCCEEDED(hr)) { if (!SUCCEEDED(hr)) {
if (id == IID_IServiceProvider) { if (id == IID_IServiceProvider) {
*iface = (IServiceProvider*)this; *iface = static_cast<IServiceProvider *>(this);
} else if (id == IID_IAccessible2) { } else if (id == IID_IAccessible2) {
*iface = (IAccessible2*)this; *iface = static_cast<IAccessible2 *>(this);
} else if (id == IID_IAccessibleAction) { } else if (id == IID_IAccessibleAction) {
if (accessible->actionInterface()) if (accessible->actionInterface())
*iface = (IAccessibleAction*)this; *iface = static_cast<IAccessibleAction *>(this);
} else if (id == IID_IAccessibleComponent) { } else if (id == IID_IAccessibleComponent) {
*iface = (IAccessibleComponent*)this; *iface = static_cast<IAccessibleComponent *>(this);
} else if (id == IID_IAccessibleEditableText) { } else if (id == IID_IAccessibleEditableText) {
if (accessible->editableTextInterface() || if (accessible->editableTextInterface() ||
accessible->role() == QAccessible::EditableText) accessible->role() == QAccessible::EditableText)
{ {
*iface = (IAccessibleEditableText*)this; *iface = static_cast<IAccessibleEditableText *>(this);
} }
} else if (id == IID_IAccessibleHyperlink) { } else if (id == IID_IAccessibleHyperlink) {
//*iface = (IAccessibleHyperlink*)this; //*iface = static_cast<IAccessibleHyperlink *>(this);
} else if (id == IID_IAccessibleHypertext) { } else if (id == IID_IAccessibleHypertext) {
//*iface = (IAccessibleHypertext*)this; //*iface = static_cast<IAccessibleHypertext *>(this);
} else if (id == IID_IAccessibleImage) { } else if (id == IID_IAccessibleImage) {
//*iface = (IAccessibleImage*)this; //*iface = static_cast<IAccessibleImage *>(this);
} else if (id == IID_IAccessibleRelation) {
*iface = (IAccessibleRelation*)this;
} else if (id == IID_IAccessibleTable) { } else if (id == IID_IAccessibleTable) {
//*iface = (IAccessibleTable*)this; // not supported //*iface = static_cast<IAccessibleTable *>(this); // not supported
} else if (id == IID_IAccessibleTable2) { } else if (id == IID_IAccessibleTable2) {
if (accessible->tableInterface()) if (accessible->tableInterface())
*iface = (IAccessibleTable2*)this; *iface = static_cast<IAccessibleTable2 *>(this);
} else if (id == IID_IAccessibleTableCell) { } else if (id == IID_IAccessibleTableCell) {
if (accessible->tableCellInterface()) if (accessible->tableCellInterface())
*iface = (IAccessibleTableCell*)this; *iface = static_cast<IAccessibleTableCell *>(this);
} else if (id == IID_IAccessibleText) { } else if (id == IID_IAccessibleText) {
if (accessible->textInterface()) if (accessible->textInterface())
*iface = (IAccessibleText*)this; *iface = static_cast<IAccessibleText *>(this);
} else if (id == IID_IAccessibleValue) { } else if (id == IID_IAccessibleValue) {
if (accessible->valueInterface()) if (accessible->valueInterface())
*iface = (IAccessibleValue*)this; *iface = static_cast<IAccessibleValue *>(this);
} }
if (*iface) { if (*iface) {
AddRef(); AddRef();
@ -599,9 +605,9 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_keyBinding(long actionIndex
numBindings = keyBindings.count(); numBindings = keyBindings.count();
if (numBindings > 0) { if (numBindings > 0) {
// The IDL documents that the client must free with CoTaskMemFree // The IDL documents that the client must free with CoTaskMemFree
arrayOfBindingsToReturn = (BSTR*)::CoTaskMemAlloc(sizeof(BSTR) * numBindings); arrayOfBindingsToReturn = coTaskMemAllocArray<BSTR>(numBindings);
for (int i = 0; i < numBindings; ++i) std::transform(keyBindings.constBegin(), keyBindings.constEnd(),
arrayOfBindingsToReturn[i] = QStringToBSTR(keyBindings.at(i)); arrayOfBindingsToReturn, QStringToBSTR);
} }
} }
*keyBindings = arrayOfBindingsToReturn; *keyBindings = arrayOfBindingsToReturn;
@ -674,7 +680,7 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_foreground(IA2Color *foregr
return E_FAIL; return E_FAIL;
// IA2Color is a typedef for long // IA2Color is a typedef for long
*foreground = (IA2Color)accessible->foregroundColor().rgb(); *foreground = static_cast<IA2Color>(accessible->foregroundColor().rgb());
return S_OK; return S_OK;
} }
@ -686,7 +692,7 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_background(IA2Color *backgr
return E_FAIL; return E_FAIL;
// IA2Color is a typedef for long // IA2Color is a typedef for long
*background = (IA2Color)accessible->backgroundColor().rgb(); *background = static_cast<IA2Color>(accessible->backgroundColor().rgb());
return S_OK; return S_OK;
} }
@ -760,7 +766,7 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::insertText(long offset, BSTR *t
{ {
QAccessibleInterface *accessible = accessibleInterface(); QAccessibleInterface *accessible = accessibleInterface();
accessibleDebugClientCalls(accessible); accessibleDebugClientCalls(accessible);
const QString txt(BSTRToQString(*text)); const QString txt = QString::fromWCharArray(*text);
if (QAccessibleEditableTextInterface *editableTextIface = accessible->editableTextInterface()) if (QAccessibleEditableTextInterface *editableTextIface = accessible->editableTextInterface())
editableTextIface->insertText(offset, txt); editableTextIface->insertText(offset, txt);
else else
@ -805,7 +811,7 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::replaceText(long startOffset, l
{ {
QAccessibleInterface *accessible = accessibleInterface(); QAccessibleInterface *accessible = accessibleInterface();
accessibleDebugClientCalls(accessible); accessibleDebugClientCalls(accessible);
const QString txt(BSTRToQString(*text)); const QString txt = QString::fromWCharArray(*text);
if (QAccessibleEditableTextInterface *editableTextIface = accessible->editableTextInterface()) if (QAccessibleEditableTextInterface *editableTextIface = accessible->editableTextInterface())
editableTextIface->replaceText(startOffset, endOffset, txt); editableTextIface->replaceText(startOffset, endOffset, txt);
else else
@ -978,12 +984,13 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_selectedColumns(long **sele
if (QAccessibleTableInterface *tableIface = tableInterface()) { if (QAccessibleTableInterface *tableIface = tableInterface()) {
const QList<int> selectedIndices = tableIface->selectedColumns(); const QList<int> selectedIndices = tableIface->selectedColumns();
const int &count = selectedIndices.count(); const int count = selectedIndices.count();
long *selected = (count ? (long*)::CoTaskMemAlloc(sizeof(long) * count) : (long*)0);
for (int i = 0; i < count; ++i)
selected[i] = selectedIndices.at(i);
*selectedColumns = selected;
*nColumns = count; *nColumns = count;
*selectedColumns = Q_NULLPTR;
if (count) {
*selectedColumns = coTaskMemAllocArray<long>(count);
std::copy(selectedIndices.constBegin(), selectedIndices.constEnd(), *selectedColumns);
}
return count ? S_OK : S_FALSE; return count ? S_OK : S_FALSE;
} }
return E_FAIL; return E_FAIL;
@ -999,12 +1006,13 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_selectedRows(long **selecte
if (QAccessibleTableInterface *tableIface = tableInterface()) { if (QAccessibleTableInterface *tableIface = tableInterface()) {
const QList<int> selectedIndices = tableIface->selectedRows(); const QList<int> selectedIndices = tableIface->selectedRows();
const int &count = selectedIndices.count(); const int count = selectedIndices.count();
long *selected = (count ? (long*)::CoTaskMemAlloc(sizeof(long) * count) : (long*)0);
for (int i = 0; i < count; ++i)
selected[i] = selectedIndices.at(i);
*selectedRows = selected;
*nRows = count; *nRows = count;
*selectedRows = Q_NULLPTR;
if (count) {
*selectedRows = coTaskMemAllocArray<long>(count);
std::copy(selectedIndices.constBegin(), selectedIndices.constEnd(), *selectedRows);
}
return count ? S_OK : S_FALSE; return count ? S_OK : S_FALSE;
} }
return E_FAIL; return E_FAIL;
@ -1204,10 +1212,10 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_rowColumnExtents(long *row,
if (!accessible || !tableCellInterface()) if (!accessible || !tableCellInterface())
return E_FAIL; return E_FAIL;
*row = (long)tableCellInterface()->rowIndex(); *row = tableCellInterface()->rowIndex();
*column = (long)tableCellInterface()->columnIndex(); *column = tableCellInterface()->columnIndex();
*rowExtents = (long)tableCellInterface()->rowExtent(); *rowExtents = tableCellInterface()->rowExtent();
*columnExtents = (long)tableCellInterface()->columnExtent(); *columnExtents = tableCellInterface()->columnExtent();
*isSelected = tableCellInterface()->isSelected(); *isSelected = tableCellInterface()->isSelected();
return S_OK; return S_OK;
} }
@ -1248,7 +1256,8 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_attributes(long offset,
QAccessibleInterface *accessible = accessibleInterface(); QAccessibleInterface *accessible = accessibleInterface();
accessibleDebugClientCalls(accessible); accessibleDebugClientCalls(accessible);
if (QAccessibleTextInterface *text = textInterface()) { if (QAccessibleTextInterface *text = textInterface()) {
const QString attrs = text->attributes(offset, (int*)startOffset, (int*)endOffset); const QString attrs = text->attributes(offset, reinterpret_cast<int *>(startOffset),
reinterpret_cast<int *>(endOffset));
*textAttributes = QStringToBSTR(attrs); *textAttributes = QStringToBSTR(attrs);
return S_OK; return S_OK;
} }
@ -1320,7 +1329,8 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_selection(long selectionInd
QAccessibleInterface *accessible = accessibleInterface(); QAccessibleInterface *accessible = accessibleInterface();
accessibleDebugClientCalls(accessible); accessibleDebugClientCalls(accessible);
if (QAccessibleTextInterface *text = textInterface()) { if (QAccessibleTextInterface *text = textInterface()) {
text->selection(selectionIndex, (int*)startOffset, (int*)endOffset); text->selection(selectionIndex, reinterpret_cast<int *>(startOffset),
reinterpret_cast<int *>(endOffset));
return S_OK; return S_OK;
} }
return E_FAIL; return E_FAIL;
@ -1352,7 +1362,10 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_textBeforeOffset(long offse
QAccessibleInterface *accessible = accessibleInterface(); QAccessibleInterface *accessible = accessibleInterface();
accessibleDebugClientCalls(accessible); accessibleDebugClientCalls(accessible);
if (QAccessibleTextInterface *textIface = textInterface()) { if (QAccessibleTextInterface *textIface = textInterface()) {
const QString txt = textIface->textBeforeOffset(offset, (QAccessible::TextBoundaryType)boundaryType, (int*)startOffset, (int*)endOffset); const QString txt =
textIface->textBeforeOffset(offset, static_cast<QAccessible::TextBoundaryType>(boundaryType),
reinterpret_cast<int *>(startOffset),
reinterpret_cast<int *>(endOffset));
if (!txt.isEmpty()) { if (!txt.isEmpty()) {
*text = QStringToBSTR(txt); *text = QStringToBSTR(txt);
return S_OK; return S_OK;
@ -1372,7 +1385,10 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_textAfterOffset(
QAccessibleInterface *accessible = accessibleInterface(); QAccessibleInterface *accessible = accessibleInterface();
accessibleDebugClientCalls(accessible); accessibleDebugClientCalls(accessible);
if (QAccessibleTextInterface *textIface = textInterface()) { if (QAccessibleTextInterface *textIface = textInterface()) {
const QString txt = textIface->textAfterOffset(offset, (QAccessible::TextBoundaryType)boundaryType, (int*)startOffset, (int*)endOffset); const QString txt =
textIface->textAfterOffset(offset, static_cast<QAccessible::TextBoundaryType>(boundaryType),
reinterpret_cast<int *>(startOffset),
reinterpret_cast<int *>(endOffset));
if (!txt.isEmpty()) { if (!txt.isEmpty()) {
*text = QStringToBSTR(txt); *text = QStringToBSTR(txt);
return S_OK; return S_OK;
@ -1391,7 +1407,10 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_textAtOffset(long offset,
QAccessibleInterface *accessible = accessibleInterface(); QAccessibleInterface *accessible = accessibleInterface();
accessibleDebugClientCalls(accessible); accessibleDebugClientCalls(accessible);
if (QAccessibleTextInterface *textIface = textInterface()) { if (QAccessibleTextInterface *textIface = textInterface()) {
const QString txt = textIface->textAtOffset(offset, (QAccessible::TextBoundaryType)boundaryType, (int*)startOffset, (int*)endOffset); const QString txt =
textIface->textAtOffset(offset, static_cast<QAccessible::TextBoundaryType>(boundaryType),
reinterpret_cast<int *>(startOffset),
reinterpret_cast<int *>(endOffset));
if (!txt.isEmpty()) { if (!txt.isEmpty()) {
*text = QStringToBSTR(txt); *text = QStringToBSTR(txt);
return S_OK; return S_OK;
@ -1630,7 +1649,7 @@ HRESULT QWindowsIA2Accessible::getRelationsHelper(IAccessibleRelation **relation
QList<QAccessible::Relation> keys = relationMap.keys(); QList<QAccessible::Relation> keys = relationMap.keys();
const int numRelations = keys.count(); const int numRelations = keys.count();
if (relations) { if (relations) {
for (int i = startIndex; i < qMin(startIndex + (int)maxRelations, numRelations); ++i) { for (int i = startIndex; i < qMin(startIndex + int(maxRelations), numRelations); ++i) {
QAccessible::Relation relation = keys.at(i); QAccessible::Relation relation = keys.at(i);
QList<QAccessibleInterface*> targets = relationMap.values(relation); QList<QAccessibleInterface*> targets = relationMap.values(relation);
AccessibleRelation *rel = new AccessibleRelation(targets, relation); AccessibleRelation *rel = new AccessibleRelation(targets, relation);
@ -1656,12 +1675,13 @@ HRESULT QWindowsIA2Accessible::wrapListOfCells(const QList<QAccessibleInterface*
{ {
const int count = inputCells.count(); const int count = inputCells.count();
// Server allocates array // Server allocates array
IUnknown **outputCells = count ? (IUnknown**)::CoTaskMemAlloc(sizeof(IUnknown*) * count ) : (IUnknown**)0;
for (int i = 0; i < count; ++i)
outputCells[i] = QWindowsAccessibility::wrap(inputCells.at(i));
*outputAccessibles = outputCells;
*nCellCount = count; *nCellCount = count;
*outputAccessibles = Q_NULLPTR;
if (count) {
*outputAccessibles = coTaskMemAllocArray<IUnknown *>(count);
std::transform(inputCells.constBegin(), inputCells.constEnd(),
*outputAccessibles, QWindowsAccessibility::wrap);
}
return count > 0 ? S_OK : S_FALSE; return count > 0 ? S_OK : S_FALSE;
} }

View File

@ -173,7 +173,7 @@ void QWindowsAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event)
QPlatformNativeInterface *platform = QGuiApplication::platformNativeInterface(); QPlatformNativeInterface *platform = QGuiApplication::platformNativeInterface();
if (!window->handle()) // Called before show(), no native window yet. if (!window->handle()) // Called before show(), no native window yet.
return; return;
HWND hWnd = (HWND)platform->nativeResourceForWindow("handle", window); const HWND hWnd = reinterpret_cast<HWND>(platform->nativeResourceForWindow("handle", window));
if (event->type() != QAccessible::MenuCommand && // MenuCommand is faked if (event->type() != QAccessible::MenuCommand && // MenuCommand is faked
event->type() != QAccessible::ObjectDestroyed) { event->type() != QAccessible::ObjectDestroyed) {
@ -220,7 +220,7 @@ IAccessible *QWindowsAccessibility::wrap(QAccessibleInterface *acc)
QWindowsIA2Accessible *wacc = new QWindowsIA2Accessible(acc); QWindowsIA2Accessible *wacc = new QWindowsIA2Accessible(acc);
# endif # endif
IAccessible *iacc = 0; IAccessible *iacc = 0;
wacc->QueryInterface(IID_IAccessible, (void**)&iacc); wacc->QueryInterface(IID_IAccessible, reinterpret_cast<void **>(&iacc));
return iacc; return iacc;
#endif // defined(Q_OS_WINCE) #endif // defined(Q_OS_WINCE)
} }
@ -230,7 +230,7 @@ bool QWindowsAccessibility::handleAccessibleObjectFromWindowRequest(HWND hwnd, W
#if !defined(Q_OS_WINCE) #if !defined(Q_OS_WINCE)
if (static_cast<long>(lParam) == static_cast<long>(UiaRootObjectId)) { if (static_cast<long>(lParam) == static_cast<long>(UiaRootObjectId)) {
/* For UI Automation */ /* For UI Automation */
} else if ((DWORD)lParam == DWORD(OBJID_CLIENT)) { } else if (DWORD(lParam) == DWORD(OBJID_CLIENT)) {
// Start handling accessibility internally // Start handling accessibility internally
QGuiApplicationPrivate::platformIntegration()->accessibility()->setActive(true); QGuiApplicationPrivate::platformIntegration()->accessibility()->setActive(true);
// Ignoring all requests while starting up // Ignoring all requests while starting up
@ -244,7 +244,7 @@ bool QWindowsAccessibility::handleAccessibleObjectFromWindowRequest(HWND hwnd, W
if (!oleaccChecked) { if (!oleaccChecked) {
oleaccChecked = true; oleaccChecked = true;
ptrLresultFromObject = (PtrLresultFromObject)QSystemLibrary::resolve(QLatin1String("oleacc"), "LresultFromObject"); ptrLresultFromObject = reinterpret_cast<PtrLresultFromObject>(QSystemLibrary::resolve(QLatin1String("oleacc"), "LresultFromObject"));
} }
if (ptrLresultFromObject) { if (ptrLresultFromObject) {

View File

@ -100,9 +100,9 @@ HRESULT STDMETHODCALLTYPE QWindowsEnumerate::QueryInterface(REFIID id, LPVOID *i
{ {
*iface = 0; *iface = 0;
if (id == IID_IUnknown) if (id == IID_IUnknown)
*iface = (IUnknown*)this; *iface = static_cast<IUnknown *>(this);
else if (id == IID_IEnumVARIANT) else if (id == IID_IEnumVARIANT)
*iface = (IEnumVARIANT*)this; *iface = static_cast<IEnumVARIANT *>(this);
if (*iface) { if (*iface) {
AddRef(); AddRef();
@ -150,13 +150,13 @@ HRESULT STDMETHODCALLTYPE QWindowsEnumerate::Next(unsigned long celt, VARIANT F
ULONG l; ULONG l;
for (l = 0; l < celt; l++) { for (l = 0; l < celt; l++) {
VariantInit(&rgVar[l]); VariantInit(&rgVar[l]);
if ((current+1) > (ULONG)array.size()) { if (current + 1 > ULONG(array.size())) {
*pCeltFetched = l; *pCeltFetched = l;
return S_FALSE; return S_FALSE;
} }
rgVar[l].vt = VT_I4; rgVar[l].vt = VT_I4;
rgVar[l].lVal = array[(int)current]; rgVar[l].lVal = array[int(current)];
++current; ++current;
} }
*pCeltFetched = l; *pCeltFetched = l;
@ -172,8 +172,8 @@ HRESULT STDMETHODCALLTYPE QWindowsEnumerate::Reset()
HRESULT STDMETHODCALLTYPE QWindowsEnumerate::Skip(unsigned long celt) HRESULT STDMETHODCALLTYPE QWindowsEnumerate::Skip(unsigned long celt)
{ {
current += celt; current += celt;
if (current > (ULONG)array.size()) { if (current > ULONG(array.size())) {
current = array.size(); current = ULONG(array.size());
return S_FALSE; return S_FALSE;
} }
return S_OK; return S_OK;
@ -201,13 +201,13 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::QueryInterface(REFIID id, LPVO
<< strIID << ", iface:" << accessibleInterface(); << strIID << ", iface:" << accessibleInterface();
} }
if (id == IID_IUnknown) { if (id == IID_IUnknown) {
*iface = (IUnknown*)(IDispatch*)this; *iface = static_cast<IUnknown *>(static_cast<IDispatch *>(this));
} else if (id == IID_IDispatch) { } else if (id == IID_IDispatch) {
*iface = (IDispatch*)this; *iface = static_cast<IDispatch *>(this);
} else if (id == IID_IAccessible) { } else if (id == IID_IAccessible) {
*iface = (IAccessible*)this; *iface = static_cast<IAccessible *>(this);
} else if (id == IID_IOleWindow) { } else if (id == IID_IOleWindow) {
*iface = (IOleWindow*)this; *iface = static_cast<IOleWindow *>(this);
} }
if (*iface) { if (*iface) {

View File

@ -430,7 +430,7 @@ bool QWindowsMouseHandler::translateMouseWheelEvent(QWindow *window, HWND,
int delta; int delta;
if (msg.message == WM_MOUSEWHEEL || msg.message == WM_MOUSEHWHEEL) if (msg.message == WM_MOUSEWHEEL || msg.message == WM_MOUSEHWHEEL)
delta = HIWORD (msg.wParam); delta = GET_WHEEL_DELTA_WPARAM(msg.wParam);
else else
delta = int(msg.wParam); delta = int(msg.wParam);

View File

@ -128,6 +128,41 @@ static inline QColor getSysColor(int index)
return COLORREFToQColor(GetSysColor(index)); return COLORREFToQColor(GetSysColor(index));
} }
#ifndef QT_NO_WINCE_SHELLSDK
// QTBUG-48823/Windows 10: SHGetFileInfo() (as called by item views on file system
// models has been observed to trigger a WM_PAINT on the mainwindow. Suppress the
// behavior by running it in a thread.
class ShGetFileInfoFunction
{
public:
explicit ShGetFileInfoFunction(const wchar_t *fn, DWORD a, SHFILEINFO *i, UINT f, bool *r) :
m_fileName(fn), m_attributes(a), m_flags(f), m_info(i), m_result(r) {}
void operator()() const { *m_result = SHGetFileInfo(m_fileName, m_attributes, m_info, sizeof(SHFILEINFO), m_flags); }
private:
const wchar_t *m_fileName;
const DWORD m_attributes;
const UINT m_flags;
SHFILEINFO *const m_info;
bool *m_result;
};
static bool shGetFileInfoBackground(QWindowsThreadPoolRunner &r,
const wchar_t *fileName, DWORD attributes,
SHFILEINFO *info, UINT flags,
unsigned long timeOutMSecs = 5000)
{
bool result = false;
if (!r.run(ShGetFileInfoFunction(fileName, attributes, info, flags, &result), timeOutMSecs)) {
qWarning().noquote() << "ShGetFileInfoBackground() timed out for "
<< QString::fromWCharArray(fileName);
return false;
}
return result;
}
#endif // !QT_NO_WINCE_SHELLSDK
// from QStyle::standardPalette // from QStyle::standardPalette
static inline QPalette standardPalette() static inline QPalette standardPalette()
{ {
@ -725,23 +760,22 @@ QPixmap QWindowsTheme::fileIconPixmap(const QFileInfo &fileInfo, const QSizeF &s
} }
SHFILEINFO info; SHFILEINFO info;
unsigned int flags = const unsigned int flags =
#ifndef Q_OS_WINCE #ifndef Q_OS_WINCE
SHGFI_ICON|iconSize|SHGFI_SYSICONINDEX|SHGFI_ADDOVERLAYS|SHGFI_OVERLAYINDEX; SHGFI_ICON|iconSize|SHGFI_SYSICONINDEX|SHGFI_ADDOVERLAYS|SHGFI_OVERLAYINDEX;
#else #else
iconSize|SHGFI_SYSICONINDEX; iconSize|SHGFI_SYSICONINDEX;
#endif // Q_OS_WINCE #endif // Q_OS_WINCE
unsigned long val = 0;
#if !defined(QT_NO_WINCE_SHELLSDK) #if !defined(QT_NO_WINCE_SHELLSDK)
if (cacheableDirIcon && useDefaultFolderIcon) { const bool val = cacheableDirIcon && useDefaultFolderIcon
flags |= SHGFI_USEFILEATTRIBUTES; ? shGetFileInfoBackground(m_threadPoolRunner, L"dummy", FILE_ATTRIBUTE_DIRECTORY,
val = SHGetFileInfo(L"dummy", &info, flags | SHGFI_USEFILEATTRIBUTES)
FILE_ATTRIBUTE_DIRECTORY, : shGetFileInfoBackground(m_threadPoolRunner, reinterpret_cast<const wchar_t *>(filePath.utf16()), 0,
&info, sizeof(SHFILEINFO), flags); &info, flags);
} else { #else
val = SHGetFileInfo(reinterpret_cast<const wchar_t *>(filePath.utf16()), 0, const bool val = false;
&info, sizeof(SHFILEINFO), flags);
}
#endif // !QT_NO_WINCE_SHELLSDK #endif // !QT_NO_WINCE_SHELLSDK
// Even if GetFileInfo returns a valid result, hIcon can be empty in some cases // Even if GetFileInfo returns a valid result, hIcon can be empty in some cases

View File

@ -40,6 +40,7 @@
#ifndef QWINDOWSTHEME_H #ifndef QWINDOWSTHEME_H
#define QWINDOWSTHEME_H #define QWINDOWSTHEME_H
#include "qwindowsthreadpoolrunner.h"
#include <qpa/qplatformtheme.h> #include <qpa/qplatformtheme.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -80,6 +81,7 @@ private:
static QWindowsTheme *m_instance; static QWindowsTheme *m_instance;
QPalette *m_palettes[NPalettes]; QPalette *m_palettes[NPalettes];
QFont *m_fonts[NFonts]; QFont *m_fonts[NFonts];
mutable QWindowsThreadPoolRunner m_threadPoolRunner;
}; };
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -0,0 +1,116 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** As a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QWINDOWSTHREADPOOLRUNNER_H
#define QWINDOWSTHREADPOOLRUNNER_H
#include <QtCore/QMutex>
#include <QtCore/QRunnable>
#include <QtCore/QThreadPool>
#include <QtCore/QWaitCondition>
QT_BEGIN_NAMESPACE
/*!
\class QWindowsThreadPoolRunner
\brief Runs a task in the global instance of QThreadPool
QThreadPool does not provide a method to wait on a single task, so this needs
to be done by using QWaitCondition/QMutex.
\internal
\ingroup qt-lighthouse-win
*/
class QWindowsThreadPoolRunner
{
Q_DISABLE_COPY(QWindowsThreadPoolRunner)
#ifndef QT_NO_THREAD
template <class RunnableFunction> // nested class implementing QRunnable to execute a function.
class Runnable : public QRunnable
{
public:
explicit Runnable(QMutex *m, QWaitCondition *c, RunnableFunction f)
: m_mutex(m), m_condition(c), m_function(f) {}
void run() Q_DECL_OVERRIDE
{
m_function();
m_mutex->lock();
m_condition->wakeAll();
m_mutex->unlock();
}
private:
QMutex *m_mutex;
QWaitCondition *m_condition;
RunnableFunction m_function;
}; // class Runnable
public:
QWindowsThreadPoolRunner() {}
template <class Function>
bool run(Function f, unsigned long timeOutMSecs = 5000)
{
QThreadPool *pool = QThreadPool::globalInstance();
Q_ASSERT(pool);
Runnable<Function> *runnable = new Runnable<Function>(&m_mutex, &m_condition, f);
m_mutex.lock();
pool->start(runnable);
const bool ok = m_condition.wait(&m_mutex, timeOutMSecs);
m_mutex.unlock();
if (!ok)
pool->cancel(runnable);
return ok;
}
private:
QMutex m_mutex;
QWaitCondition m_condition;
#else // !QT_NO_THREAD
public:
QWindowsThreadPoolRunner() {}
template <class Function>
bool run(Function f, unsigned long /* timeOutMSecs */ = 5000)
{
f();
return true;
}
#endif // QT_NO_THREAD
};
QT_END_NAMESPACE
#endif // QWINDOWSTHREADPOOLRUNNER_H

View File

@ -2203,14 +2203,15 @@ void QWindowsWindow::getSizeHints(MINMAXINFO *mmi) const
// Documentation of MINMAXINFO states that it will only work for the primary screen // Documentation of MINMAXINFO states that it will only work for the primary screen
if (screen && screen == QGuiApplication::primaryScreen()) { if (screen && screen == QGuiApplication::primaryScreen()) {
mmi->ptMaxSize.y = screen->availableGeometry().height(); const QRect availableGeometry = QHighDpi::toNativePixels(screen->availableGeometry(), screen);
mmi->ptMaxSize.y = availableGeometry.height();
// Width, because you can have the taskbar on the sides too. // Width, because you can have the taskbar on the sides too.
mmi->ptMaxSize.x = screen->availableGeometry().width(); mmi->ptMaxSize.x = availableGeometry.width();
// If you have the taskbar on top, or on the left you don't want it at (0,0): // If you have the taskbar on top, or on the left you don't want it at (0,0):
mmi->ptMaxPosition.x = screen->availableGeometry().x(); mmi->ptMaxPosition.x = availableGeometry.x();
mmi->ptMaxPosition.y = screen->availableGeometry().y(); mmi->ptMaxPosition.y = availableGeometry.y();
} else if (!screen){ } else if (!screen){
qWarning() << "window()->screen() returned a null screen"; qWarning() << "window()->screen() returned a null screen";
} }

View File

@ -62,7 +62,8 @@ HEADERS += \
$$PWD/qplatformfunctions_wince.h \ $$PWD/qplatformfunctions_wince.h \
$$PWD/qwindowsnativeimage.h \ $$PWD/qwindowsnativeimage.h \
$$PWD/qwindowsnativeinterface.h \ $$PWD/qwindowsnativeinterface.h \
$$PWD/qwindowsopengltester.h $$PWD/qwindowsopengltester.h \
$$PWD/qwindowsthreadpoolrunner.h
INCLUDEPATH += $$PWD INCLUDEPATH += $$PWD

View File

@ -472,6 +472,17 @@ QString QSqlDriver::stripDelimiters(const QString &identifier, IdentifierType ty
This method can be used to manipulate tables without having to worry This method can be used to manipulate tables without having to worry
about database-dependent SQL dialects. For non-prepared statements, about database-dependent SQL dialects. For non-prepared statements,
the values will be properly escaped. the values will be properly escaped.
In the WHERE statement, each non-null field of \a rec specifies a
filter condition of equality to the field value, or if prepared, a
placeholder. However, prepared or not, a null field specifies the
condition IS NULL and never introduces a placeholder. The
application must not attempt to bind data for the null field during
execution. The field must be set to some non-null value if a
placeholder is desired. Furthermore, since non-null fields specify
equality conditions and SQL NULL is not equal to anything, even
itself, it is generally not useful to bind a null to a placeholder.
*/ */
QString QSqlDriver::sqlStatement(StatementType type, const QString &tableName, QString QSqlDriver::sqlStatement(StatementType type, const QString &tableName,
const QSqlRecord &rec, bool preparedStatement) const const QSqlRecord &rec, bool preparedStatement) const

View File

@ -424,6 +424,7 @@ QWidget *QApplicationPrivate::hidden_focus_widget = 0; // will get keyboard inpu
QWidget *QApplicationPrivate::active_window = 0; // toplevel with keyboard focus QWidget *QApplicationPrivate::active_window = 0; // toplevel with keyboard focus
#ifndef QT_NO_WHEELEVENT #ifndef QT_NO_WHEELEVENT
int QApplicationPrivate::wheel_scroll_lines; // number of lines to scroll int QApplicationPrivate::wheel_scroll_lines; // number of lines to scroll
QWidget *QApplicationPrivate::wheel_widget = Q_NULLPTR;
#endif #endif
bool qt_in_tab_key_event = false; bool qt_in_tab_key_event = false;
int qt_antialiasing_threshold = -1; int qt_antialiasing_threshold = -1;
@ -3307,7 +3308,6 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
case QEvent::Wheel: case QEvent::Wheel:
{ {
QWidget* w = static_cast<QWidget *>(receiver); QWidget* w = static_cast<QWidget *>(receiver);
QWheelEvent* wheel = static_cast<QWheelEvent*>(e);
// QTBUG-40656, QTBUG-42731: ignore wheel events when a popup (QComboBox) is open. // QTBUG-40656, QTBUG-42731: ignore wheel events when a popup (QComboBox) is open.
if (const QWidget *popup = QApplication::activePopupWidget()) { if (const QWidget *popup = QApplication::activePopupWidget()) {
@ -3315,27 +3315,61 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
return true; return true;
} }
QPoint relpos = wheel->pos(); QWheelEvent* wheel = static_cast<QWheelEvent*>(e);
bool eventAccepted = wheel->isAccepted(); const bool spontaneous = wheel->spontaneous();
const Qt::ScrollPhase phase = wheel->phase();
if (e->spontaneous() && wheel->phase() == Qt::ScrollUpdate) if (phase == Qt::NoScrollPhase || phase == Qt::ScrollBegin
QApplicationPrivate::giveFocusAccordingToFocusPolicy(w, e, relpos); || (phase == Qt::ScrollUpdate && !QApplicationPrivate::wheel_widget)) {
if (spontaneous && phase == Qt::ScrollBegin)
QApplicationPrivate::wheel_widget = Q_NULLPTR;
const QPoint &relpos = wheel->pos();
if (spontaneous && (phase == Qt::NoScrollPhase || phase == Qt::ScrollUpdate))
QApplicationPrivate::giveFocusAccordingToFocusPolicy(w, e, relpos);
while (w) {
QWheelEvent we(relpos, wheel->globalPos(), wheel->pixelDelta(), wheel->angleDelta(), wheel->delta(), wheel->orientation(), wheel->buttons(), QWheelEvent we(relpos, wheel->globalPos(), wheel->pixelDelta(), wheel->angleDelta(), wheel->delta(), wheel->orientation(), wheel->buttons(),
wheel->modifiers(), wheel->phase(), wheel->source()); wheel->modifiers(), phase, wheel->source());
we.spont = wheel->spontaneous(); bool eventAccepted;
res = d->notify_helper(w, w == receiver ? wheel : &we); while (w) {
eventAccepted = ((w == receiver) ? wheel : &we)->isAccepted(); we.spont = spontaneous && w == receiver;
e->spont = false; we.ignore();
if ((res && eventAccepted) res = d->notify_helper(w, &we);
|| w->isWindow() || w->testAttribute(Qt::WA_NoMousePropagation)) eventAccepted = we.isAccepted();
break; if (res && eventAccepted) {
if (spontaneous && phase != Qt::NoScrollPhase)
QApplicationPrivate::wheel_widget = w;
break;
}
if (w->isWindow() || w->testAttribute(Qt::WA_NoMousePropagation))
break;
relpos += w->pos(); we.p += w->pos();
w = w->parentWidget(); w = w->parentWidget();
}
wheel->setAccepted(eventAccepted);
} else if (QApplicationPrivate::wheel_widget) {
if (!spontaneous) {
// wheel_widget may forward the wheel event to a delegate widget,
// either directly or indirectly (e.g. QAbstractScrollArea will
// forward to its QScrollBars through viewportEvent()). In that
// case, the event will not be spontaneous but synthesized, so
// we can send it straigth to the receiver.
d->notify_helper(w, wheel);
} else {
const QPoint &relpos = QApplicationPrivate::wheel_widget->mapFromGlobal(wheel->globalPos());
QWheelEvent we(relpos, wheel->globalPos(), wheel->pixelDelta(), wheel->angleDelta(), wheel->delta(), wheel->orientation(), wheel->buttons(),
wheel->modifiers(), wheel->phase(), wheel->source());
we.spont = true;
we.ignore();
d->notify_helper(QApplicationPrivate::wheel_widget, &we);
wheel->setAccepted(we.isAccepted());
if (phase == Qt::ScrollEnd)
QApplicationPrivate::wheel_widget = Q_NULLPTR;
}
} }
wheel->setAccepted(eventAccepted);
} }
break; break;
#endif #endif

View File

@ -208,6 +208,7 @@ public:
static QWidget *active_window; static QWidget *active_window;
#ifndef QT_NO_WHEELEVENT #ifndef QT_NO_WHEELEVENT
static int wheel_scroll_lines; static int wheel_scroll_lines;
static QWidget *wheel_widget;
#endif #endif
static int enabledAnimations; // Combination of QPlatformTheme::UiEffect static int enabledAnimations; // Combination of QPlatformTheme::UiEffect

View File

@ -40,15 +40,7 @@
#include <QtNetwork/QHostInfo> #include <QtNetwork/QHostInfo>
#include <stdlib.h> #include <stdlib.h>
#ifndef QT_NO_PROCESS
# include <private/qprocess_p.h> // only so we get QPROCESS_USE_SPAWN # include <private/qprocess_p.h> // only so we get QPROCESS_USE_SPAWN
# if defined(Q_OS_WIN)
# include <windows.h>
# endif
Q_DECLARE_METATYPE(QProcess::ExitStatus);
Q_DECLARE_METATYPE(QProcess::ProcessState);
#endif
typedef void (QProcess::*QProcessFinishedSignal1)(int); typedef void (QProcess::*QProcessFinishedSignal1)(int);
typedef void (QProcess::*QProcessFinishedSignal2)(int, QProcess::ExitStatus); typedef void (QProcess::*QProcessFinishedSignal2)(int, QProcess::ExitStatus);
@ -1052,24 +1044,33 @@ private:
void tst_QProcess::softExitInSlots_data() void tst_QProcess::softExitInSlots_data()
{ {
QTest::addColumn<QString>("appName"); QTest::addColumn<QString>("appName");
QTest::addColumn<int>("signalToConnect");
QByteArray dataTagPrefix("gui app ");
#ifndef QT_NO_WIDGETS #ifndef QT_NO_WIDGETS
QTest::newRow("gui app") << "testGuiProcess/testGuiProcess"; for (int i = 0; i < 6; ++i) {
QTest::newRow(dataTagPrefix + QByteArray::number(i))
<< "testGuiProcess/testGuiProcess" << i;
}
#endif #endif
QTest::newRow("console app") << "testProcessEcho2/testProcessEcho2";
dataTagPrefix = "console app ";
for (int i = 0; i < 6; ++i) {
QTest::newRow(dataTagPrefix + QByteArray::number(i))
<< "testProcessEcho2/testProcessEcho2" << i;
}
} }
void tst_QProcess::softExitInSlots() void tst_QProcess::softExitInSlots()
{ {
QFETCH(QString, appName); QFETCH(QString, appName);
QFETCH(int, signalToConnect);
for (int i = 0; i < 6; ++i) { SoftExitProcess proc(signalToConnect);
SoftExitProcess proc(i); proc.writeAfterStart("OLEBOLE", 8); // include the \0
proc.writeAfterStart("OLEBOLE", 8); // include the \0 proc.start(appName);
proc.start(appName); QTRY_VERIFY_WITH_TIMEOUT(proc.waitedForFinished, 10000);
QTRY_VERIFY_WITH_TIMEOUT(proc.waitedForFinished, 10000); QCOMPARE(proc.state(), QProcess::NotRunning);
QCOMPARE(proc.state(), QProcess::NotRunning);
}
} }
#endif #endif

View File

@ -714,8 +714,6 @@ void tst_QDateTime::fromMSecsSinceEpoch()
QCOMPARE(dtLocal.toLocalTime(), cet); QCOMPARE(dtLocal.toLocalTime(), cet);
QCOMPARE(dtUtc.toLocalTime(), cet); QCOMPARE(dtUtc.toLocalTime(), cet);
QCOMPARE(dtOffset.toLocalTime(), cet); QCOMPARE(dtOffset.toLocalTime(), cet);
} else {
QSKIP("You must test using Central European (CET/CEST) time zone, e.g. TZ=Europe/Oslo");
} }
// LocalTime will overflow for max // LocalTime will overflow for max

View File

@ -96,6 +96,7 @@ private slots:
void drawBitmap(); void drawBitmap();
void isNull(); void isNull();
void task_246446(); void task_246446();
void task_51271();
void convertFromImageNoDetach(); void convertFromImageNoDetach();
void convertFromImageDetach(); void convertFromImageDetach();
@ -1425,6 +1426,14 @@ void tst_QPixmap::task_246446()
QVERIFY(pm.mask().isNull()); QVERIFY(pm.mask().isNull());
} }
void tst_QPixmap::task_51271()
{
QPixmap pm;
QBitmap bm;
QVERIFY(!pm.isQBitmap()); // Should not crash !
QVERIFY(bm.isQBitmap());
}
void tst_QPixmap::preserveDepth() void tst_QPixmap::preserveDepth()
{ {
QPixmap target(64, 64); QPixmap target(64, 64);

View File

@ -341,11 +341,11 @@ struct TypeAlignment
void tst_QGuiMetaType::flags_data() void tst_QGuiMetaType::flags_data()
{ {
QTest::addColumn<int>("type"); QTest::addColumn<int>("type");
QTest::addColumn<bool>("isMovable"); QTest::addColumn<bool>("isRelocatable");
QTest::addColumn<bool>("isComplex"); QTest::addColumn<bool>("isComplex");
#define ADD_METATYPE_TEST_ROW(MetaTypeName, MetaTypeId, RealType) \ #define ADD_METATYPE_TEST_ROW(MetaTypeName, MetaTypeId, RealType) \
QTest::newRow(#RealType) << MetaTypeId << bool(!QTypeInfo<RealType>::isStatic) << bool(QTypeInfo<RealType>::isComplex); QTest::newRow(#RealType) << MetaTypeId << bool(QTypeInfoQuery<RealType>::isRelocatable) << bool(QTypeInfoQuery<RealType>::isComplex);
QT_FOR_EACH_STATIC_GUI_CLASS(ADD_METATYPE_TEST_ROW) QT_FOR_EACH_STATIC_GUI_CLASS(ADD_METATYPE_TEST_ROW)
#undef ADD_METATYPE_TEST_ROW #undef ADD_METATYPE_TEST_ROW
} }
@ -353,12 +353,12 @@ QT_FOR_EACH_STATIC_GUI_CLASS(ADD_METATYPE_TEST_ROW)
void tst_QGuiMetaType::flags() void tst_QGuiMetaType::flags()
{ {
QFETCH(int, type); QFETCH(int, type);
QFETCH(bool, isMovable); QFETCH(bool, isRelocatable);
QFETCH(bool, isComplex); QFETCH(bool, isComplex);
QCOMPARE(bool(QMetaType::typeFlags(type) & QMetaType::NeedsConstruction), isComplex); QCOMPARE(bool(QMetaType::typeFlags(type) & QMetaType::NeedsConstruction), isComplex);
QCOMPARE(bool(QMetaType::typeFlags(type) & QMetaType::NeedsDestruction), isComplex); QCOMPARE(bool(QMetaType::typeFlags(type) & QMetaType::NeedsDestruction), isComplex);
QCOMPARE(bool(QMetaType::typeFlags(type) & QMetaType::MovableType), isMovable); QCOMPARE(bool(QMetaType::typeFlags(type) & QMetaType::MovableType), isRelocatable);
} }

View File

@ -1623,7 +1623,24 @@ void tst_QPrinter::resolution()
// Test set/get // Test set/get
int expected = 333; int expected = 333;
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
// Set resolution does nothing on OSX, see QTBUG-7000 // QMacPrintEngine chooses the closest supported resolution.
const QList<int> all_supported = native.supportedResolutions();
foreach (int supported, all_supported) {
// Test setting a supported resolution
int requested = supported;
native.setResolution(requested);
QCOMPARE(native.resolution(), requested);
// Test setting an unsupported resolution
do {
requested += 5;
} while (all_supported.contains(requested));
native.setResolution(requested);
int result = native.resolution();
QVERIFY(all_supported.contains(result));
QVERIFY(qAbs(result - requested) <= qAbs(supported - requested));
}
expected = native.resolution(); expected = native.resolution();
#endif // Q_OS_MAC #endif // Q_OS_MAC
native.setResolution(expected); native.setResolution(expected);

View File

@ -555,6 +555,11 @@ void tst_QDialog::reject()
QCOMPARE(dialog.called, 4); QCOMPARE(dialog.called, 4);
} }
static QByteArray formatPoint(QPoint p)
{
return QByteArray::number(p.x()) + ", " + QByteArray::number(p.y());
}
void tst_QDialog::snapToDefaultButton() void tst_QDialog::snapToDefaultButton()
{ {
#ifdef QT_NO_CURSOR #ifdef QT_NO_CURSOR
@ -563,9 +568,9 @@ void tst_QDialog::snapToDefaultButton()
if (!QGuiApplication::platformName().compare(QLatin1String("wayland"), Qt::CaseInsensitive)) if (!QGuiApplication::platformName().compare(QLatin1String("wayland"), Qt::CaseInsensitive))
QSKIP("Wayland: Wayland does not support setting the cursor position."); QSKIP("Wayland: Wayland does not support setting the cursor position.");
QPoint topLeftPos = QApplication::desktop()->availableGeometry().topLeft(); const QRect dialogGeometry(QApplication::desktop()->availableGeometry().topLeft()
topLeftPos = QPoint(topLeftPos.x() + 100, topLeftPos.y() + 100); + QPoint(100, 100), QSize(200, 200));
QPoint startingPos(topLeftPos.x() + 250, topLeftPos.y() + 250); const QPoint startingPos = dialogGeometry.bottomRight() + QPoint(100, 100);
QCursor::setPos(startingPos); QCursor::setPos(startingPos);
#ifdef Q_OS_OSX #ifdef Q_OS_OSX
// On OS X we use CGEventPost to move the cursor, it needs at least // On OS X we use CGEventPost to move the cursor, it needs at least
@ -576,17 +581,14 @@ void tst_QDialog::snapToDefaultButton()
QDialog dialog; QDialog dialog;
QPushButton *button = new QPushButton(&dialog); QPushButton *button = new QPushButton(&dialog);
button->setDefault(true); button->setDefault(true);
dialog.setGeometry(QRect(topLeftPos, QSize(200, 200))); dialog.setGeometry(dialogGeometry);
dialog.show(); dialog.show();
QVERIFY(QTest::qWaitForWindowExposed(&dialog)); QVERIFY(QTest::qWaitForWindowExposed(&dialog));
if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) { const QPoint localPos = button->mapFromGlobal(QCursor::pos());
if (theme->themeHint(QPlatformTheme::DialogSnapToDefaultButton).toBool()) { if (QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::DialogSnapToDefaultButton).toBool())
QPoint localPos = button->mapFromGlobal(QCursor::pos()); QVERIFY2(button->rect().contains(localPos), formatPoint(localPos).constData());
QVERIFY(button->rect().contains(localPos)); else
} else { QVERIFY2(!button->rect().contains(localPos), formatPoint(localPos).constData());
QCOMPARE(startingPos, QCursor::pos());
}
}
#endif // !QT_NO_CURSOR #endif // !QT_NO_CURSOR
} }

View File

@ -4974,7 +4974,9 @@ static inline QByteArray msgRgbMismatch(unsigned actual, unsigned expected)
static QPixmap grabWindow(QWindow *window, int x, int y, int width, int height) static QPixmap grabWindow(QWindow *window, int x, int y, int width, int height)
{ {
QScreen *screen = window->screen(); QScreen *screen = window->screen();
return screen ? screen->grabWindow(window->winId(), x, y, width, height) : QPixmap(); Q_ASSERT(screen);
QPixmap result = screen->grabWindow(window->winId(), x, y, width, height);
return result.devicePixelRatio() > 1 ? result.scaled(width, height) : result;
} }
#define VERIFY_COLOR(child, region, color) verifyColor(child, region, color, __LINE__) #define VERIFY_COLOR(child, region, color) verifyColor(child, region, color, __LINE__)
@ -8500,7 +8502,7 @@ void tst_QWidget::translucentWidget()
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
QWidget *desktopWidget = QApplication::desktop()->screen(0); QWidget *desktopWidget = QApplication::desktop()->screen(0);
if (QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA) if (QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA)
widgetSnapshot = qApp->primaryScreen()->grabWindow(desktopWidget->winId(), labelPos.x(), labelPos.y(), label.width(), label.height()); widgetSnapshot = grabWindow(desktopWidget->windowHandle(), labelPos.x(), labelPos.y(), label.width(), label.height());
else else
#endif #endif
widgetSnapshot = label.grab(QRect(QPoint(0, 0), label.size())); widgetSnapshot = label.grab(QRect(QPoint(0, 0), label.size()));