Windows QPA: Fix clang warnings about repetitive type names
Fix warning like: warning: use auto when initializing with new/reinterpret_cast to avoid duplicating the type name [modernize-use-auto] Change-Id: Ieb7f052919173f6923e68de9f9e849dee45e36e7 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
parent
7f7eaf1cad
commit
38f1a36f60
|
|
@ -91,7 +91,7 @@ static QVersionNumber systemD2DVersion()
|
|||
|
||||
if (VerQueryValue(info.constData(), __TEXT("\\"),
|
||||
reinterpret_cast<void **>(&fi), &size) && size) {
|
||||
const VS_FIXEDFILEINFO *verInfo = reinterpret_cast<const VS_FIXEDFILEINFO *>(fi);
|
||||
const auto *verInfo = reinterpret_cast<const VS_FIXEDFILEINFO *>(fi);
|
||||
return QVersionNumber{HIWORD(verInfo->dwFileVersionMS), LOWORD(verInfo->dwFileVersionMS),
|
||||
HIWORD(verInfo->dwFileVersionLS), LOWORD(verInfo->dwFileVersionLS)};
|
||||
}
|
||||
|
|
@ -140,7 +140,7 @@ QWindowsDirect2DIntegration *QWindowsDirect2DIntegration::create(const QStringLi
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
QWindowsDirect2DIntegration *integration = new QWindowsDirect2DIntegration(paramList);
|
||||
auto *integration = new QWindowsDirect2DIntegration(paramList);
|
||||
|
||||
if (!integration->init()) {
|
||||
delete integration;
|
||||
|
|
|
|||
|
|
@ -253,7 +253,7 @@ struct D2DVectorPathCache {
|
|||
|
||||
static void cleanup_func(QPaintEngineEx *engine, void *data) {
|
||||
Q_UNUSED(engine);
|
||||
D2DVectorPathCache *e = static_cast<D2DVectorPathCache *>(data);
|
||||
auto *e = static_cast<D2DVectorPathCache *>(data);
|
||||
delete e;
|
||||
}
|
||||
};
|
||||
|
|
@ -689,7 +689,7 @@ public:
|
|||
*needsEmulation = true;
|
||||
} else {
|
||||
ComPtr<ID2D1LinearGradientBrush> linear;
|
||||
const QLinearGradient *qlinear = static_cast<const QLinearGradient *>(newBrush.gradient());
|
||||
const auto *qlinear = static_cast<const QLinearGradient *>(newBrush.gradient());
|
||||
|
||||
D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES linearGradientBrushProperties;
|
||||
ComPtr<ID2D1GradientStopCollection> gradientStopCollection;
|
||||
|
|
@ -727,7 +727,7 @@ public:
|
|||
*needsEmulation = true;
|
||||
} else {
|
||||
ComPtr<ID2D1RadialGradientBrush> radial;
|
||||
const QRadialGradient *qradial = static_cast<const QRadialGradient *>(newBrush.gradient());
|
||||
const auto *qradial = static_cast<const QRadialGradient *>(newBrush.gradient());
|
||||
|
||||
D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES radialGradientBrushProperties;
|
||||
ComPtr<ID2D1GradientStopCollection> gradientStopCollection;
|
||||
|
|
@ -807,7 +807,7 @@ public:
|
|||
: nullptr;
|
||||
|
||||
if (cacheEntry) {
|
||||
D2DVectorPathCache *e = static_cast<D2DVectorPathCache *>(cacheEntry->data);
|
||||
auto *e = static_cast<D2DVectorPathCache *>(cacheEntry->data);
|
||||
if (alias && e->aliased)
|
||||
return e->aliased;
|
||||
else if (!alias && e->antiAliased)
|
||||
|
|
@ -885,7 +885,7 @@ public:
|
|||
if (!cacheEntry)
|
||||
cacheEntry = path.addCacheData(q, new D2DVectorPathCache, D2DVectorPathCache::cleanup_func);
|
||||
|
||||
D2DVectorPathCache *e = static_cast<D2DVectorPathCache *>(cacheEntry->data);
|
||||
auto *e = static_cast<D2DVectorPathCache *>(cacheEntry->data);
|
||||
if (alias)
|
||||
e->aliased = geometry;
|
||||
else
|
||||
|
|
@ -1481,7 +1481,7 @@ void QWindowsDirect2DPaintEngine::drawPixmap(const QRectF &r,
|
|||
return;
|
||||
}
|
||||
|
||||
QWindowsDirect2DPlatformPixmap *pp = static_cast<QWindowsDirect2DPlatformPixmap *>(pm.handle());
|
||||
auto *pp = static_cast<QWindowsDirect2DPlatformPixmap *>(pm.handle());
|
||||
QWindowsDirect2DBitmap *bitmap = pp->bitmap();
|
||||
|
||||
ensurePen();
|
||||
|
|
@ -1593,7 +1593,7 @@ void QWindowsDirect2DPaintEngine::drawTextItem(const QPointF &p, const QTextItem
|
|||
Q_D(QWindowsDirect2DPaintEngine);
|
||||
D2D_TAG(D2DDebugDrawTextItemTag);
|
||||
|
||||
const QTextItemInt &ti = static_cast<const QTextItemInt &>(textItem);
|
||||
const auto &ti = static_cast<const QTextItemInt &>(textItem);
|
||||
if (ti.glyphs.numGlyphs == 0)
|
||||
return;
|
||||
|
||||
|
|
@ -1686,7 +1686,7 @@ void QWindowsDirect2DPaintEngine::rasterFill(const QVectorPath &path, const QBru
|
|||
p.setBrush(state()->brush);
|
||||
p.setPen(state()->pen);
|
||||
|
||||
QPaintEngineEx *extended = static_cast<QPaintEngineEx *>(engine);
|
||||
auto *extended = static_cast<QPaintEngineEx *>(engine);
|
||||
for (const QPainterClipInfo &info : qAsConst(state()->clipInfo)) {
|
||||
extended->state()->matrix = info.matrix;
|
||||
extended->transformChanged();
|
||||
|
|
|
|||
|
|
@ -310,7 +310,7 @@ void QWindowsDirect2DWindow::setupBitmap()
|
|||
QWindowsDirect2DPaintEngine::Flags flags = QWindowsDirect2DPaintEngine::NoFlag;
|
||||
if (!m_directRendering)
|
||||
flags |= QWindowsDirect2DPaintEngine::TranslucentTopLevelWindow;
|
||||
QWindowsDirect2DPlatformPixmap *pp = new QWindowsDirect2DPlatformPixmap(QPlatformPixmap::PixmapType,
|
||||
auto *pp = new QWindowsDirect2DPlatformPixmap(QPlatformPixmap::PixmapType,
|
||||
flags,
|
||||
m_bitmap.data());
|
||||
m_pixmap.reset(new QPixmap(pp));
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ bool qt_windowsIsTabletMode(HWND hwnd)
|
|||
const wchar_t uiViewSettingsId[] = L"Windows.UI.ViewManagement.UIViewSettings";
|
||||
HSTRING_HEADER uiViewSettingsIdRefHeader;
|
||||
HSTRING uiViewSettingsIdHs = nullptr;
|
||||
const UINT32 uiViewSettingsIdLen = UINT32(sizeof(uiViewSettingsId) / sizeof(uiViewSettingsId[0]) - 1);
|
||||
const auto uiViewSettingsIdLen = UINT32(sizeof(uiViewSettingsId) / sizeof(uiViewSettingsId[0]) - 1);
|
||||
if (FAILED(baseComDll.windowsCreateStringReference(uiViewSettingsId, uiViewSettingsIdLen, &uiViewSettingsIdRefHeader, &uiViewSettingsIdHs)))
|
||||
return false;
|
||||
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ void QWindowsBackingStore::resize(const QSize &size, const QRegion ®ion)
|
|||
format = qt_maybeAlphaVersionWithSameDepth(format);
|
||||
|
||||
QWindowsNativeImage *oldwni = m_image.data();
|
||||
QWindowsNativeImage *newwni = new QWindowsNativeImage(size.width(), size.height(), format);
|
||||
auto *newwni = new QWindowsNativeImage(size.width(), size.height(), format);
|
||||
|
||||
if (oldwni && !region.isEmpty()) {
|
||||
const QImage &oldimg(oldwni->image());
|
||||
|
|
|
|||
|
|
@ -133,8 +133,8 @@ static inline bool useRTL_Extensions()
|
|||
#if QT_CONFIG(sessionmanager)
|
||||
static inline QWindowsSessionManager *platformSessionManager()
|
||||
{
|
||||
QGuiApplicationPrivate *guiPrivate = static_cast<QGuiApplicationPrivate*>(QObjectPrivate::get(qApp));
|
||||
QSessionManagerPrivate *managerPrivate = static_cast<QSessionManagerPrivate*>(QObjectPrivate::get(guiPrivate->session_manager));
|
||||
auto *guiPrivate = static_cast<QGuiApplicationPrivate*>(QObjectPrivate::get(qApp));
|
||||
auto *managerPrivate = static_cast<QSessionManagerPrivate*>(QObjectPrivate::get(guiPrivate->session_manager));
|
||||
return static_cast<QWindowsSessionManager *>(managerPrivate->platformSessionManager);
|
||||
}
|
||||
|
||||
|
|
@ -545,7 +545,7 @@ QString QWindowsContext::registerWindowClass(QString cname,
|
|||
// add an instance-specific ID, the address of the window proc.
|
||||
static int classExists = -1;
|
||||
|
||||
const HINSTANCE appInstance = static_cast<HINSTANCE>(GetModuleHandle(nullptr));
|
||||
const auto appInstance = static_cast<HINSTANCE>(GetModuleHandle(nullptr));
|
||||
if (classExists == -1) {
|
||||
WNDCLASS wcinfo;
|
||||
classExists = GetClassInfo(appInstance, reinterpret_cast<LPCWSTR>(cname.utf16()), &wcinfo);
|
||||
|
|
@ -598,7 +598,7 @@ QString QWindowsContext::registerWindowClass(QString cname,
|
|||
|
||||
void QWindowsContext::unregisterWindowClasses()
|
||||
{
|
||||
const HINSTANCE appInstance = static_cast<HINSTANCE>(GetModuleHandle(nullptr));
|
||||
const auto appInstance = static_cast<HINSTANCE>(GetModuleHandle(nullptr));
|
||||
|
||||
for (const QString &name : qAsConst(d->m_registeredWindowClassNames)) {
|
||||
if (!UnregisterClass(reinterpret_cast<LPCWSTR>(name.utf16()), appInstance) && QWindowsContext::verbose)
|
||||
|
|
@ -1351,7 +1351,7 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
|
|||
sessionManager->blocksInteraction();
|
||||
sessionManager->clearCancellation();
|
||||
|
||||
QGuiApplicationPrivate *qGuiAppPriv = static_cast<QGuiApplicationPrivate*>(QObjectPrivate::get(qApp));
|
||||
auto *qGuiAppPriv = static_cast<QGuiApplicationPrivate*>(QObjectPrivate::get(qApp));
|
||||
qGuiAppPriv->commitData();
|
||||
|
||||
if (lParam & ENDSESSION_LOGOFF)
|
||||
|
|
@ -1369,7 +1369,7 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
|
|||
|
||||
// we receive the message for each toplevel window included internal hidden ones,
|
||||
// but the aboutToQuit signal should be emitted only once.
|
||||
QGuiApplicationPrivate *qGuiAppPriv = static_cast<QGuiApplicationPrivate*>(QObjectPrivate::get(qApp));
|
||||
auto *qGuiAppPriv = static_cast<QGuiApplicationPrivate*>(QObjectPrivate::get(qApp));
|
||||
if (endsession && !qGuiAppPriv->aboutToQuitEmitted) {
|
||||
qGuiAppPriv->aboutToQuitEmitted = true;
|
||||
int index = QGuiApplication::staticMetaObject.indexOfSignal("aboutToQuit()");
|
||||
|
|
|
|||
|
|
@ -752,7 +752,7 @@ QPixmap QWindowsCursor::dragDefaultCursor(Qt::DropAction action) const
|
|||
&& GetObject(iconInfo.hbmColor, sizeof(BITMAP), &bmColor)
|
||||
&& bmColor.bmWidth == bmColor.bmWidthBytes / 4) {
|
||||
const int colorBitsLength = bmColor.bmHeight * bmColor.bmWidthBytes;
|
||||
uchar *colorBits = new uchar[colorBitsLength];
|
||||
auto *colorBits = new uchar[colorBitsLength];
|
||||
GetBitmapBits(iconInfo.hbmColor, colorBitsLength, colorBits);
|
||||
const QImage colorImage(colorBits, bmColor.bmWidth, bmColor.bmHeight,
|
||||
bmColor.bmWidthBytes, QImage::Format_ARGB32);
|
||||
|
|
|
|||
|
|
@ -356,7 +356,7 @@ struct FindDialogContext
|
|||
|
||||
static BOOL QT_WIN_CALLBACK findDialogEnumWindowsProc(HWND hwnd, LPARAM lParam)
|
||||
{
|
||||
FindDialogContext *context = reinterpret_cast<FindDialogContext *>(lParam);
|
||||
auto *context = reinterpret_cast<FindDialogContext *>(lParam);
|
||||
DWORD winPid = 0;
|
||||
GetWindowThreadProcessId(hwnd, &winPid);
|
||||
if (winPid != context->processId)
|
||||
|
|
@ -531,7 +531,7 @@ private:
|
|||
IFileDialogEvents *QWindowsNativeFileDialogEventHandler::create(QWindowsNativeFileDialogBase *nativeFileDialog)
|
||||
{
|
||||
IFileDialogEvents *result;
|
||||
QWindowsNativeFileDialogEventHandler *eventHandler = new QWindowsNativeFileDialogEventHandler(nativeFileDialog);
|
||||
auto *eventHandler = new QWindowsNativeFileDialogEventHandler(nativeFileDialog);
|
||||
if (FAILED(eventHandler->QueryInterface(IID_IFileDialogEvents, reinterpret_cast<void **>(&result)))) {
|
||||
qErrnoWarning("Unable to obtain IFileDialogEvents");
|
||||
return nullptr;
|
||||
|
|
@ -1112,7 +1112,7 @@ void QWindowsNativeFileDialogBase::setDefaultSuffixSys(const QString &s)
|
|||
// If this parameter is non-empty, it will be appended by the dialog for the 'Any files'
|
||||
// filter ('*'). If this parameter is non-empty and the current filter has a suffix,
|
||||
// the dialog will append the filter's suffix.
|
||||
wchar_t *wSuffix = const_cast<wchar_t *>(reinterpret_cast<const wchar_t *>(s.utf16()));
|
||||
auto *wSuffix = const_cast<wchar_t *>(reinterpret_cast<const wchar_t *>(s.utf16()));
|
||||
m_fileDialog->SetDefaultExtension(wSuffix);
|
||||
}
|
||||
|
||||
|
|
@ -1125,7 +1125,7 @@ static inline IFileDialog2 *getFileDialog2(IFileDialog *fileDialog)
|
|||
|
||||
void QWindowsNativeFileDialogBase::setLabelText(QFileDialogOptions::DialogLabel l, const QString &text)
|
||||
{
|
||||
wchar_t *wText = const_cast<wchar_t *>(reinterpret_cast<const wchar_t *>(text.utf16()));
|
||||
auto *wText = const_cast<wchar_t *>(reinterpret_cast<const wchar_t *>(text.utf16()));
|
||||
switch (l) {
|
||||
case QFileDialogOptions::FileName:
|
||||
m_fileDialog->SetFileNameLabel(wText);
|
||||
|
|
@ -1770,7 +1770,7 @@ void QWindowsXpNativeFileDialog::doExec(HWND owner)
|
|||
|
||||
static int QT_WIN_CALLBACK xpFileDialogGetExistingDirCallbackProc(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData)
|
||||
{
|
||||
QWindowsXpNativeFileDialog *dialog = reinterpret_cast<QWindowsXpNativeFileDialog *>(lpData);
|
||||
auto *dialog = reinterpret_cast<QWindowsXpNativeFileDialog *>(lpData);
|
||||
return dialog->existingDirCallback(hwnd, uMsg, lParam);
|
||||
}
|
||||
|
||||
|
|
@ -1843,7 +1843,7 @@ void QWindowsXpNativeFileDialog::populateOpenFileName(OPENFILENAME *ofn, HWND ow
|
|||
const QList<FilterSpec> specs =
|
||||
filterSpecs(m_options->nameFilters(), m_options->options() & QFileDialogOptions::HideNameFilterDetails, &totalStringLength);
|
||||
const int size = specs.size();
|
||||
wchar_t *ptr = new wchar_t[totalStringLength + 2 * size + 1];
|
||||
auto *ptr = new wchar_t[totalStringLength + 2 * size + 1];
|
||||
ofn->lpstrFilter = ptr;
|
||||
for (const FilterSpec &spec : specs) {
|
||||
ptr += spec.description.toWCharArray(ptr);
|
||||
|
|
|
|||
|
|
@ -627,7 +627,7 @@ QWindowsOleDropTarget::Drop(LPDATAOBJECT pDataObj, DWORD grfKeyState,
|
|||
m_chosenEffect = DROPEFFECT_COPY;
|
||||
HGLOBAL hData = GlobalAlloc(0, sizeof(DWORD));
|
||||
if (hData) {
|
||||
DWORD *moveEffect = reinterpret_cast<DWORD *>(GlobalLock(hData));
|
||||
auto *moveEffect = reinterpret_cast<DWORD *>(GlobalLock(hData));
|
||||
*moveEffect = DROPEFFECT_MOVE;
|
||||
GlobalUnlock(hData);
|
||||
STGMEDIUM medium;
|
||||
|
|
@ -704,9 +704,9 @@ Qt::DropAction QWindowsDrag::drag(QDrag *drag)
|
|||
|
||||
DWORD resultEffect;
|
||||
QWindowsDrag::m_canceled = false;
|
||||
QWindowsOleDropSource *windowDropSource = new QWindowsOleDropSource(this);
|
||||
auto *windowDropSource = new QWindowsOleDropSource(this);
|
||||
windowDropSource->createCursors();
|
||||
QWindowsDropDataObject *dropDataObject = new QWindowsDropDataObject(dropData);
|
||||
auto *dropDataObject = new QWindowsDropDataObject(dropData);
|
||||
const Qt::DropActions possibleActions = drag->supportedActions();
|
||||
const DWORD allowedEffects = translateToWinDragEffects(possibleActions);
|
||||
qCDebug(lcQpaMime) << '>' << __FUNCTION__ << "possible Actions=0x"
|
||||
|
|
|
|||
|
|
@ -469,10 +469,10 @@ bool QWindowsEGLContext::makeCurrent(QPlatformSurface *surface)
|
|||
|
||||
QWindowsEGLStaticContext::libEGL.eglBindAPI(m_api);
|
||||
|
||||
QWindowsWindow *window = static_cast<QWindowsWindow *>(surface);
|
||||
auto *window = static_cast<QWindowsWindow *>(surface);
|
||||
window->aboutToMakeCurrent();
|
||||
int err = 0;
|
||||
EGLSurface eglSurface = static_cast<EGLSurface>(window->surface(m_eglConfig, &err));
|
||||
auto eglSurface = static_cast<EGLSurface>(window->surface(m_eglConfig, &err));
|
||||
if (eglSurface == EGL_NO_SURFACE) {
|
||||
if (err == EGL_CONTEXT_LOST) {
|
||||
m_eglContext = EGL_NO_CONTEXT;
|
||||
|
|
@ -531,9 +531,9 @@ void QWindowsEGLContext::doneCurrent()
|
|||
void QWindowsEGLContext::swapBuffers(QPlatformSurface *surface)
|
||||
{
|
||||
QWindowsEGLStaticContext::libEGL.eglBindAPI(m_api);
|
||||
QWindowsWindow *window = static_cast<QWindowsWindow *>(surface);
|
||||
auto *window = static_cast<QWindowsWindow *>(surface);
|
||||
int err = 0;
|
||||
EGLSurface eglSurface = static_cast<EGLSurface>(window->surface(m_eglConfig, &err));
|
||||
auto eglSurface = static_cast<EGLSurface>(window->surface(m_eglConfig, &err));
|
||||
if (eglSurface == EGL_NO_SURFACE) {
|
||||
if (err == EGL_CONTEXT_LOST) {
|
||||
m_eglContext = EGL_NO_CONTEXT;
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ void *QWindowsGdiNativeInterface::nativeResourceForBackingStore(const QByteArray
|
|||
qWarning("%s: '%s' requested for null backingstore or backingstore without handle.", __FUNCTION__, resource.constData());
|
||||
return nullptr;
|
||||
}
|
||||
QWindowsBackingStore *wbs = static_cast<QWindowsBackingStore *>(bs->handle());
|
||||
auto *wbs = static_cast<QWindowsBackingStore *>(bs->handle());
|
||||
if (resource == "getDC")
|
||||
return wbs->getDC();
|
||||
qWarning("%s: Invalid key '%s' requested.", __FUNCTION__, resource.constData());
|
||||
|
|
|
|||
|
|
@ -1009,7 +1009,7 @@ QOpenGLStaticContext *QOpenGLStaticContext::create(bool softwareRendering)
|
|||
QScopedPointer<QOpenGLTemporaryContext> temporaryContext;
|
||||
if (!QOpenGLStaticContext::opengl32.wglGetCurrentContext())
|
||||
temporaryContext.reset(new QOpenGLTemporaryContext);
|
||||
QOpenGLStaticContext *result = new QOpenGLStaticContext;
|
||||
auto *result = new QOpenGLStaticContext;
|
||||
qCDebug(lcQpaGl) << __FUNCTION__ << *result;
|
||||
return result;
|
||||
}
|
||||
|
|
@ -1051,7 +1051,7 @@ QWindowsGLContext::QWindowsGLContext(QOpenGLStaticContext *staticContext,
|
|||
qWarning("QWindowsGLContext: Requires a QWGLNativeContext");
|
||||
return;
|
||||
}
|
||||
QWGLNativeContext handle = nativeHandle.value<QWGLNativeContext>();
|
||||
auto handle = nativeHandle.value<QWGLNativeContext>();
|
||||
HGLRC wglcontext = handle.context();
|
||||
HWND wnd = handle.window();
|
||||
if (!wglcontext || !wnd) {
|
||||
|
|
@ -1233,7 +1233,7 @@ bool QWindowsGLContext::updateObtainedParams(HDC hdc, int *obtainedSwapInterval)
|
|||
hasRobustness = exts && strstr(exts, "GL_ARB_robustness");
|
||||
} else {
|
||||
typedef const GLubyte * (APIENTRY *glGetStringi_t)(GLenum, GLuint);
|
||||
glGetStringi_t glGetStringi = reinterpret_cast<glGetStringi_t>(
|
||||
auto glGetStringi = reinterpret_cast<glGetStringi_t>(
|
||||
reinterpret_cast<QFunctionPointer>(QOpenGLStaticContext::opengl32.wglGetProcAddress("glGetStringi")));
|
||||
if (glGetStringi) {
|
||||
GLint n = 0;
|
||||
|
|
@ -1305,7 +1305,7 @@ bool QWindowsGLContext::makeCurrent(QPlatformSurface *surface)
|
|||
Q_ASSERT(surface->surface()->supportsOpenGL());
|
||||
|
||||
// Do we already have a DC entry for that window?
|
||||
QWindowsWindow *window = static_cast<QWindowsWindow *>(surface);
|
||||
auto *window = static_cast<QWindowsWindow *>(surface);
|
||||
window->aboutToMakeCurrent();
|
||||
const HWND hwnd = window->handle();
|
||||
if (const QOpenGLContextData *contextData = findByHWND(m_windowContexts, hwnd)) {
|
||||
|
|
@ -1374,7 +1374,7 @@ QFunctionPointer QWindowsGLContext::getProcAddress(const char *procName)
|
|||
// Even though we use QFunctionPointer, it does not mean the function can be called.
|
||||
// It will need to be cast to the proper function type with the correct calling
|
||||
// convention. QFunctionPointer is nothing more than a glorified void* here.
|
||||
QFunctionPointer procAddress = reinterpret_cast<QFunctionPointer>(QOpenGLStaticContext::opengl32.wglGetProcAddress(procName));
|
||||
auto procAddress = reinterpret_cast<QFunctionPointer>(QOpenGLStaticContext::opengl32.wglGetProcAddress(procName));
|
||||
|
||||
// We support AllGLFunctionsQueryable, which means this function must be able to
|
||||
// return a function pointer even for functions that are in GL.h and exported
|
||||
|
|
|
|||
|
|
@ -717,7 +717,7 @@ int QWindowsInputContext::reconvertString(RECONVERTSTRING *reconv)
|
|||
reconv->dwCompStrOffset = DWORD(startPos) * sizeof(ushort); // byte count.
|
||||
reconv->dwTargetStrLen = reconv->dwCompStrLen;
|
||||
reconv->dwTargetStrOffset = reconv->dwCompStrOffset;
|
||||
ushort *pastReconv = reinterpret_cast<ushort *>(reconv + 1);
|
||||
auto *pastReconv = reinterpret_cast<ushort *>(reconv + 1);
|
||||
std::copy(surroundingText.utf16(), surroundingText.utf16() + surroundingText.size(),
|
||||
QT_MAKE_UNCHECKED_ARRAY_ITERATOR(pastReconv));
|
||||
return memSize;
|
||||
|
|
|
|||
|
|
@ -324,7 +324,7 @@ bool QWindowsIntegration::hasCapability(QPlatformIntegration::Capability cap) co
|
|||
QPlatformWindow *QWindowsIntegration::createPlatformWindow(QWindow *window) const
|
||||
{
|
||||
if (window->type() == Qt::Desktop) {
|
||||
QWindowsDesktopWindow *result = new QWindowsDesktopWindow(window);
|
||||
auto *result = new QWindowsDesktopWindow(window);
|
||||
qCDebug(lcQpaWindows) << "Desktop window:" << window
|
||||
<< Qt::showbase << Qt::hex << result->winId() << Qt::noshowbase << Qt::dec << result->geometry();
|
||||
return result;
|
||||
|
|
@ -371,7 +371,7 @@ QPlatformWindow *QWindowsIntegration::createForeignWindow(QWindow *window, WId n
|
|||
qWarning("Windows QPA: Invalid foreign window ID %p.", hwnd);
|
||||
return nullptr;
|
||||
}
|
||||
QWindowsForeignWindow *result = new QWindowsForeignWindow(window, hwnd);
|
||||
auto *result = new QWindowsForeignWindow(window, hwnd);
|
||||
const QRect obtainedGeometry = result->geometry();
|
||||
QScreen *screen = nullptr;
|
||||
if (const QPlatformScreen *pScreen = result->screenForGeometry(obtainedGeometry))
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ QWindowsKeyMapper::QWindowsKeyMapper()
|
|||
: m_useRTLExtensions(false), m_keyGrabber(nullptr)
|
||||
{
|
||||
memset(keyLayout, 0, sizeof(keyLayout));
|
||||
QGuiApplication *app = static_cast<QGuiApplication *>(QGuiApplication::instance());
|
||||
auto *app = static_cast<QGuiApplication *>(QGuiApplication::instance());
|
||||
QObject::connect(app, &QGuiApplication::applicationStateChanged,
|
||||
app, clearKeyRecorderOnApplicationInActive);
|
||||
changeKeyboard();
|
||||
|
|
@ -950,7 +950,7 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, MSG msg,
|
|||
const UINT msgType = msg.message;
|
||||
|
||||
const quint32 scancode = (msg.lParam >> 16) & scancodeBitmask;
|
||||
quint32 vk_key = quint32(msg.wParam);
|
||||
auto vk_key = quint32(msg.wParam);
|
||||
quint32 nModifiers = 0;
|
||||
|
||||
QWindow *receiver = m_keyGrabber ? m_keyGrabber : window;
|
||||
|
|
@ -1182,7 +1182,7 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, MSG msg,
|
|||
// results, if we map this virtual key-code directly (for eg '?' US layouts). So try
|
||||
// to find the correct key using the current message parameters & keyboard state.
|
||||
if (uch.isNull() && msgType == WM_IME_KEYDOWN) {
|
||||
const QWindowsInputContext *windowsInputContext =
|
||||
const auto *windowsInputContext =
|
||||
qobject_cast<const QWindowsInputContext *>(QWindowsIntegration::instance()->inputContext());
|
||||
if (!(windowsInputContext && windowsInputContext->isComposing()))
|
||||
vk_key = ImmGetVirtualKey(reinterpret_cast<HWND>(window->winId()));
|
||||
|
|
|
|||
|
|
@ -518,7 +518,7 @@ QWindowsMenu::~QWindowsMenu()
|
|||
void QWindowsMenu::insertMenuItem(QPlatformMenuItem *menuItemIn, QPlatformMenuItem *before)
|
||||
{
|
||||
qCDebug(lcQpaMenus) << __FUNCTION__ << '(' << menuItemIn << ", before=" << before << ')' << this;
|
||||
QWindowsMenuItem *menuItem = static_cast<QWindowsMenuItem *>(menuItemIn);
|
||||
auto *menuItem = static_cast<QWindowsMenuItem *>(menuItemIn);
|
||||
const int index = insertBefore(&m_menuItems, menuItemIn, before);
|
||||
const bool append = index == m_menuItems.size() - 1;
|
||||
menuItem->insertIntoMenu(this, append, index);
|
||||
|
|
@ -689,7 +689,7 @@ void QWindowsPopupMenu::showPopup(const QWindow *parentWindow, const QRect &targ
|
|||
const QPlatformMenuItem *item)
|
||||
{
|
||||
qCDebug(lcQpaMenus) << __FUNCTION__ << '>' << this << parentWindow << targetRect << item;
|
||||
const QWindowsBaseWindow *window = static_cast<const QWindowsBaseWindow *>(parentWindow->handle());
|
||||
const auto *window = static_cast<const QWindowsBaseWindow *>(parentWindow->handle());
|
||||
const QPoint globalPos = window->mapToGlobal(targetRect.topLeft());
|
||||
trackPopupMenu(window->handle(), globalPos.x(), globalPos.y());
|
||||
}
|
||||
|
|
@ -756,7 +756,7 @@ QWindowsMenuBar::~QWindowsMenuBar()
|
|||
void QWindowsMenuBar::insertMenu(QPlatformMenu *menuIn, QPlatformMenu *before)
|
||||
{
|
||||
qCDebug(lcQpaMenus) << __FUNCTION__ << menuIn << "before=" << before;
|
||||
QWindowsMenu *menu = static_cast<QWindowsMenu *>(menuIn);
|
||||
auto *menu = static_cast<QWindowsMenu *>(menuIn);
|
||||
const int index = insertBefore(&m_menus, menuIn, before);
|
||||
menu->insertIntoMenuBar(this, index == m_menus.size() - 1, index);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ static bool qt_write_dibv5(QDataStream &s, QImage image)
|
|||
if (image.format() != QImage::Format_ARGB32)
|
||||
image = image.convertToFormat(QImage::Format_ARGB32);
|
||||
|
||||
uchar *buf = new uchar[bpl_bmp];
|
||||
auto *buf = new uchar[bpl_bmp];
|
||||
|
||||
memset(buf, 0, size_t(bpl_bmp));
|
||||
for (int y=image.height()-1; y>=0; y--) {
|
||||
|
|
@ -264,7 +264,7 @@ static bool qt_read_dibv5(QDataStream &s, QImage &image)
|
|||
const int bpl = image.bytesPerLine();
|
||||
uchar *data = image.bits();
|
||||
|
||||
uchar *buf24 = new uchar[bpl];
|
||||
auto *buf24 = new uchar[bpl];
|
||||
const int bpl24 = ((w * nbits + 31) / 32) * 4;
|
||||
|
||||
while (--h >= 0) {
|
||||
|
|
@ -286,7 +286,7 @@ static bool qt_read_dibv5(QDataStream &s, QImage &image)
|
|||
|
||||
if (bi.bV5Height < 0) {
|
||||
// Flip the image
|
||||
uchar *buf = new uchar[bpl];
|
||||
auto *buf = new uchar[bpl];
|
||||
h = -bi.bV5Height;
|
||||
for (int y = 0; y < h/2; ++y) {
|
||||
memcpy(buf, data + y * bpl, size_t(bpl));
|
||||
|
|
@ -772,16 +772,16 @@ bool QWindowsMimeURI::convertFromMime(const FORMATETC &formatetc, const QMimeDat
|
|||
}
|
||||
|
||||
QByteArray result(size, '\0');
|
||||
DROPFILES* d = reinterpret_cast<DROPFILES *>(result.data());
|
||||
auto* d = reinterpret_cast<DROPFILES *>(result.data());
|
||||
d->pFiles = sizeof(DROPFILES);
|
||||
GetCursorPos(&d->pt); // try
|
||||
d->fNC = true;
|
||||
char *files = (reinterpret_cast<char*>(d)) + d->pFiles;
|
||||
|
||||
d->fWide = true;
|
||||
wchar_t *f = reinterpret_cast<wchar_t *>(files);
|
||||
auto *f = reinterpret_cast<wchar_t *>(files);
|
||||
for (int i=0; i<fileNames.size(); i++) {
|
||||
const size_t l = size_t(fileNames.at(i).length());
|
||||
const auto l = size_t(fileNames.at(i).length());
|
||||
memcpy(f, fileNames.at(i).utf16(), l * sizeof(ushort));
|
||||
f += l;
|
||||
*f++ = 0;
|
||||
|
|
@ -852,9 +852,9 @@ QVariant QWindowsMimeURI::convertToMime(const QString &mimeType, LPDATAOBJECT pD
|
|||
if (data.isEmpty())
|
||||
return QVariant();
|
||||
|
||||
const DROPFILES *hdrop = reinterpret_cast<const DROPFILES *>(data.constData());
|
||||
const auto *hdrop = reinterpret_cast<const DROPFILES *>(data.constData());
|
||||
if (hdrop->fWide) {
|
||||
const wchar_t *filesw = reinterpret_cast<const wchar_t *>(data.constData() + hdrop->pFiles);
|
||||
const auto *filesw = reinterpret_cast<const wchar_t *>(data.constData() + hdrop->pFiles);
|
||||
int i = 0;
|
||||
while (filesw[i]) {
|
||||
QString fileurl = QString::fromWCharArray(filesw + i);
|
||||
|
|
@ -1055,7 +1055,7 @@ QVector<FORMATETC> QWindowsMimeImage::formatsForMime(const QString &mimeType, co
|
|||
QVector<FORMATETC> formatetcs;
|
||||
if (mimeData->hasImage() && mimeType == QLatin1String("application/x-qt-image")) {
|
||||
//add DIBV5 if image has alpha channel. Do not add CF_PNG here as it will confuse MS Office (QTBUG47656).
|
||||
QImage image = qvariant_cast<QImage>(mimeData->imageData());
|
||||
auto image = qvariant_cast<QImage>(mimeData->imageData());
|
||||
if (!image.isNull() && image.hasAlphaChannel())
|
||||
formatetcs += setCf(CF_DIBV5);
|
||||
formatetcs += setCf(CF_DIB);
|
||||
|
|
@ -1097,7 +1097,7 @@ bool QWindowsMimeImage::convertFromMime(const FORMATETC &formatetc, const QMimeD
|
|||
{
|
||||
int cf = getCf(formatetc);
|
||||
if ((cf == CF_DIB || cf == CF_DIBV5 || cf == int(CF_PNG)) && mimeData->hasImage()) {
|
||||
QImage img = qvariant_cast<QImage>(mimeData->imageData());
|
||||
auto img = qvariant_cast<QImage>(mimeData->imageData());
|
||||
if (img.isNull())
|
||||
return false;
|
||||
QByteArray ba;
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ static inline QTouchDevice *createTouchDevice()
|
|||
qCDebug(lcQpaEvents) << "Digitizers:" << Qt::hex << Qt::showbase << (digitizers & ~NID_READY)
|
||||
<< "Ready:" << (digitizers & NID_READY) << Qt::dec << Qt::noshowbase
|
||||
<< "Tablet PC:" << tabletPc << "Max touch points:" << maxTouchPoints;
|
||||
QTouchDevice *result = new QTouchDevice;
|
||||
auto *result = new QTouchDevice;
|
||||
result->setType(digitizers & NID_INTEGRATED_TOUCH
|
||||
? QTouchDevice::TouchScreen : QTouchDevice::TouchPad);
|
||||
QTouchDevice::Capabilities capabilities = QTouchDevice::Position | QTouchDevice::Area | QTouchDevice::NormalizedPosition;
|
||||
|
|
@ -306,7 +306,7 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd,
|
|||
// However, when tablet support is active, extraInfo is a packet serial number. This is not a problem
|
||||
// since we do not want to ignore mouse events coming from a tablet.
|
||||
// See https://msdn.microsoft.com/en-us/library/windows/desktop/ms703320.aspx
|
||||
const quint64 extraInfo = quint64(GetMessageExtraInfo());
|
||||
const auto extraInfo = quint64(GetMessageExtraInfo());
|
||||
if ((extraInfo & signatureMask) == miWpSignature) {
|
||||
if (extraInfo & 0x80) { // Bit 7 indicates touch event, else tablet pen.
|
||||
source = Qt::MouseEventSynthesizedBySystem;
|
||||
|
|
@ -370,7 +370,7 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd,
|
|||
return true;
|
||||
}
|
||||
|
||||
QWindowsWindow *platformWindow = static_cast<QWindowsWindow *>(window->handle());
|
||||
auto *platformWindow = static_cast<QWindowsWindow *>(window->handle());
|
||||
|
||||
// If the window was recently resized via mouse doubleclick on the frame or title bar,
|
||||
// we don't get WM_LBUTTONDOWN or WM_LBUTTONDBLCLK for the second click,
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ void *QWindowsNativeInterface::nativeResourceForWindow(const QByteArray &resourc
|
|||
qWarning("%s: '%s' requested for null window or window without handle.", __FUNCTION__, resource.constData());
|
||||
return nullptr;
|
||||
}
|
||||
QWindowsWindow *bw = static_cast<QWindowsWindow *>(window->handle());
|
||||
auto *bw = static_cast<QWindowsWindow *>(window->handle());
|
||||
int type = resourceType(resource);
|
||||
if (type == HandleType)
|
||||
return bw->handle();
|
||||
|
|
@ -131,7 +131,7 @@ void *QWindowsNativeInterface::nativeResourceForScreen(const QByteArray &resourc
|
|||
qWarning("%s: '%s' requested for null screen or screen without handle.", __FUNCTION__, resource.constData());
|
||||
return nullptr;
|
||||
}
|
||||
QWindowsScreen *bs = static_cast<QWindowsScreen *>(screen->handle());
|
||||
auto *bs = static_cast<QWindowsScreen *>(screen->handle());
|
||||
int type = resourceType(resource);
|
||||
if (type == HandleType)
|
||||
return bs->handle();
|
||||
|
|
@ -157,7 +157,7 @@ static const char customMarginPropertyC[] = "WindowsCustomMargins";
|
|||
|
||||
QVariant QWindowsNativeInterface::windowProperty(QPlatformWindow *window, const QString &name) const
|
||||
{
|
||||
QWindowsWindow *platformWindow = static_cast<QWindowsWindow *>(window);
|
||||
auto *platformWindow = static_cast<QWindowsWindow *>(window);
|
||||
if (name == QLatin1String(customMarginPropertyC))
|
||||
return QVariant::fromValue(platformWindow->customMargins());
|
||||
return QVariant();
|
||||
|
|
@ -171,7 +171,7 @@ QVariant QWindowsNativeInterface::windowProperty(QPlatformWindow *window, const
|
|||
|
||||
void QWindowsNativeInterface::setWindowProperty(QPlatformWindow *window, const QString &name, const QVariant &value)
|
||||
{
|
||||
QWindowsWindow *platformWindow = static_cast<QWindowsWindow *>(window);
|
||||
auto *platformWindow = static_cast<QWindowsWindow *>(window);
|
||||
if (name == QLatin1String(customMarginPropertyC))
|
||||
platformWindow->setCustomMargins(qvariant_cast<QMargins>(value));
|
||||
}
|
||||
|
|
@ -206,7 +206,7 @@ void *QWindowsNativeInterface::nativeResourceForContext(const QByteArray &resour
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
QWindowsOpenGLContext *glcontext = static_cast<QWindowsOpenGLContext *>(context->handle());
|
||||
auto *glcontext = static_cast<QWindowsOpenGLContext *>(context->handle());
|
||||
switch (resourceType(resource)) {
|
||||
case RenderingContextType: // Fall through.
|
||||
case EglContextType:
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ QWindowsOleDataObject::SetData(LPFORMATETC pFormatetc, STGMEDIUM *pMedium, BOOL
|
|||
HRESULT hr = ResultFromScode(E_NOTIMPL);
|
||||
|
||||
if (pFormatetc->cfFormat == CF_PERFORMEDDROPEFFECT && pMedium->tymed == TYMED_HGLOBAL) {
|
||||
DWORD * val = (DWORD*)GlobalLock(pMedium->hGlobal);
|
||||
auto * val = (DWORD*)GlobalLock(pMedium->hGlobal);
|
||||
performedEffect = *val;
|
||||
GlobalUnlock(pMedium->hGlobal);
|
||||
if (fRelease)
|
||||
|
|
@ -193,7 +193,7 @@ QWindowsOleDataObject::EnumFormatEtc(DWORD dwDirection, LPENUMFORMATETC FAR* ppe
|
|||
fmtetcs.append(formatetc);
|
||||
}
|
||||
|
||||
QWindowsOleEnumFmtEtc *enumFmtEtc = new QWindowsOleEnumFmtEtc(fmtetcs);
|
||||
auto *enumFmtEtc = new QWindowsOleEnumFmtEtc(fmtetcs);
|
||||
*ppenumFormatEtc = enumFmtEtc;
|
||||
if (enumFmtEtc->isNull()) {
|
||||
delete enumFmtEtc;
|
||||
|
|
@ -237,7 +237,7 @@ QWindowsOleEnumFmtEtc::QWindowsOleEnumFmtEtc(const QVector<FORMATETC> &fmtetcs)
|
|||
qCDebug(lcQpaMime) << __FUNCTION__ << fmtetcs;
|
||||
m_lpfmtetcs.reserve(fmtetcs.count());
|
||||
for (int idx = 0; idx < fmtetcs.count(); ++idx) {
|
||||
LPFORMATETC destetc = new FORMATETC();
|
||||
auto destetc = new FORMATETC();
|
||||
if (copyFormatEtc(destetc, &(fmtetcs.at(idx)))) {
|
||||
m_lpfmtetcs.append(destetc);
|
||||
} else {
|
||||
|
|
@ -255,7 +255,7 @@ QWindowsOleEnumFmtEtc::QWindowsOleEnumFmtEtc(const QVector<LPFORMATETC> &lpfmtet
|
|||
m_lpfmtetcs.reserve(lpfmtetcs.count());
|
||||
for (int idx = 0; idx < lpfmtetcs.count(); ++idx) {
|
||||
LPFORMATETC srcetc = lpfmtetcs.at(idx);
|
||||
LPFORMATETC destetc = new FORMATETC();
|
||||
auto destetc = new FORMATETC();
|
||||
if (copyFormatEtc(destetc, srcetc)) {
|
||||
m_lpfmtetcs.append(destetc);
|
||||
} else {
|
||||
|
|
@ -357,7 +357,7 @@ QWindowsOleEnumFmtEtc::Clone(LPENUMFORMATETC FAR* newEnum)
|
|||
if (newEnum == nullptr)
|
||||
return ResultFromScode(E_INVALIDARG);
|
||||
|
||||
QWindowsOleEnumFmtEtc *result = new QWindowsOleEnumFmtEtc(m_lpfmtetcs);
|
||||
auto *result = new QWindowsOleEnumFmtEtc(m_lpfmtetcs);
|
||||
result->m_nIndex = m_nIndex;
|
||||
|
||||
if (result->isNull()) {
|
||||
|
|
|
|||
|
|
@ -457,7 +457,7 @@ bool QWindowsOpenGLTester::testDesktopGL()
|
|||
|
||||
// Check the version. If we got 1.x then it's all hopeless and we can stop right here.
|
||||
typedef const GLubyte * (APIENTRY * GetString_t)(GLenum name);
|
||||
GetString_t GetString = reinterpret_cast<GetString_t>(
|
||||
auto GetString = reinterpret_cast<GetString_t>(
|
||||
reinterpret_cast<QFunctionPointer>(::GetProcAddress(lib, "glGetString")));
|
||||
if (GetString) {
|
||||
if (const char *versionStr = reinterpret_cast<const char *>(GetString(GL_VERSION))) {
|
||||
|
|
|
|||
|
|
@ -318,7 +318,7 @@ static QTouchDevice *createTouchDevice()
|
|||
qCDebug(lcQpaEvents) << "Digitizers:" << Qt::hex << Qt::showbase << (digitizers & ~NID_READY)
|
||||
<< "Ready:" << (digitizers & NID_READY) << Qt::dec << Qt::noshowbase
|
||||
<< "Tablet PC:" << tabletPc << "Max touch points:" << maxTouchPoints;
|
||||
QTouchDevice *result = new QTouchDevice;
|
||||
auto *result = new QTouchDevice;
|
||||
result->setType(digitizers & NID_INTEGRATED_TOUCH
|
||||
? QTouchDevice::TouchScreen : QTouchDevice::TouchPad);
|
||||
QTouchDevice::Capabilities capabilities = QTouchDevice::Position | QTouchDevice::Area | QTouchDevice::NormalizedPosition;
|
||||
|
|
@ -348,7 +348,7 @@ void QWindowsPointerHandler::handleCaptureRelease(QWindow *window,
|
|||
QEvent::Type eventType,
|
||||
Qt::MouseButtons mouseButtons)
|
||||
{
|
||||
QWindowsWindow *platformWindow = static_cast<QWindowsWindow *>(window->handle());
|
||||
auto *platformWindow = static_cast<QWindowsWindow *>(window->handle());
|
||||
|
||||
// Qt expects the platform plugin to capture the mouse on any button press until release.
|
||||
if (!platformWindow->hasMouseCapture() && eventType == QEvent::MouseButtonPress) {
|
||||
|
|
@ -384,7 +384,7 @@ void QWindowsPointerHandler::handleEnterLeave(QWindow *window,
|
|||
QWindow *currentWindowUnderPointer,
|
||||
QPoint globalPos)
|
||||
{
|
||||
QWindowsWindow *platformWindow = static_cast<QWindowsWindow *>(window->handle());
|
||||
auto *platformWindow = static_cast<QWindowsWindow *>(window->handle());
|
||||
const bool hasCapture = platformWindow->hasMouseCapture();
|
||||
|
||||
// No enter or leave events are sent as long as there is an autocapturing window.
|
||||
|
|
@ -468,7 +468,7 @@ bool QWindowsPointerHandler::translateTouchEvent(QWindow *window, HWND hwnd,
|
|||
if (!screen)
|
||||
return false;
|
||||
|
||||
POINTER_TOUCH_INFO *touchInfo = static_cast<POINTER_TOUCH_INFO *>(vTouchInfo);
|
||||
auto *touchInfo = static_cast<POINTER_TOUCH_INFO *>(vTouchInfo);
|
||||
|
||||
const QRect screenGeometry = screen->geometry();
|
||||
|
||||
|
|
@ -548,13 +548,13 @@ bool QWindowsPointerHandler::translatePenEvent(QWindow *window, HWND hwnd, QtWin
|
|||
if (et & QtWindows::NonClientEventFlag)
|
||||
return false; // Let DefWindowProc() handle Non Client messages.
|
||||
|
||||
POINTER_PEN_INFO *penInfo = static_cast<POINTER_PEN_INFO *>(vPenInfo);
|
||||
auto *penInfo = static_cast<POINTER_PEN_INFO *>(vPenInfo);
|
||||
|
||||
RECT pRect, dRect;
|
||||
if (!QWindowsContext::user32dll.getPointerDeviceRects(penInfo->pointerInfo.sourceDevice, &pRect, &dRect))
|
||||
return false;
|
||||
|
||||
const qint64 sourceDevice = (qint64)penInfo->pointerInfo.sourceDevice;
|
||||
const auto sourceDevice = (qint64)penInfo->pointerInfo.sourceDevice;
|
||||
const QPoint globalPos = QPoint(penInfo->pointerInfo.ptPixelLocation.x, penInfo->pointerInfo.ptPixelLocation.y);
|
||||
const QPoint localPos = QWindowsGeometryHint::mapFromGlobal(hwnd, globalPos);
|
||||
const QPointF hiResGlobalPos = QPointF(dRect.left + qreal(penInfo->pointerInfo.ptHimetricLocation.x - pRect.left)
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ BOOL QT_WIN_CALLBACK monitorEnumCallback(HMONITOR hMonitor, HDC, LPRECT, LPARAM
|
|||
{
|
||||
QWindowsScreenData data;
|
||||
if (monitorData(hMonitor, &data)) {
|
||||
WindowsScreenDataList *result = reinterpret_cast<WindowsScreenDataList *>(p);
|
||||
auto *result = reinterpret_cast<WindowsScreenDataList *>(p);
|
||||
// QWindowSystemInterface::handleScreenAdded() documentation specifies that first
|
||||
// added screen will be the primary screen, so order accordingly.
|
||||
// Note that the side effect of this policy is that there is no way to change primary
|
||||
|
|
@ -552,7 +552,7 @@ bool QWindowsScreenManager::handleScreenChanges()
|
|||
if (existingIndex != -1) {
|
||||
m_screens.at(existingIndex)->handleChanges(newData);
|
||||
} else {
|
||||
QWindowsScreen *newScreen = new QWindowsScreen(newData);
|
||||
auto *newScreen = new QWindowsScreen(newData);
|
||||
m_screens.push_back(newScreen);
|
||||
QWindowSystemInterface::handleScreenAdded(newScreen,
|
||||
newData.flags & QWindowsScreenData::PrimaryScreen);
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ static inline bool shellExecute(const QUrl &url)
|
|||
const QString nativeFilePath = url.isLocalFile() && !url.hasFragment() && !url.hasQuery()
|
||||
? QDir::toNativeSeparators(url.toLocalFile())
|
||||
: url.toString(QUrl::FullyEncoded);
|
||||
const quintptr result =
|
||||
const auto result =
|
||||
reinterpret_cast<quintptr>(ShellExecute(nullptr, nullptr,
|
||||
reinterpret_cast<const wchar_t *>(nativeFilePath.utf16()),
|
||||
nullptr, nullptr, SW_SHOWNORMAL));
|
||||
|
|
|
|||
|
|
@ -583,7 +583,7 @@ Q_GUI_EXPORT QPixmap qt_pixmapFromWinHICON(HICON icon);
|
|||
static QPixmap loadIconFromShell32(int resourceId, QSizeF size)
|
||||
{
|
||||
if (const HMODULE hmod = QSystemLibrary::load(L"shell32")) {
|
||||
HICON iconHandle =
|
||||
auto iconHandle =
|
||||
static_cast<HICON>(LoadImage(hmod, MAKEINTRESOURCE(resourceId),
|
||||
IMAGE_ICON, int(size.width()), int(size.height()), 0));
|
||||
if (iconHandle) {
|
||||
|
|
|
|||
|
|
@ -764,8 +764,8 @@ QWindowsWindowData
|
|||
if (title.isEmpty() && (result.flags & Qt::WindowTitleHint))
|
||||
title = topLevel ? qAppName() : w->objectName();
|
||||
|
||||
const wchar_t *titleUtf16 = reinterpret_cast<const wchar_t *>(title.utf16());
|
||||
const wchar_t *classNameUtf16 = reinterpret_cast<const wchar_t *>(windowClassName.utf16());
|
||||
const auto *titleUtf16 = reinterpret_cast<const wchar_t *>(title.utf16());
|
||||
const auto *classNameUtf16 = reinterpret_cast<const wchar_t *>(windowClassName.utf16());
|
||||
|
||||
// Capture events before CreateWindowEx() returns. The context is cleared in
|
||||
// the QWindowsWindow constructor.
|
||||
|
|
@ -980,7 +980,7 @@ bool QWindowsGeometryHint::handleCalculateSize(const QMargins &customMargins, co
|
|||
if (!msg.wParam || customMargins.isNull())
|
||||
return false;
|
||||
*result = DefWindowProc(msg.hwnd, msg.message, msg.wParam, msg.lParam);
|
||||
NCCALCSIZE_PARAMS *ncp = reinterpret_cast<NCCALCSIZE_PARAMS *>(msg.lParam);
|
||||
auto *ncp = reinterpret_cast<NCCALCSIZE_PARAMS *>(msg.lParam);
|
||||
const RECT oldClientArea = ncp->rgrc[0];
|
||||
ncp->rgrc[0].left += customMargins.left();
|
||||
ncp->rgrc[0].top += customMargins.top();
|
||||
|
|
@ -1500,7 +1500,7 @@ QWindow *QWindowsWindow::topLevelOf(QWindow *w)
|
|||
w = parent;
|
||||
|
||||
if (const QPlatformWindow *handle = w->handle()) {
|
||||
const QWindowsWindow *ww = static_cast<const QWindowsWindow *>(handle);
|
||||
const auto *ww = static_cast<const QWindowsWindow *>(handle);
|
||||
if (ww->isEmbedded()) {
|
||||
HWND parentHWND = GetAncestor(ww->handle(), GA_PARENT);
|
||||
const HWND desktopHwnd = GetDesktopWindow();
|
||||
|
|
@ -1574,7 +1574,7 @@ bool QWindowsWindow::isActive() const
|
|||
|
||||
bool QWindowsWindow::isAncestorOf(const QPlatformWindow *child) const
|
||||
{
|
||||
const QWindowsWindow *childWindow = static_cast<const QWindowsWindow *>(child);
|
||||
const auto *childWindow = static_cast<const QWindowsWindow *>(child);
|
||||
return IsChild(m_data.hwnd, childWindow->handle());
|
||||
}
|
||||
|
||||
|
|
@ -1723,7 +1723,7 @@ void QWindowsWindow::setParent_sys(const QPlatformWindow *parent)
|
|||
HWND oldParentHWND = parentHwnd();
|
||||
HWND newParentHWND = nullptr;
|
||||
if (parent) {
|
||||
const QWindowsWindow *parentW = static_cast<const QWindowsWindow *>(parent);
|
||||
const auto *parentW = static_cast<const QWindowsWindow *>(parent);
|
||||
newParentHWND = parentW->handle();
|
||||
|
||||
}
|
||||
|
|
@ -2366,7 +2366,7 @@ void QWindowsWindow::propagateSizeHints()
|
|||
|
||||
bool QWindowsWindow::handleGeometryChangingMessage(MSG *message, const QWindow *qWindow, const QMargins &margins)
|
||||
{
|
||||
WINDOWPOS *windowPos = reinterpret_cast<WINDOWPOS *>(message->lParam);
|
||||
auto *windowPos = reinterpret_cast<WINDOWPOS *>(message->lParam);
|
||||
if ((windowPos->flags & SWP_NOZORDER) == 0) {
|
||||
if (QWindowsWindow *platformWindow = QWindowsWindow::windowsWindowOf(qWindow)) {
|
||||
QWindow *parentWindow = qWindow->parent();
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ QWindowsUiaMainProvider *QWindowsUiaMainProvider::providerForAccessible(QAccessi
|
|||
|
||||
QAccessible::Id id = QAccessible::uniqueId(accessible);
|
||||
QWindowsUiaProviderCache *providerCache = QWindowsUiaProviderCache::instance();
|
||||
QWindowsUiaMainProvider *provider = qobject_cast<QWindowsUiaMainProvider *>(providerCache->providerForId(id));
|
||||
auto *provider = qobject_cast<QWindowsUiaMainProvider *>(providerCache->providerForId(id));
|
||||
|
||||
if (provider) {
|
||||
provider->AddRef();
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ HRESULT STDMETHODCALLTYPE QWindowsUiaTextProvider::GetSelection(SAFEARRAY **pRet
|
|||
for (LONG i = 0; i < selCount; ++i) {
|
||||
int startOffset = 0, endOffset = 0;
|
||||
textInterface->selection((int)i, &startOffset, &endOffset);
|
||||
QWindowsUiaTextRangeProvider *textRangeProvider = new QWindowsUiaTextRangeProvider(id(), startOffset, endOffset);
|
||||
auto *textRangeProvider = new QWindowsUiaTextRangeProvider(id(), startOffset, endOffset);
|
||||
SafeArrayPutElement(*pRetVal, &i, static_cast<IUnknown *>(textRangeProvider));
|
||||
textRangeProvider->Release();
|
||||
}
|
||||
|
|
@ -110,7 +110,7 @@ HRESULT STDMETHODCALLTYPE QWindowsUiaTextProvider::GetSelection(SAFEARRAY **pRet
|
|||
if ((*pRetVal = SafeArrayCreateVector(VT_UNKNOWN, 0, 1))) {
|
||||
LONG i = 0;
|
||||
int cursorPosition = textInterface->cursorPosition();
|
||||
QWindowsUiaTextRangeProvider *textRangeProvider = new QWindowsUiaTextRangeProvider(id(), cursorPosition, cursorPosition);
|
||||
auto *textRangeProvider = new QWindowsUiaTextRangeProvider(id(), cursorPosition, cursorPosition);
|
||||
SafeArrayPutElement(*pRetVal, &i, static_cast<IUnknown *>(textRangeProvider));
|
||||
textRangeProvider->Release();
|
||||
}
|
||||
|
|
@ -138,7 +138,7 @@ HRESULT STDMETHODCALLTYPE QWindowsUiaTextProvider::GetVisibleRanges(SAFEARRAY **
|
|||
// Considering the entire text as visible.
|
||||
if ((*pRetVal = SafeArrayCreateVector(VT_UNKNOWN, 0, 1))) {
|
||||
LONG i = 0;
|
||||
QWindowsUiaTextRangeProvider *textRangeProvider = new QWindowsUiaTextRangeProvider(id(), 0, textInterface->characterCount());
|
||||
auto *textRangeProvider = new QWindowsUiaTextRangeProvider(id(), 0, textInterface->characterCount());
|
||||
SafeArrayPutElement(*pRetVal, &i, static_cast<IUnknown *>(textRangeProvider));
|
||||
textRangeProvider->Release();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ HRESULT QWindowsUiaTextRangeProvider::Compare(ITextRangeProvider *range, BOOL *p
|
|||
if (!range || !pRetVal)
|
||||
return E_INVALIDARG;
|
||||
|
||||
QWindowsUiaTextRangeProvider *targetProvider = static_cast<QWindowsUiaTextRangeProvider *>(range);
|
||||
auto *targetProvider = static_cast<QWindowsUiaTextRangeProvider *>(range);
|
||||
*pRetVal = ((targetProvider->m_startOffset == m_startOffset) && (targetProvider->m_endOffset == m_endOffset));
|
||||
return S_OK;
|
||||
}
|
||||
|
|
@ -110,7 +110,7 @@ HRESULT QWindowsUiaTextRangeProvider::CompareEndpoints(TextPatternRangeEndpoint
|
|||
if (!targetRange || !pRetVal)
|
||||
return E_INVALIDARG;
|
||||
|
||||
QWindowsUiaTextRangeProvider *targetProvider = static_cast<QWindowsUiaTextRangeProvider *>(targetRange);
|
||||
auto *targetProvider = static_cast<QWindowsUiaTextRangeProvider *>(targetRange);
|
||||
|
||||
int point = (endpoint == TextPatternRangeEndpoint_Start) ? m_startOffset : m_endOffset;
|
||||
int targetPoint = (targetEndpoint == TextPatternRangeEndpoint_Start) ?
|
||||
|
|
@ -373,7 +373,7 @@ HRESULT QWindowsUiaTextRangeProvider::MoveEndpointByRange(TextPatternRangeEndpoi
|
|||
qCDebug(lcQpaUiAutomation) << __FUNCTION__
|
||||
<< "endpoint=" << endpoint << "targetRange=" << targetRange << "targetEndpoint=" << targetEndpoint << "this: " << this;
|
||||
|
||||
QWindowsUiaTextRangeProvider *targetProvider = static_cast<QWindowsUiaTextRangeProvider *>(targetRange);
|
||||
auto *targetProvider = static_cast<QWindowsUiaTextRangeProvider *>(targetRange);
|
||||
|
||||
int targetPoint = (targetEndpoint == TextPatternRangeEndpoint_Start) ?
|
||||
targetProvider->m_startOffset : targetProvider->m_endOffset;
|
||||
|
|
|
|||
Loading…
Reference in New Issue