Windows QPA: Fix debug operators.
Enclose all debug operators within QT_NO_DEBUG_STREAM, declare all public ones and make the others static. Add operators for POINT and WINDOWPLACEMENT. Task-number: QTBUG-48449 Change-Id: I33f2dba2bf486a8f5cb11f11f4e2b37cce086def Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
This commit is contained in:
parent
8b9346c740
commit
69032adda0
@ -69,6 +69,7 @@ static const char formatTextHtmlC[] = "text/html";
|
||||
\ingroup qt-lighthouse-win
|
||||
*/
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
static QDebug operator<<(QDebug d, const QMimeData *mimeData)
|
||||
{
|
||||
QDebugStateSaver saver(d);
|
||||
@ -93,6 +94,7 @@ static QDebug operator<<(QDebug d, const QMimeData *mimeData)
|
||||
d << ')';
|
||||
return d;
|
||||
}
|
||||
#endif // !QT_NO_DEBUG_STREAM
|
||||
|
||||
/*!
|
||||
\class QWindowsClipboardRetrievalMimeData
|
||||
|
@ -360,6 +360,7 @@ public:
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
/* Output UID (IID, CLSID) as C++ constants.
|
||||
* The constants are contained in the Windows SDK libs, but not for MinGW. */
|
||||
static inline QString guidToString(const GUID &g)
|
||||
@ -385,6 +386,7 @@ inline QDebug operator<<(QDebug d, const GUID &g)
|
||||
d << guidToString(g);
|
||||
return d;
|
||||
}
|
||||
#endif // !QT_NO_DEBUG_STREAM
|
||||
|
||||
// Return an allocated wchar_t array from a QString, reserve more memory if desired.
|
||||
static wchar_t *qStringToWCharArray(const QString &s, size_t reserveSize = 0)
|
||||
|
@ -249,7 +249,7 @@ private:
|
||||
QWindowsDragCursorWindow *m_touchDragWindow;
|
||||
|
||||
ULONG m_refs;
|
||||
#ifndef QT_NO_DEBUG_OUTPUT
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
friend QDebug operator<<(QDebug, const QWindowsOleDropSource::CursorEntry &);
|
||||
#endif
|
||||
};
|
||||
@ -271,14 +271,14 @@ QWindowsOleDropSource::~QWindowsOleDropSource()
|
||||
qCDebug(lcQpaMime) << __FUNCTION__;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_DEBUG_OUTPUT
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
QDebug operator<<(QDebug d, const QWindowsOleDropSource::CursorEntry &e)
|
||||
{
|
||||
d << "CursorEntry:" << e.pixmap.size() << '#' << e.cacheKey
|
||||
<< "HCURSOR" << e.cursor->cursor << "hotspot:" << e.hotSpot;
|
||||
return d;
|
||||
}
|
||||
#endif // !QT_NO_DEBUG_OUTPUT
|
||||
#endif // !QT_NO_DEBUG_STREAM
|
||||
|
||||
static qreal dragScaleFactor()
|
||||
{
|
||||
|
@ -606,6 +606,7 @@ static inline bool initDirectWrite(QWindowsFontEngineData *d)
|
||||
\ingroup qt-lighthouse-win
|
||||
*/
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
QDebug operator<<(QDebug d, const QFontDef &def)
|
||||
{
|
||||
QDebugStateSaver saver(d);
|
||||
@ -617,6 +618,7 @@ QDebug operator<<(QDebug d, const QFontDef &def)
|
||||
<< def.hintingPreference;
|
||||
return d;
|
||||
}
|
||||
#endif // !QT_NO_DEBUG_STREAM
|
||||
|
||||
static inline QFontDatabase::WritingSystem writingSystemFromCharSet(uchar charSet)
|
||||
{
|
||||
|
@ -118,6 +118,10 @@ private:
|
||||
QMap<QString, UniqueFontData> m_uniqueFontData;
|
||||
};
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
QDebug operator<<(QDebug, const QFontDef &def);
|
||||
#endif
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QWINDOWSFONTDATABASE_H
|
||||
|
@ -355,7 +355,7 @@ static bool addFontToDatabase(const QString &faceName,
|
||||
const QFont::Weight weight = QPlatformFontDatabase::weightFromInteger(tm->tmWeight);
|
||||
const QFont::Stretch stretch = QFont::Unstretched;
|
||||
|
||||
#ifndef QT_NO_DEBUG_OUTPUT
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
if (QWindowsContext::verbose > 2) {
|
||||
QString message;
|
||||
QTextStream str(&message);
|
||||
|
@ -284,6 +284,7 @@ static inline void initPixelFormatDescriptor(PIXELFORMATDESCRIPTOR *d)
|
||||
d->nVersion = 1;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
QDebug operator<<(QDebug d, const PIXELFORMATDESCRIPTOR &pd)
|
||||
{
|
||||
QDebugStateSaver saver(d);
|
||||
@ -326,6 +327,32 @@ QDebug operator<<(QDebug d, const PIXELFORMATDESCRIPTOR &pd)
|
||||
return d;
|
||||
}
|
||||
|
||||
QDebug operator<<(QDebug d, const QOpenGLStaticContext &s)
|
||||
{
|
||||
QDebugStateSaver saver(d);
|
||||
d.nospace();
|
||||
d << "OpenGL: " << s.vendor << ',' << s.renderer << " default "
|
||||
<< s.defaultFormat;
|
||||
if (s.extensions & QOpenGLStaticContext::SampleBuffers)
|
||||
d << ",SampleBuffers";
|
||||
if (s.hasExtensions())
|
||||
d << ", Extension-API present";
|
||||
d << "\nExtensions: " << (s.extensionNames.count(' ') + 1);
|
||||
if (QWindowsContext::verbose > 1)
|
||||
d << s.extensionNames;
|
||||
return d;
|
||||
}
|
||||
|
||||
QDebug operator<<(QDebug d, const QWindowsOpenGLContextFormat &f)
|
||||
{
|
||||
QDebugStateSaver saver(d);
|
||||
d.nospace();
|
||||
d << "ContextFormat: v" << (f.version >> 8) << '.' << (f.version & 0xFF)
|
||||
<< " profile: " << f.profile << " options: " << f.options;
|
||||
return d;
|
||||
}
|
||||
#endif // !QT_NO_DEBUG_STREAM
|
||||
|
||||
// Check whether an obtained PIXELFORMATDESCRIPTOR matches the request.
|
||||
static inline bool
|
||||
isAcceptableFormat(const QWindowsOpenGLAdditionalFormat &additional,
|
||||
@ -900,15 +927,6 @@ void QWindowsOpenGLContextFormat::apply(QSurfaceFormat *format) const
|
||||
format->setOption(QSurfaceFormat::DeprecatedFunctions);
|
||||
}
|
||||
|
||||
QDebug operator<<(QDebug d, const QWindowsOpenGLContextFormat &f)
|
||||
{
|
||||
QDebugStateSaver saver(d);
|
||||
d.nospace();
|
||||
d << "ContextFormat: v" << (f.version >> 8) << '.' << (f.version & 0xFF)
|
||||
<< " profile: " << f.profile << " options: " << f.options;
|
||||
return d;
|
||||
}
|
||||
|
||||
/*!
|
||||
\class QOpenGLTemporaryContext
|
||||
\brief A temporary context that can be instantiated on the stack.
|
||||
@ -1013,22 +1031,6 @@ QOpenGLStaticContext *QOpenGLStaticContext::create(bool softwareRendering)
|
||||
return result;
|
||||
}
|
||||
|
||||
QDebug operator<<(QDebug d, const QOpenGLStaticContext &s)
|
||||
{
|
||||
QDebugStateSaver saver(d);
|
||||
d.nospace();
|
||||
d << "OpenGL: " << s.vendor << ',' << s.renderer << " default "
|
||||
<< s.defaultFormat;
|
||||
if (s.extensions & QOpenGLStaticContext::SampleBuffers)
|
||||
d << ",SampleBuffers";
|
||||
if (s.hasExtensions())
|
||||
d << ", Extension-API present";
|
||||
d << "\nExtensions: " << (s.extensionNames.count(' ') + 1);
|
||||
if (QWindowsContext::verbose > 1)
|
||||
d << s.extensionNames;
|
||||
return d;
|
||||
}
|
||||
|
||||
/*!
|
||||
\class QWindowsGLContext
|
||||
\brief Open GL context.
|
||||
|
@ -85,7 +85,11 @@ struct QWindowsOpenGLContextFormat
|
||||
QSurfaceFormat::FormatOptions options;
|
||||
};
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
QDebug operator<<(QDebug d, const PIXELFORMATDESCRIPTOR &);
|
||||
QDebug operator<<(QDebug d, const QWindowsOpenGLContextFormat &);
|
||||
QDebug operator<<(QDebug d, const QOpenGLStaticContext &s);
|
||||
#endif
|
||||
|
||||
struct QWindowsOpengl32DLL
|
||||
{
|
||||
@ -224,8 +228,6 @@ public:
|
||||
static QWindowsOpengl32DLL opengl32;
|
||||
};
|
||||
|
||||
QDebug operator<<(QDebug d, const QOpenGLStaticContext &);
|
||||
|
||||
class QWindowsGLContext : public QWindowsOpenGLContext
|
||||
{
|
||||
public:
|
||||
|
@ -378,7 +378,7 @@ static bool canGetData(int cf, IDataObject * pDataObj)
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_DEBUG_OUTPUT
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
QDebug operator<<(QDebug d, const FORMATETC &tc)
|
||||
{
|
||||
QDebugStateSaver saver(d);
|
||||
@ -443,7 +443,7 @@ QDebug operator<<(QDebug d, IDataObject *dataObj)
|
||||
d << ')';
|
||||
return d;
|
||||
}
|
||||
#endif // !QT_NO_DEBUG_OUTPUT
|
||||
#endif // !QT_NO_DEBUG_STREAM
|
||||
|
||||
/*!
|
||||
\class QWindowsMime
|
||||
|
@ -93,7 +93,7 @@ private:
|
||||
mutable int m_internalMimeCount;
|
||||
};
|
||||
|
||||
#ifndef QT_NO_DEBUG_OUTPUT
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
QDebug operator<<(QDebug, const FORMATETC &);
|
||||
QDebug operator<<(QDebug d, IDataObject *);
|
||||
#endif
|
||||
|
@ -98,6 +98,7 @@ GpuDescription GpuDescription::detect()
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
QDebug operator<<(QDebug d, const GpuDescription &gd)
|
||||
{
|
||||
QDebugStateSaver s(d);
|
||||
@ -109,6 +110,7 @@ QDebug operator<<(QDebug d, const GpuDescription &gd)
|
||||
<< ", version=" << gd.driverVersion << ", " << gd.description << ')';
|
||||
return d;
|
||||
}
|
||||
#endif // !QT_NO_DEBUG_STREAM
|
||||
|
||||
// Return printable string formatted like the output of the dxdiag tool.
|
||||
QString GpuDescription::toString() const
|
||||
|
@ -60,7 +60,9 @@ struct GpuDescription
|
||||
QByteArray description;
|
||||
};
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
QDebug operator<<(QDebug d, const GpuDescription &gd);
|
||||
#endif
|
||||
|
||||
class QWindowsOpenGLTester
|
||||
{
|
||||
|
@ -172,6 +172,7 @@ static inline WindowsScreenDataList monitorData()
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
static QDebug operator<<(QDebug dbg, const QWindowsScreenData &d)
|
||||
{
|
||||
QDebugStateSaver saver(dbg);
|
||||
@ -192,6 +193,7 @@ static QDebug operator<<(QDebug dbg, const QWindowsScreenData &d)
|
||||
dbg << " lock screen";
|
||||
return dbg;
|
||||
}
|
||||
#endif // !QT_NO_DEBUG_STREAM
|
||||
|
||||
// Return the cursor to be shared by all screens (virtual desktop).
|
||||
static inline QSharedPointer<QPlatformCursor> sharedCursor()
|
||||
|
@ -302,8 +302,11 @@ static inline QTabletEvent::PointerType pointerType(unsigned currentCursor)
|
||||
return QTabletEvent::UnknownPointer;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
QDebug operator<<(QDebug d, const QWindowsTabletDeviceData &t)
|
||||
{
|
||||
QDebugStateSaver saver(d);
|
||||
d.nospace();
|
||||
d << "TabletDevice id:" << t.uniqueId << " pressure: " << t.minPressure
|
||||
<< ".." << t.maxPressure << " tan pressure: " << t.minTanPressure << ".."
|
||||
<< t.maxTanPressure << " area:" << t.minX << t.minY <<t.minZ
|
||||
@ -311,6 +314,7 @@ QDebug operator<<(QDebug d, const QWindowsTabletDeviceData &t)
|
||||
<< " pointer " << t.currentPointerType;
|
||||
return d;
|
||||
}
|
||||
#endif // !QT_NO_DEBUG_STREAM
|
||||
|
||||
QWindowsTabletDeviceData QWindowsTabletSupport::tabletInit(const quint64 uniqueId, const UINT cursorType) const
|
||||
{
|
||||
|
@ -97,7 +97,9 @@ struct QWindowsTabletDeviceData
|
||||
int currentPointerType;
|
||||
};
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
QDebug operator<<(QDebug d, const QWindowsTabletDeviceData &t);
|
||||
#endif
|
||||
|
||||
class QWindowsTabletSupport
|
||||
{
|
||||
|
@ -106,20 +106,6 @@ static QByteArray debugWinExStyle(DWORD exStyle)
|
||||
return rc;
|
||||
}
|
||||
|
||||
#ifndef Q_OS_WINCE // maybe available on some SDKs revisit WM_GETMINMAXINFO
|
||||
QDebug operator<<(QDebug d, const MINMAXINFO &i)
|
||||
{
|
||||
QDebugStateSaver saver(d);
|
||||
d.nospace();
|
||||
d << "MINMAXINFO maxSize=" << i.ptMaxSize.x << ','
|
||||
<< i.ptMaxSize.y << " maxpos=" << i.ptMaxPosition.x
|
||||
<< ',' << i.ptMaxPosition.y << " mintrack="
|
||||
<< i.ptMinTrackSize.x << ',' << i.ptMinTrackSize.y
|
||||
<< " maxtrack=" << i.ptMaxTrackSize.x << ',' << i.ptMaxTrackSize.y;
|
||||
return d;
|
||||
}
|
||||
#endif // !Q_OS_WINCE
|
||||
|
||||
static inline QSize qSizeOfRect(const RECT &rect)
|
||||
{
|
||||
return QSize(rect.right -rect.left, rect.bottom - rect.top);
|
||||
@ -138,6 +124,7 @@ static inline RECT RECTfromQRect(const QRect &rect)
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
QDebug operator<<(QDebug d, const RECT &r)
|
||||
{
|
||||
QDebugStateSaver saver(d);
|
||||
@ -147,7 +134,13 @@ QDebug operator<<(QDebug d, const RECT &r)
|
||||
return d;
|
||||
}
|
||||
|
||||
#ifndef Q_OS_WINCE // maybe available on some SDKs revisit WM_NCCALCSIZE
|
||||
QDebug operator<<(QDebug d, const POINT &p)
|
||||
{
|
||||
d << p.x << ',' << p.y;
|
||||
return d;
|
||||
}
|
||||
|
||||
# ifndef Q_OS_WINCE
|
||||
QDebug operator<<(QDebug d, const NCCALCSIZE_PARAMS &p)
|
||||
{
|
||||
QDebugStateSaver saver(d);
|
||||
@ -156,7 +149,30 @@ QDebug operator<<(QDebug d, const NCCALCSIZE_PARAMS &p)
|
||||
<< ' ' << qrectFromRECT(p.rgrc[1]) << ' ' << qrectFromRECT(p.rgrc[2]);
|
||||
return d;
|
||||
}
|
||||
#endif // !Q_OS_WINCE
|
||||
|
||||
QDebug operator<<(QDebug d, const MINMAXINFO &i)
|
||||
{
|
||||
QDebugStateSaver saver(d);
|
||||
d.nospace();
|
||||
d << "MINMAXINFO maxSize=" << i.ptMaxSize.x << ','
|
||||
<< i.ptMaxSize.y << " maxpos=" << i.ptMaxPosition.x
|
||||
<< ',' << i.ptMaxPosition.y << " mintrack="
|
||||
<< i.ptMinTrackSize.x << ',' << i.ptMinTrackSize.y
|
||||
<< " maxtrack=" << i.ptMaxTrackSize.x << ',' << i.ptMaxTrackSize.y;
|
||||
return d;
|
||||
}
|
||||
|
||||
QDebug operator<<(QDebug d, const WINDOWPLACEMENT &wp)
|
||||
{
|
||||
QDebugStateSaver saver(d);
|
||||
d.nospace();
|
||||
d << "WINDOWPLACEMENT(flags=0x" << hex << wp.flags << dec << ", showCmd="
|
||||
<< wp.showCmd << ", ptMinPosition=" << wp.ptMinPosition << ", ptMaxPosition=" << wp.ptMaxPosition
|
||||
<< ", rcNormalPosition=" << wp.rcNormalPosition;
|
||||
return d;
|
||||
}
|
||||
# endif // !Q_OS_WINCE
|
||||
#endif // !QT_NO_DEBUG_STREAM
|
||||
|
||||
// QTBUG-43872, for windows that do not have WS_EX_TOOLWINDOW set, WINDOWPLACEMENT
|
||||
// is in workspace/available area coordinates.
|
||||
|
@ -290,12 +290,15 @@ private:
|
||||
void *m_surface;
|
||||
};
|
||||
|
||||
// Debug
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
QDebug operator<<(QDebug d, const RECT &r);
|
||||
#ifndef Q_OS_WINCE // maybe available on some SDKs revisit WM_GETMINMAXINFO/WM_NCCALCSIZE
|
||||
QDebug operator<<(QDebug d, const POINT &);
|
||||
# ifndef Q_OS_WINCE
|
||||
QDebug operator<<(QDebug d, const MINMAXINFO &i);
|
||||
QDebug operator<<(QDebug d, const NCCALCSIZE_PARAMS &p);
|
||||
#endif
|
||||
QDebug operator<<(QDebug d, const WINDOWPLACEMENT &);
|
||||
# endif // !Q_OS_WINCE
|
||||
#endif // !QT_NO_DEBUG_STREAM
|
||||
|
||||
// ---------- QWindowsGeometryHint inline functions.
|
||||
QPoint QWindowsGeometryHint::mapToGlobal(HWND hwnd, const QPoint &qp)
|
||||
|
Loading…
Reference in New Issue
Block a user