Windows/Direct2d QPA: Use nullptr

Change-Id: I6ce01caa58de78e0eb61e243ee1e7b05cc1f5568
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
This commit is contained in:
Friedemann Kleint 2019-01-24 08:54:38 +01:00
parent 850858cce6
commit 61d50cbc96
33 changed files with 289 additions and 283 deletions

View File

@ -54,7 +54,8 @@ QT_BEGIN_NAMESPACE
class QWindowsDirect2DBitmapPrivate
{
public:
QWindowsDirect2DBitmapPrivate(ID2D1DeviceContext *dc = 0, ID2D1Bitmap1 *bm = 0)
QWindowsDirect2DBitmapPrivate(ID2D1DeviceContext *dc = nullptr,
ID2D1Bitmap1 *bm = nullptr)
: deviceContext(new QWindowsDirect2DDeviceContext(dc))
, bitmap(bm)
@ -75,9 +76,9 @@ public:
}
bool resize(int width, int height, const void *data = 0, int pitch = 0)
bool resize(int width, int height, const void *data = nullptr, int pitch = 0)
{
deviceContext->get()->SetTarget(0);
deviceContext->get()->SetTarget(nullptr);
bitmap.Reset();
D2D1_SIZE_U size = {
@ -108,14 +109,14 @@ public:
D2D1_BITMAP_PROPERTIES1 properties = bitmapProperties();
properties.bitmapOptions = D2D1_BITMAP_OPTIONS_CANNOT_DRAW | D2D1_BITMAP_OPTIONS_CPU_READ;
hr = deviceContext->get()->CreateBitmap(size, NULL, 0,
hr = deviceContext->get()->CreateBitmap(size, nullptr, 0,
properties, &mappingCopy);
if (FAILED(hr)) {
qWarning("%s: Could not create bitmap: %#lx", __FUNCTION__, hr);
return QImage();
}
hr = mappingCopy->CopyFromBitmap(NULL, bitmap.Get(), NULL);
hr = mappingCopy->CopyFromBitmap(nullptr, bitmap.Get(), nullptr);
if (FAILED(hr)) {
qWarning("%s: Could not copy from bitmap: %#lx", __FUNCTION__, hr);
return QImage();

View File

@ -68,11 +68,11 @@ public:
const int ntypes = int(sizeof(typeAttempts) / sizeof(typeAttempts[0]));
for (int i = 0; i < ntypes; i++) {
hr = D3D11CreateDevice(NULL,
hr = D3D11CreateDevice(nullptr,
typeAttempts[i],
NULL,
nullptr,
D3D11_CREATE_DEVICE_SINGLETHREADED | D3D11_CREATE_DEVICE_BGRA_SUPPORT,
NULL,
nullptr,
0,
D3D11_SDK_VERSION,
&d3dDevice,

View File

@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE
class QWindowsDirect2DEventDispatcher : public QWindowsGuiEventDispatcher
{
public:
QWindowsDirect2DEventDispatcher(QObject *parent = 0)
QWindowsDirect2DEventDispatcher(QObject *parent = nullptr)
: QWindowsGuiEventDispatcher(parent)
{
uninstallMessageHook(); // ### Workaround for QTBUG-42428
@ -82,7 +82,7 @@ static QVersionNumber systemD2DVersion()
UINT i = GetSystemDirectory(filename, bufSize);
if (i > 0 && i < bufSize) {
if (_tcscat_s(filename, bufSize, __TEXT("\\d2d1.dll")) == 0) {
DWORD versionInfoSize = GetFileVersionInfoSize(filename, NULL);
DWORD versionInfoSize = GetFileVersionInfoSize(filename, nullptr);
if (versionInfoSize) {
QVarLengthArray<BYTE> info(static_cast<int>(versionInfoSize));
if (GetFileVersionInfo(filename, 0, versionInfoSize, info.data())) {
@ -132,7 +132,7 @@ QWindowsDirect2DIntegration *QWindowsDirect2DIntegration::create(const QStringLi
QString caption = QCoreApplication::translate("QWindowsDirect2DIntegration",
"Cannot load direct2d platform plugin");
MessageBoxW(NULL,
MessageBoxW(nullptr,
msg.toStdWString().c_str(),
caption.toStdWString().c_str(),
MB_OK | MB_ICONERROR);
@ -144,7 +144,7 @@ QWindowsDirect2DIntegration *QWindowsDirect2DIntegration::create(const QStringLi
if (!integration->init()) {
delete integration;
integration = 0;
integration = nullptr;
}
return integration;

View File

@ -47,15 +47,15 @@ void *QWindowsDirect2DNativeInterface::nativeResourceForBackingStore(const QByte
{
if (!bs || !bs->handle()) {
qWarning("%s: '%s' requested for null backingstore or backingstore without handle.", __FUNCTION__, resource.constData());
return 0;
return nullptr;
}
// getDC is so common we don't want to print an "invalid key" line for it
if (resource == "getDC")
return 0;
return nullptr;
qWarning("%s: Invalid key '%s' requested.", __FUNCTION__, resource.constData());
return 0;
return nullptr;
}

View File

@ -385,9 +385,9 @@ public:
antialiasMode(),
D2D1::IdentityMatrix(),
1.0,
NULL,
nullptr,
layerOptions()),
NULL);
nullptr);
pushedClips.push(LayerClip);
}
}
@ -602,7 +602,7 @@ public:
hr = dc()->CreateBitmapBrush(bitmap.bitmap(), bitmapBrushProperties, &pen.dashBrush);
pen.dashLength = bitmap.size().width();
} else {
hr = factory()->CreateStrokeStyle(props, NULL, 0, &pen.strokeStyle);
hr = factory()->CreateStrokeStyle(props, nullptr, 0, &pen.strokeStyle);
}
if (FAILED(hr))
@ -816,7 +816,7 @@ public:
Direct2DPathGeometryWriter writer;
if (!writer.begin())
return NULL;
return nullptr;
writer.setWindingFillEnabled(path.hasWindingFill());
writer.setAliasingEnabled(alias);
@ -932,7 +932,7 @@ public:
dc()->DrawGlyphRun(pos,
&glyphRun,
NULL,
nullptr,
pen.brush.Get(),
DWRITE_MEASURING_MODE_GDI_CLASSIC);
}
@ -990,7 +990,7 @@ public:
dashOffset = pen.dashLength - fmod(lineLength - dashOffset, pen.dashLength);
}
dc()->DrawLine(to_d2d_point_2f(p1), to_d2d_point_2f(p2),
brush, FLOAT(pen.qpen.widthF()), NULL);
brush, FLOAT(pen.qpen.widthF()), nullptr);
if (skipJoin)
continue;
@ -1102,9 +1102,9 @@ bool QWindowsDirect2DPaintEngine::begin(QPaintDevice * pdev)
d->antialiasMode(),
D2D1::IdentityMatrix(),
1.0,
NULL,
nullptr,
d->layerOptions()),
NULL);
nullptr);
} else {
QRect clip(0, 0, pdev->width(), pdev->height());
if (!systemClip().isEmpty())
@ -1474,7 +1474,7 @@ void QWindowsDirect2DPaintEngine::drawPixmap(const QRectF &r,
r.x() + r.width(), r.y() + r.height(),
r.x(), r.y() + r.height()
};
const QVectorPath vp(points, 4, 0, QVectorPath::RectangleHint);
const QVectorPath vp(points, 4, nullptr, QVectorPath::RectangleHint);
QBrush brush(sr.isValid() ? pm.copy(sr.toRect()) : pm);
brush.setTransform(QTransform::fromTranslate(r.x(), r.y()));
rasterFill(vp, brush);
@ -1511,7 +1511,7 @@ void QWindowsDirect2DPaintEngine::drawPixmap(const QRectF &r,
}
D2D1_RECT_U d2d_sr = to_d2d_rect_u(sr.toRect());
HRESULT hr = intermediate.bitmap()->CopyFromBitmap(NULL,
HRESULT hr = intermediate.bitmap()->CopyFromBitmap(nullptr,
bitmap->bitmap(),
&d2d_sr);
if (FAILED(hr)) {
@ -1526,9 +1526,9 @@ void QWindowsDirect2DPaintEngine::drawPixmap(const QRectF &r,
return;
}
HRESULT hr = intermediate.bitmap()->CopyFromBitmap(NULL,
HRESULT hr = intermediate.bitmap()->CopyFromBitmap(nullptr,
bitmap->bitmap(),
NULL);
nullptr);
if (FAILED(hr)) {
qWarning("%s: Could not copy source bitmap to intermediate bitmap: %#lx", __FUNCTION__, hr);
return;
@ -1708,7 +1708,7 @@ void QWindowsDirect2DPaintEngine::rasterFill(const QVectorPath &path, const QBru
right, info.rectf.y(),
right, bottom,
info.rectf.x(), bottom };
QVectorPath vp(pts, 4, 0, QVectorPath::RectangleHint);
QVectorPath vp(pts, 4, nullptr, QVectorPath::RectangleHint);
extended->clip(vp, info.operation);
break;
}

View File

@ -56,7 +56,7 @@ QPlatformIntegration *QWindowsDirect2DIntegrationPlugin::create(const QString& s
{
if (system.compare(system, QLatin1String("direct2d"), Qt::CaseInsensitive) == 0)
return QWindowsDirect2DIntegration::create(paramList);
return 0;
return nullptr;
}
QT_END_NAMESPACE

View File

@ -171,12 +171,12 @@ void QWindowsDirect2DWindow::present(const QRegion &region)
const BLENDFUNCTION blend = { AC_SRC_OVER, 0, BYTE(255.0 * opacity()), AC_SRC_ALPHA };
const QRect r = region.boundingRect();
const RECT dirty = { r.left(), r.top(), r.left() + r.width(), r.top() + r.height() };
UPDATELAYEREDWINDOWINFO info = { sizeof(UPDATELAYEREDWINDOWINFO), NULL,
UPDATELAYEREDWINDOWINFO info = { sizeof(UPDATELAYEREDWINDOWINFO), nullptr,
&ptDst, &size, hdc, &ptSrc, 0, &blend, ULW_ALPHA, &dirty };
if (!UpdateLayeredWindowIndirect(handle(), &info))
qErrnoWarning(int(GetLastError()), "Failed to update the layered window");
hr = dxgiSurface->ReleaseDC(NULL);
hr = dxgiSurface->ReleaseDC(nullptr);
if (FAILED(hr))
qErrnoWarning(hr, "Failed to release the DC for presentation");
}
@ -195,8 +195,8 @@ void QWindowsDirect2DWindow::setupSwapChain()
QWindowsDirect2DContext::instance()->d3dDevice(), // [in] IUnknown *pDevice
handle(), // [in] HWND hWnd
&desc, // [in] const DXGI_SWAP_CHAIN_DESC1 *pDesc
NULL, // [in] const DXGI_SWAP_CHAIN_FULLSCREEN_DESC *pFullscreenDesc
NULL, // [in] IDXGIOutput *pRestrictToOutput
nullptr, // [in] const DXGI_SWAP_CHAIN_FULLSCREEN_DESC *pFullscreenDesc
nullptr, // [in] IDXGIOutput *pRestrictToOutput
m_swapChain.ReleaseAndGetAddressOf()); // [out] IDXGISwapChain1 **ppSwapChain
if (FAILED(hr))
@ -244,14 +244,14 @@ QSharedPointer<QWindowsDirect2DBitmap> QWindowsDirect2DWindow::copyBackBuffer()
nullptr // _Field_size_opt_(1) ID2D1ColorContext *colorContext;
};
ComPtr<ID2D1Bitmap1> copy;
HRESULT hr = m_deviceContext.Get()->CreateBitmap(size, NULL, 0, properties, &copy);
HRESULT hr = m_deviceContext.Get()->CreateBitmap(size, nullptr, 0, properties, &copy);
if (FAILED(hr)) {
qWarning("%s: Could not create staging bitmap: %#lx", __FUNCTION__, hr);
return null_result;
}
hr = copy.Get()->CopyFromBitmap(NULL, m_bitmap->bitmap(), NULL);
hr = copy.Get()->CopyFromBitmap(nullptr, m_bitmap->bitmap(), nullptr);
if (FAILED(hr)) {
qWarning("%s: Could not copy from bitmap! %#lx", __FUNCTION__, hr);
return null_result;
@ -285,7 +285,7 @@ void QWindowsDirect2DWindow::setupBitmap()
backBufferDesc.BindFlags = D3D11_BIND_RENDER_TARGET;
backBufferDesc.MiscFlags = D3D11_RESOURCE_MISC_GDI_COMPATIBLE;
ComPtr<ID3D11Texture2D> backBufferTexture;
HRESULT hr = QWindowsDirect2DContext::instance()->d3dDevice()->CreateTexture2D(&backBufferDesc, NULL, &backBufferTexture);
HRESULT hr = QWindowsDirect2DContext::instance()->d3dDevice()->CreateTexture2D(&backBufferDesc, nullptr, &backBufferTexture);
if (FAILED(hr)) {
qErrnoWarning(hr, "Failed to create backing texture for indirect rendering");
return;
@ -299,7 +299,7 @@ void QWindowsDirect2DWindow::setupBitmap()
}
ComPtr<ID2D1Bitmap1> backBufferBitmap;
hr = m_deviceContext->CreateBitmapFromDxgiSurface(backBufferSurface.Get(), NULL, backBufferBitmap.GetAddressOf());
hr = m_deviceContext->CreateBitmapFromDxgiSurface(backBufferSurface.Get(), nullptr, backBufferBitmap.GetAddressOf());
if (FAILED(hr)) {
qWarning("%s: Could not create Direct2D Bitmap from DXGI Surface: %#lx", __FUNCTION__, hr);
return;

View File

@ -112,7 +112,7 @@ QPlatformIntegration *QWindowsIntegrationPlugin::create(const QString& system, c
{
if (system.compare(system, QLatin1String("windows"), Qt::CaseInsensitive) == 0)
return new QWindowsGdiIntegration(paramList);
return 0;
return nullptr;
}
QT_END_NAMESPACE

View File

@ -102,7 +102,8 @@ void QWindowsBackingStore::flush(QWindow *window, const QRegion &region,
BLENDFUNCTION blend = {AC_SRC_OVER, 0, BYTE(qRound(255.0 * rw->opacity())), AC_SRC_ALPHA};
RECT dirty = {dirtyRect.x(), dirtyRect.y(),
dirtyRect.x() + dirtyRect.width(), dirtyRect.y() + dirtyRect.height()};
UPDATELAYEREDWINDOWINFO info = {sizeof(info), NULL, &ptDst, &size, m_image->hdc(), &ptSrc, 0, &blend, ULW_ALPHA, &dirty};
UPDATELAYEREDWINDOWINFO info = {sizeof(info), nullptr, &ptDst, &size,
m_image->hdc(), &ptSrc, 0, &blend, ULW_ALPHA, &dirty};
const BOOL result = UpdateLayeredWindowIndirect(rw->handle(), &info);
if (!result)
qErrnoWarning("UpdateLayeredWindowIndirect failed for ptDst=(%d, %d),"
@ -207,7 +208,7 @@ HDC QWindowsBackingStore::getDC() const
{
if (!m_image.isNull())
return m_image->hdc();
return 0;
return nullptr;
}
QImage QWindowsBackingStore::toImage() const

View File

@ -115,13 +115,13 @@ static QDebug operator<<(QDebug d, const QMimeData *mimeData)
IDataObject *QWindowsClipboardRetrievalMimeData::retrieveDataObject() const
{
IDataObject * pDataObj = 0;
IDataObject * pDataObj = nullptr;
if (OleGetClipboard(&pDataObj) == S_OK) {
if (QWindowsContext::verbose > 1)
qCDebug(lcQpaMime) << __FUNCTION__ << pDataObj;
return pDataObj;
}
return 0;
return nullptr;
}
void QWindowsClipboardRetrievalMimeData::releaseDataObject(IDataObject *dataObject) const
@ -148,7 +148,7 @@ static void cleanClipboardPostRoutine()
cl->cleanup();
}
QWindowsClipboard *QWindowsClipboard::m_instance = 0;
QWindowsClipboard *QWindowsClipboard::m_instance = nullptr;
QWindowsClipboard::QWindowsClipboard()
{
@ -159,7 +159,7 @@ QWindowsClipboard::QWindowsClipboard()
QWindowsClipboard::~QWindowsClipboard()
{
cleanup();
QWindowsClipboard::m_instance = 0;
QWindowsClipboard::m_instance = nullptr;
}
void QWindowsClipboard::cleanup()
@ -174,7 +174,7 @@ void QWindowsClipboard::releaseIData()
delete m_data->mimeData();
m_data->releaseQt();
m_data->Release();
m_data = 0;
m_data = nullptr;
}
}
@ -207,10 +207,10 @@ void QWindowsClipboard::unregisterViewer()
m_formatListenerRegistered = false;
} else {
ChangeClipboardChain(m_clipboardViewer, m_nextClipboardViewer);
m_nextClipboardViewer = 0;
m_nextClipboardViewer = nullptr;
}
DestroyWindow(m_clipboardViewer);
m_clipboardViewer = 0;
m_clipboardViewer = nullptr;
}
}
@ -300,7 +300,7 @@ QMimeData *QWindowsClipboard::mimeData(QClipboard::Mode mode)
{
qCDebug(lcQpaMime) << __FUNCTION__ << mode;
if (mode != QClipboard::Clipboard)
return 0;
return nullptr;
if (ownsClipboard())
return m_data->mimeData();
return &m_retrievalData;
@ -341,7 +341,7 @@ void QWindowsClipboard::setMimeData(QMimeData *mimeData, QClipboard::Mode mode)
void QWindowsClipboard::clear()
{
const HRESULT src = OleSetClipboard(0);
const HRESULT src = OleSetClipboard(nullptr);
if (src != S_OK)
qErrnoWarning("OleSetClipboard: Failed to clear the clipboard: 0x%lx", src);
}

View File

@ -112,7 +112,7 @@ static inline bool useRTL_Extensions()
{
// Since the IsValidLanguageGroup/IsValidLocale functions always return true on
// Vista, check the Keyboard Layouts for enabling RTL.
if (const int nLayouts = GetKeyboardLayoutList(0, 0)) {
if (const int nLayouts = GetKeyboardLayoutList(0, nullptr)) {
QScopedArrayPointer<HKL> lpList(new HKL[nLayouts]);
GetKeyboardLayoutList(nLayouts, lpList.data());
for (int i = 0; i < nLayouts; ++i) {
@ -237,7 +237,7 @@ void QWindowsShcoreDLL::init()
QWindowsUser32DLL QWindowsContext::user32dll;
QWindowsShcoreDLL QWindowsContext::shcoredll;
QWindowsContext *QWindowsContext::m_instance = 0;
QWindowsContext *QWindowsContext::m_instance = nullptr;
/*!
\class QWindowsContext
@ -257,7 +257,7 @@ struct QWindowsContextPrivate {
unsigned m_systemInfo = 0;
QSet<QString> m_registeredWindowClassNames;
HandleBaseWindowHash m_windows;
HDC m_displayContext = 0;
HDC m_displayContext = nullptr;
int m_defaultDPI = 96;
QWindowsKeyMapper m_keyMapper;
QWindowsMouseHandler m_mouseHandler;
@ -274,14 +274,14 @@ struct QWindowsContextPrivate {
};
QWindowsContextPrivate::QWindowsContextPrivate()
: m_oleInitializeResult(OleInitialize(NULL))
: m_oleInitializeResult(OleInitialize(nullptr))
{
QWindowsContext::user32dll.init();
QWindowsContext::shcoredll.init();
if (m_pointerHandler.touchDevice() || m_mouseHandler.touchDevice())
m_systemInfo |= QWindowsContext::SI_SupportsTouch;
m_displayContext = GetDC(0);
m_displayContext = GetDC(nullptr);
m_defaultDPI = GetDeviceCaps(m_displayContext, LOGPIXELSY);
if (useRTL_Extensions()) {
m_systemInfo |= QWindowsContext::SI_RTL_Extensions;
@ -316,7 +316,7 @@ QWindowsContext::~QWindowsContext()
OleUninitialize();
d->m_screenManager.clearScreens(); // Order: Potentially calls back to the windows.
m_instance = 0;
m_instance = nullptr;
}
bool QWindowsContext::initTouch()
@ -400,7 +400,7 @@ int QWindowsContext::processDpiAwareness()
{
int result;
if (QWindowsContext::shcoredll.getProcessDpiAwareness
&& SUCCEEDED(QWindowsContext::shcoredll.getProcessDpiAwareness(NULL, &result))) {
&& SUCCEEDED(QWindowsContext::shcoredll.getProcessDpiAwareness(nullptr, &result))) {
return result;
}
return -1;
@ -549,7 +549,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(0));
const HINSTANCE appInstance = static_cast<HINSTANCE>(GetModuleHandle(nullptr));
if (classExists == -1) {
WNDCLASS wcinfo;
classExists = GetClassInfo(appInstance, reinterpret_cast<LPCWSTR>(cname.utf16()), &wcinfo);
@ -569,7 +569,7 @@ QString QWindowsContext::registerWindowClass(QString cname,
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = appInstance;
wc.hCursor = 0;
wc.hCursor = nullptr;
wc.hbrBackground = brush;
if (icon) {
wc.hIcon = static_cast<HICON>(LoadImage(appInstance, L"IDI_ICON1", IMAGE_ICON, 0, 0, LR_DEFAULTSIZE));
@ -578,15 +578,15 @@ QString QWindowsContext::registerWindowClass(QString cname,
int sh = GetSystemMetrics(SM_CYSMICON);
wc.hIconSm = static_cast<HICON>(LoadImage(appInstance, L"IDI_ICON1", IMAGE_ICON, sw, sh, 0));
} else {
wc.hIcon = static_cast<HICON>(LoadImage(0, IDI_APPLICATION, IMAGE_ICON, 0, 0, LR_DEFAULTSIZE | LR_SHARED));
wc.hIconSm = 0;
wc.hIcon = static_cast<HICON>(LoadImage(nullptr, IDI_APPLICATION, IMAGE_ICON, 0, 0, LR_DEFAULTSIZE | LR_SHARED));
wc.hIconSm = nullptr;
}
} else {
wc.hIcon = 0;
wc.hIconSm = 0;
wc.hIcon = nullptr;
wc.hIconSm = nullptr;
}
wc.lpszMenuName = 0;
wc.lpszMenuName = nullptr;
wc.lpszClassName = reinterpret_cast<LPCWSTR>(cname.utf16());
ATOM atom = RegisterClassEx(&wc);
if (!atom)
@ -602,7 +602,7 @@ QString QWindowsContext::registerWindowClass(QString cname,
void QWindowsContext::unregisterWindowClasses()
{
const HINSTANCE appInstance = static_cast<HINSTANCE>(GetModuleHandle(0));
const HINSTANCE appInstance = static_cast<HINSTANCE>(GetModuleHandle(nullptr));
for (const QString &name : qAsConst(d->m_registeredWindowClassNames)) {
if (!UnregisterClass(reinterpret_cast<LPCWSTR>(name.utf16()), appInstance) && QWindowsContext::verbose)
@ -623,7 +623,7 @@ QString QWindowsContext::windowsErrorMessage(unsigned long errorCode)
const DWORD len = FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, errorCode, 0, reinterpret_cast<LPTSTR>(&lpMsgBuf), 0, NULL);
nullptr, errorCode, 0, reinterpret_cast<LPTSTR>(&lpMsgBuf), 0, nullptr);
if (len) {
rc = QString::fromUtf16(lpMsgBuf, int(len));
LocalFree(lpMsgBuf);
@ -643,7 +643,7 @@ void QWindowsContext::removeWindow(HWND hwnd)
const HandleBaseWindowHash::iterator it = d->m_windows.find(hwnd);
if (it != d->m_windows.end()) {
if (d->m_keyMapper.keyGrabber() == it.value()->window())
d->m_keyMapper.setKeyGrabber(0);
d->m_keyMapper.setKeyGrabber(nullptr);
d->m_windows.erase(it);
}
}
@ -683,7 +683,7 @@ QWindow *QWindowsContext::findWindow(HWND hwnd) const
{
if (const QWindowsWindow *bw = findPlatformWindow(hwnd))
return bw->window();
return 0;
return nullptr;
}
QWindow *QWindowsContext::windowUnderMouse() const
@ -750,7 +750,7 @@ QWindowsWindow *QWindowsContext::findPlatformWindowAt(HWND parent,
const QPoint &screenPointIn,
unsigned cwex_flags) const
{
QWindowsWindow *result = 0;
QWindowsWindow *result = nullptr;
const POINT screenPoint = { screenPointIn.x(), screenPointIn.y() };
while (findPlatformWindowHelper(screenPoint, cwex_flags, this, &parent, &result)) {}
return result;
@ -822,7 +822,7 @@ HWND QWindowsContext::createDummyWindow(const QString &classNameIn,
windowName, style,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
HWND_MESSAGE, NULL, static_cast<HINSTANCE>(GetModuleHandle(0)), NULL);
HWND_MESSAGE, nullptr, static_cast<HINSTANCE>(GetModuleHandle(nullptr)), nullptr);
}
// Re-engineered from the inline function _com_error::ErrorMessage().
@ -832,8 +832,8 @@ static inline QString errorMessageFromComError(const _com_error &comError)
{
TCHAR *message = nullptr;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL, DWORD(comError.Error()), MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT),
message, 0, NULL);
nullptr, DWORD(comError.Error()), MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT),
message, 0, nullptr);
if (message) {
const QString result = QString::fromWCharArray(message).trimmed();
LocalFree(static_cast<HLOCAL>(message));
@ -1323,7 +1323,7 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
return false;
platformWindow->setFlag(QWindowsWindow::WithinDpiChanged);
const RECT *prcNewWindow = reinterpret_cast<RECT *>(lParam);
SetWindowPos(hwnd, NULL, prcNewWindow->left, prcNewWindow->top,
SetWindowPos(hwnd, nullptr, prcNewWindow->left, prcNewWindow->top,
prcNewWindow->right - prcNewWindow->left,
prcNewWindow->bottom - prcNewWindow->top, SWP_NOZORDER | SWP_NOACTIVATE);
platformWindow->clearFlag(QWindowsWindow::WithinDpiChanged);
@ -1345,7 +1345,7 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
qGuiAppPriv->commitData();
if (lParam & ENDSESSION_LOGOFF)
fflush(NULL);
fflush(nullptr);
*result = sessionManager->wasCanceled() ? 0 : 1;
return true;
@ -1363,7 +1363,7 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
if (endsession && !qGuiAppPriv->aboutToQuitEmitted) {
qGuiAppPriv->aboutToQuitEmitted = true;
int index = QGuiApplication::staticMetaObject.indexOfSignal("aboutToQuit()");
qApp->qt_metacall(QMetaObject::InvokeMetaMethod, index,0);
qApp->qt_metacall(QMetaObject::InvokeMetaMethod, index, nullptr);
// since the process will be killed immediately quit() has no real effect
QGuiApplication::quit();
}
@ -1384,10 +1384,10 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
void QWindowsContext::handleFocusEvent(QtWindows::WindowsEventType et,
QWindowsWindow *platformWindow)
{
QWindow *nextActiveWindow = 0;
QWindow *nextActiveWindow = nullptr;
if (et == QtWindows::FocusInEvent) {
QWindow *topWindow = QWindowsWindow::topLevelOf(platformWindow->window());
QWindow *modalWindow = 0;
QWindow *modalWindow = nullptr;
if (QGuiApplicationPrivate::instance()->isWindowBlocked(topWindow, &modalWindow) && topWindow != modalWindow) {
modalWindow->requestActivate();
return;
@ -1500,10 +1500,11 @@ static DWORD readDwordRegistrySetting(const wchar_t *regKey, const wchar_t *subK
HKEY handle;
if (RegOpenKeyEx(HKEY_CURRENT_USER, regKey, 0, KEY_READ, &handle) == ERROR_SUCCESS) {
DWORD type;
if (RegQueryValueEx(handle, subKey, 0, &type, 0, 0) == ERROR_SUCCESS && type == REG_DWORD) {
if (RegQueryValueEx(handle, subKey, nullptr, &type, nullptr, nullptr) == ERROR_SUCCESS
&& type == REG_DWORD) {
DWORD value;
DWORD size = sizeof(result);
if (RegQueryValueEx(handle, subKey, 0, 0, reinterpret_cast<unsigned char *>(&value), &size) == ERROR_SUCCESS)
if (RegQueryValueEx(handle, subKey, nullptr, nullptr, reinterpret_cast<unsigned char *>(&value), &size) == ERROR_SUCCESS)
result = value;
}
RegCloseKey(handle);

View File

@ -102,7 +102,7 @@ QWindowsPixmapCursorCacheKey::QWindowsPixmapCursorCacheKey(const QCursor &c)
HCURSOR QWindowsCursor::createPixmapCursor(QPixmap pixmap, const QPoint &hotSpot, qreal scaleFactor)
{
HCURSOR cur = 0;
HCURSOR cur = nullptr;
const qreal pixmapScaleFactor = scaleFactor / pixmap.devicePixelRatioF();
if (!qFuzzyCompare(pixmapScaleFactor, 1)) {
pixmap = pixmap.scaled((pixmapScaleFactor * QSizeF(pixmap.size())).toSize(),
@ -161,7 +161,7 @@ static HCURSOR createBitmapCursor(const QImage &bbits, const QImage &mbits,
++x;
}
}
return CreateCursor(GetModuleHandle(0), hotSpot.x(), hotSpot.y(), width, height,
return CreateCursor(GetModuleHandle(nullptr), hotSpot.x(), hotSpot.y(), width, height,
xBits.data(), xMask.data());
}
@ -456,7 +456,7 @@ QWindowsCursor::PixmapCursor QWindowsCursor::customCursor(Qt::CursorShape cursor
const QSize cursorSize = systemCursorSize(screen);
const QWindowsCustomPngCursor *sEnd = pngCursors + sizeof(pngCursors) / sizeof(pngCursors[0]);
const QWindowsCustomPngCursor *bestFit = 0;
const QWindowsCustomPngCursor *bestFit = nullptr;
int sizeDelta = INT_MAX;
for (const QWindowsCustomPngCursor *s = pngCursors; s < sEnd; ++s) {
if (s->shape != cursorShape)
@ -532,7 +532,7 @@ HCURSOR QWindowsCursor::createCursorFromShape(Qt::CursorShape cursorShape, const
}
qWarning("%s: Invalid cursor shape %d", __FUNCTION__, cursorShape);
return 0;
return nullptr;
}
/*!
@ -741,10 +741,10 @@ QPixmap QWindowsCursor::dragDefaultCursor(Qt::DropAction action) const
"...............XXXX....."};
if (m_ignoreDragCursor.isNull()) {
HCURSOR cursor = LoadCursor(NULL, IDC_NO);
ICONINFO iconInfo = {0, 0, 0, 0, 0};
HCURSOR cursor = LoadCursor(nullptr, IDC_NO);
ICONINFO iconInfo = {0, 0, 0, nullptr, nullptr};
GetIconInfo(cursor, &iconInfo);
BITMAP bmColor = {0, 0, 0, 0, 0, 0, 0};
BITMAP bmColor = {0, 0, 0, 0, 0, 0, nullptr};
if (iconInfo.hbmColor
&& GetObject(iconInfo.hbmColor, sizeof(BITMAP), &bmColor)
@ -780,7 +780,7 @@ HCURSOR QWindowsCursor::hCursor(const QCursor &c) const
if (sit != m_standardCursorCache.constEnd())
return sit.value()->handle();
}
return HCURSOR(0);
return HCURSOR(nullptr);
}
/*!

View File

@ -133,8 +133,8 @@ namespace QWindowsDialogs
void eatMouseMove()
{
MSG msg = {0, 0, 0, 0, 0, {0, 0} };
while (PeekMessage(&msg, 0, WM_MOUSEMOVE, WM_MOUSEMOVE, PM_REMOVE))
MSG msg = {nullptr, 0, 0, 0, 0, {0, 0} };
while (PeekMessage(&msg, nullptr, WM_MOUSEMOVE, WM_MOUSEMOVE, PM_REMOVE))
;
if (msg.message == WM_MOUSEMOVE)
PostMessage(msg.hwnd, msg.message, 0, msg.lParam);
@ -180,7 +180,7 @@ class QWindowsNativeDialogBase : public QObject
public:
virtual void setWindowTitle(const QString &title) = 0;
bool executed() const { return m_executed; }
void exec(HWND owner = 0) { doExec(owner); m_executed = true; }
void exec(HWND owner = nullptr) { doExec(owner); m_executed = true; }
signals:
void accepted();
@ -193,7 +193,7 @@ protected:
QWindowsNativeDialogBase() : m_executed(false) {}
private:
virtual void doExec(HWND owner = 0) = 0;
virtual void doExec(HWND owner = nullptr) = 0;
bool m_executed;
};
@ -229,7 +229,7 @@ void QWindowsDialogHelperBase<BaseClass>::cleanupThread()
qCWarning(lcQpaDialogs) << __FUNCTION__ << "Thread terminated.";
}
delete m_thread;
m_thread = 0;
m_thread = nullptr;
}
}
@ -238,7 +238,7 @@ QWindowsNativeDialogBase *QWindowsDialogHelperBase<BaseClass>::nativeDialog() co
{
if (m_nativeDialog.isNull()) {
qWarning("%s invoked with no native dialog present.", __FUNCTION__);
return 0;
return nullptr;
}
return m_nativeDialog.data();
}
@ -300,7 +300,7 @@ bool QWindowsDialogHelperBase<BaseClass>::show(Qt::WindowFlags,
if (parent) {
m_ownerWindow = QWindowsWindow::handleOf(parent);
} else {
m_ownerWindow = 0;
m_ownerWindow = nullptr;
}
qCDebug(lcQpaDialogs) << __FUNCTION__ << "modal=" << modal
<< " modal supported? " << supportsNonModalDialog(parent)
@ -347,7 +347,7 @@ void QWindowsDialogHelperBase<BaseClass>::stopTimer()
struct FindDialogContext
{
explicit FindDialogContext(const QString &titleIn)
: title(qStringToWCharArray(titleIn)), processId(GetCurrentProcessId()), hwnd(0) {}
: title(qStringToWCharArray(titleIn)), processId(GetCurrentProcessId()), hwnd(nullptr) {}
const QScopedArrayPointer<wchar_t> title;
const DWORD processId;
@ -382,7 +382,7 @@ void QWindowsDialogHelperBase<BaseClass>::hide()
{
if (m_nativeDialog)
m_nativeDialog->close();
m_ownerWindow = 0;
m_ownerWindow = nullptr;
}
template <class BaseClass>
@ -534,7 +534,7 @@ IFileDialogEvents *QWindowsNativeFileDialogEventHandler::create(QWindowsNativeFi
QWindowsNativeFileDialogEventHandler *eventHandler = new QWindowsNativeFileDialogEventHandler(nativeFileDialog);
if (FAILED(eventHandler->QueryInterface(IID_IFileDialogEvents, reinterpret_cast<void **>(&result)))) {
qErrnoWarning("Unable to obtain IFileDialogEvents");
return 0;
return nullptr;
}
eventHandler->Release();
return result;
@ -671,7 +671,7 @@ bool QWindowsShellItem::copyData(QIODevice *out)
if (!canCopy() || !canStream())
return false;
IStream *istream = nullptr;
HRESULT hr = m_item->BindToHandler(NULL, BHID_Stream, IID_PPV_ARGS(&istream));
HRESULT hr = m_item->BindToHandler(nullptr, BHID_Stream, IID_PPV_ARGS(&istream));
if (FAILED(hr))
return false;
enum : ULONG { bufSize = 102400 };
@ -702,7 +702,7 @@ static IShellLibrary *sHLoadLibraryFromItem(IShellItem *libraryItem, DWORD mode)
IShellLibrary *helper = nullptr;
IShellLibrary *result = nullptr;
if (SUCCEEDED(CoCreateInstance(classId_ShellLibrary, NULL, CLSCTX_INPROC_SERVER, iId_IShellLibrary, reinterpret_cast<void **>(&helper))))
if (SUCCEEDED(CoCreateInstance(classId_ShellLibrary, nullptr, CLSCTX_INPROC_SERVER, iId_IShellLibrary, reinterpret_cast<void **>(&helper))))
if (SUCCEEDED(helper->LoadLibraryFromItem(libraryItem, mode)))
helper->QueryInterface(iId_IShellLibrary, reinterpret_cast<void **>(&result));
if (helper)
@ -800,7 +800,7 @@ public:
inline void setDirectory(const QUrl &directory);
inline void updateDirectory() { setDirectory(m_data.directory()); }
inline QString directory() const;
void doExec(HWND owner = 0) override;
void doExec(HWND owner = nullptr) override;
virtual void setNameFilters(const QStringList &f);
inline void selectNameFilter(const QString &filter);
inline void updateSelectedNameFilter() { selectNameFilter(m_data.selectedNameFilter()); }
@ -869,7 +869,7 @@ QWindowsNativeFileDialogBase::~QWindowsNativeFileDialogBase()
bool QWindowsNativeFileDialogBase::init(const CLSID &clsId, const IID &iid)
{
HRESULT hr = CoCreateInstance(clsId, NULL, CLSCTX_INPROC_SERVER,
HRESULT hr = CoCreateInstance(clsId, nullptr, CLSCTX_INPROC_SERVER,
iid, reinterpret_cast<void **>(&m_fileDialog));
if (FAILED(hr)) {
qErrnoWarning("CoCreateInstance failed");
@ -902,7 +902,7 @@ IShellItem *QWindowsNativeFileDialogBase::shellItem(const QUrl &url)
const QString native = QDir::toNativeSeparators(url.toLocalFile());
const HRESULT hr =
SHCreateItemFromParsingName(reinterpret_cast<const wchar_t *>(native.utf16()),
NULL, IID_IShellItem,
nullptr, IID_IShellItem,
reinterpret_cast<void **>(&result));
if (FAILED(hr)) {
qErrnoWarning("%s: SHCreateItemFromParsingName(%s)) failed", __FUNCTION__, qPrintable(url.toString()));
@ -920,7 +920,7 @@ IShellItem *QWindowsNativeFileDialogBase::shellItem(const QUrl &url)
return nullptr;
}
PIDLIST_ABSOLUTE idList;
HRESULT hr = SHGetKnownFolderIDList(uuid, 0, 0, &idList);
HRESULT hr = SHGetKnownFolderIDList(uuid, 0, nullptr, &idList);
if (FAILED(hr)) {
qErrnoWarning("%s: SHGetKnownFolderIDList(%s)) failed", __FUNCTION__, qPrintable(url.toString()));
return nullptr;
@ -935,7 +935,7 @@ IShellItem *QWindowsNativeFileDialogBase::shellItem(const QUrl &url)
} else {
qWarning() << __FUNCTION__ << ": Unhandled scheme: " << url.scheme();
}
return 0;
return nullptr;
}
void QWindowsNativeFileDialogBase::setDirectory(const QUrl &directory)
@ -951,7 +951,7 @@ void QWindowsNativeFileDialogBase::setDirectory(const QUrl &directory)
QString QWindowsNativeFileDialogBase::directory() const
{
QString result;
IShellItem *item = 0;
IShellItem *item = nullptr;
if (m_fileDialog && SUCCEEDED(m_fileDialog->GetFolder(&item)) && item) {
result = QWindowsShellItem(item).path();
item->Release();
@ -1339,7 +1339,7 @@ void QWindowsNativeSaveFileDialog::setNameFilters(const QStringList &f)
QList<QUrl> QWindowsNativeSaveFileDialog::dialogResult() const
{
QList<QUrl> result;
IShellItem *item = 0;
IShellItem *item = nullptr;
if (SUCCEEDED(fileDialog()->GetResult(&item)) && item)
result.append(QWindowsShellItem(item).url());
return result;
@ -1348,7 +1348,7 @@ QList<QUrl> QWindowsNativeSaveFileDialog::dialogResult() const
QList<QUrl> QWindowsNativeSaveFileDialog::selectedFiles() const
{
QList<QUrl> result;
IShellItem *item = 0;
IShellItem *item = nullptr;
const HRESULT hr = fileDialog()->GetCurrentSelection(&item);
if (SUCCEEDED(hr) && item) {
result.append(QWindowsShellItem(item).url());
@ -1419,7 +1419,7 @@ static QString createTemporaryItemCopy(QWindowsShellItem &qItem)
QList<QUrl> QWindowsNativeOpenFileDialog::dialogResult() const
{
QList<QUrl> result;
IShellItemArray *items = 0;
IShellItemArray *items = nullptr;
if (SUCCEEDED(openFileDialog()->GetResults(&items)) && items) {
for (IShellItem *item : QWindowsShellItem::itemsFromItemArray(items)) {
QWindowsShellItem qItem(item);
@ -1441,7 +1441,7 @@ QList<QUrl> QWindowsNativeOpenFileDialog::dialogResult() const
QList<QUrl> QWindowsNativeOpenFileDialog::selectedFiles() const
{
QList<QUrl> result;
IShellItemArray *items = 0;
IShellItemArray *items = nullptr;
const HRESULT hr = openFileDialog()->GetSelectedItems(&items);
if (SUCCEEDED(hr) && items) {
for (IShellItem *item : QWindowsShellItem::itemsFromItemArray(items)) {
@ -1465,18 +1465,18 @@ QList<QUrl> QWindowsNativeOpenFileDialog::selectedFiles() const
QWindowsNativeFileDialogBase *QWindowsNativeFileDialogBase::create(QFileDialogOptions::AcceptMode am,
const QWindowsFileDialogSharedData &data)
{
QWindowsNativeFileDialogBase *result = 0;
QWindowsNativeFileDialogBase *result = nullptr;
if (am == QFileDialogOptions::AcceptOpen) {
result = new QWindowsNativeOpenFileDialog(data);
if (!result->init(CLSID_FileOpenDialog, IID_IFileOpenDialog)) {
delete result;
return 0;
return nullptr;
}
} else {
result = new QWindowsNativeSaveFileDialog(data);
if (!result->init(CLSID_FileSaveDialog, IID_IFileSaveDialog)) {
delete result;
return 0;
return nullptr;
}
}
return result;
@ -1497,7 +1497,7 @@ class QWindowsFileDialogHelper : public QWindowsDialogHelperBase<QPlatformFileDi
{
public:
QWindowsFileDialogHelper() {}
bool supportsNonModalDialog(const QWindow * /* parent */ = 0) const override { return false; }
bool supportsNonModalDialog(const QWindow * /* parent */ = nullptr) const override { return false; }
bool defaultNameFilterDisables() const override
{ return false; }
void setDirectory(const QUrl &directory) override;
@ -1521,7 +1521,7 @@ QWindowsNativeDialogBase *QWindowsFileDialogHelper::createNativeDialog()
{
QWindowsNativeFileDialogBase *result = QWindowsNativeFileDialogBase::create(options()->acceptMode(), m_data);
if (!result)
return 0;
return nullptr;
QObject::connect(result, &QWindowsNativeDialogBase::accepted, this, &QPlatformDialogHelper::accept);
QObject::connect(result, &QWindowsNativeDialogBase::rejected, this, &QPlatformDialogHelper::reject);
QObject::connect(result, &QWindowsNativeFileDialogBase::directoryEntered,
@ -1638,7 +1638,7 @@ public:
static QWindowsXpNativeFileDialog *create(const OptionsPtr &options, const QWindowsFileDialogSharedData &data);
void setWindowTitle(const QString &t) override { m_title = t; }
void doExec(HWND owner = 0) override;
void doExec(HWND owner = nullptr) override;
int existingDirCallback(HWND hwnd, UINT uMsg, LPARAM lParam);
@ -1663,8 +1663,8 @@ private:
static PtrGetSaveFileNameW m_getSaveFileNameW;
};
QWindowsXpNativeFileDialog::PtrGetOpenFileNameW QWindowsXpNativeFileDialog::m_getOpenFileNameW = 0;
QWindowsXpNativeFileDialog::PtrGetSaveFileNameW QWindowsXpNativeFileDialog::m_getSaveFileNameW = 0;
QWindowsXpNativeFileDialog::PtrGetOpenFileNameW QWindowsXpNativeFileDialog::m_getOpenFileNameW = nullptr;
QWindowsXpNativeFileDialog::PtrGetSaveFileNameW QWindowsXpNativeFileDialog::m_getSaveFileNameW = nullptr;
QWindowsXpNativeFileDialog *QWindowsXpNativeFileDialog::create(const OptionsPtr &options, const QWindowsFileDialogSharedData &data)
{
@ -1678,7 +1678,7 @@ QWindowsXpNativeFileDialog *QWindowsXpNativeFileDialog::create(const OptionsPtr
}
if (m_getOpenFileNameW && m_getSaveFileNameW)
return new QWindowsXpNativeFileDialog(options, data);
return 0;
return nullptr;
}
QWindowsXpNativeFileDialog::QWindowsXpNativeFileDialog(const OptionsPtr &options,
@ -1755,8 +1755,8 @@ QList<QUrl> QWindowsXpNativeFileDialog::execExistingDir(HWND owner)
wchar_t initPath[MAX_PATH];
initPath[0] = 0;
bi.hwndOwner = owner;
bi.pidlRoot = NULL;
bi.lpszTitle = 0;
bi.pidlRoot = nullptr;
bi.lpszTitle = nullptr;
bi.pszDisplayName = initPath;
bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT | BIF_NEWDIALOGSTYLE;
bi.lpfn = xpFileDialogGetExistingDirCallbackProc;
@ -1879,7 +1879,7 @@ class QWindowsXpFileDialogHelper : public QWindowsDialogHelperBase<QPlatformFile
{
public:
QWindowsXpFileDialogHelper() = default;
bool supportsNonModalDialog(const QWindow * /* parent */ = 0) const override { return false; }
bool supportsNonModalDialog(const QWindow * /* parent */ = nullptr) const override { return false; }
bool defaultNameFilterDisables() const override
{ return true; }
void setDirectory(const QUrl &directory) override;
@ -1906,7 +1906,7 @@ QWindowsNativeDialogBase *QWindowsXpFileDialogHelper::createNativeDialog()
QObject::connect(result, &QWindowsNativeDialogBase::rejected, this, &QPlatformDialogHelper::reject);
return result;
}
return 0;
return nullptr;
}
void QWindowsXpFileDialogHelper::setDirectory(const QUrl &directory)
@ -2089,7 +2089,7 @@ bool useHelper(QPlatformTheme::DialogType type)
QPlatformDialogHelper *createHelper(QPlatformTheme::DialogType type)
{
if (QWindowsIntegration::instance()->options() & QWindowsIntegration::NoNativeDialogs)
return 0;
return nullptr;
switch (type) {
case QPlatformTheme::FileDialog:
if (QWindowsIntegration::instance()->options() & QWindowsIntegration::XpNativeDialogs)
@ -2107,7 +2107,7 @@ QPlatformDialogHelper *createHelper(QPlatformTheme::DialogType type)
default:
break;
}
return 0;
return nullptr;
}
} // namespace QWindowsDialogs

View File

@ -80,7 +80,7 @@ QT_BEGIN_NAMESPACE
class QWindowsDragCursorWindow : public QRasterWindow
{
public:
explicit QWindowsDragCursorWindow(QWindow *parent = 0);
explicit QWindowsDragCursorWindow(QWindow *parent = nullptr);
void setPixmap(const QPixmap &p);
@ -264,7 +264,7 @@ QWindowsOleDropSource::QWindowsOleDropSource(QWindowsDrag *drag)
, m_drag(drag)
, m_windowUnderMouse(QWindowsContext::instance()->windowUnderMouse())
, m_currentButtons(Qt::NoButton)
, m_touchDragWindow(0)
, m_touchDragWindow(nullptr)
{
qCDebug(lcQpaMime) << __FUNCTION__ << m_mode;
}
@ -572,7 +572,7 @@ QWindowsOleDropTarget::DragLeave()
qCDebug(lcQpaMime) << __FUNCTION__ << ' ' << m_window;
QWindowSystemInterface::handleDrag(m_window, 0, QPoint(), Qt::IgnoreAction,
QWindowSystemInterface::handleDrag(m_window, nullptr, QPoint(), Qt::IgnoreAction,
Qt::NoButton, Qt::NoModifier);
if (!QDragManager::self()->source())
@ -626,7 +626,7 @@ QWindowsOleDropTarget::Drop(LPDATAOBJECT pDataObj, DWORD grfKeyState,
FORMATETC format;
format.cfFormat = CLIPFORMAT(RegisterClipboardFormat(CFSTR_PERFORMEDDROPEFFECT));
format.tymed = TYMED_HGLOBAL;
format.ptd = 0;
format.ptd = nullptr;
format.dwAspect = 1;
format.lindex = -1;
windowsDrag->dropDataObject()->SetData(&format, &medium, true);
@ -678,7 +678,7 @@ QMimeData *QWindowsDrag::dropData()
*/
IDropTargetHelper* QWindowsDrag::dropHelper() {
if (!m_cachedDropTargetHelper) {
CoCreateInstance(CLSID_DragDropHelper, 0, CLSCTX_INPROC_SERVER,
CoCreateInstance(CLSID_DragDropHelper, nullptr, CLSCTX_INPROC_SERVER,
IID_IDropTargetHelper,
reinterpret_cast<void**>(&m_cachedDropTargetHelper));
}
@ -739,7 +739,7 @@ void QWindowsDrag::releaseDropDataObject()
qCDebug(lcQpaMime) << __FUNCTION__ << m_dropDataObject;
if (m_dropDataObject) {
m_dropDataObject->Release();
m_dropDataObject = 0;
m_dropDataObject = nullptr;
}
}

View File

@ -103,7 +103,7 @@ static inline void *resolveFunc(HMODULE lib, const char *name)
void *QWindowsLibEGL::resolve(const char *name)
{
return m_lib ? resolveFunc(m_lib, name) : 0;
return m_lib ? resolveFunc(m_lib, name) : nullptr;
}
#endif // !QT_STATIC
@ -155,7 +155,7 @@ bool QWindowsLibEGL::init()
if (!eglGetError || !eglGetDisplay || !eglInitialize || !eglGetProcAddress)
return false;
eglGetPlatformDisplayEXT = 0;
eglGetPlatformDisplayEXT = nullptr;
#ifdef EGL_ANGLE_platform_angle
eglGetPlatformDisplayEXT = reinterpret_cast<EGLDisplay (EGLAPIENTRY *)(EGLenum, void *, const EGLint *)>(eglGetProcAddress("eglGetPlatformDisplayEXT"));
#endif
@ -166,7 +166,7 @@ bool QWindowsLibEGL::init()
#if !defined(QT_STATIC) || defined(QT_OPENGL_DYNAMIC)
void *QWindowsLibGLESv2::resolve(const char *name)
{
return m_lib ? resolveFunc(m_lib, name) : 0;
return m_lib ? resolveFunc(m_lib, name) : nullptr;
}
#endif // !QT_STATIC
@ -213,7 +213,7 @@ bool QWindowsEGLStaticContext::initializeAngle(QWindowsOpenGLTester::Renderers p
{ EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,
EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE, EGL_NONE }
};
const EGLint *attributes = 0;
const EGLint *attributes = nullptr;
if (preferredType & QWindowsOpenGLTester::AngleRendererD3d11)
attributes = anglePlatformAttributes[0];
else if (preferredType & QWindowsOpenGLTester::AngleRendererD3d9)
@ -245,16 +245,16 @@ QWindowsEGLStaticContext *QWindowsEGLStaticContext::create(QWindowsOpenGLTester:
const HDC dc = QWindowsContext::instance()->displayContext();
if (!dc){
qWarning("%s: No Display", __FUNCTION__);
return 0;
return nullptr;
}
if (!libEGL.init()) {
qWarning("%s: Failed to load and resolve libEGL functions", __FUNCTION__);
return 0;
return nullptr;
}
if (!libGLESv2.init()) {
qWarning("%s: Failed to load and resolve libGLESv2 functions", __FUNCTION__);
return 0;
return nullptr;
}
EGLDisplay display = EGL_NO_DISPLAY;
@ -271,7 +271,7 @@ QWindowsEGLStaticContext *QWindowsEGLStaticContext::create(QWindowsOpenGLTester:
display = libEGL.eglGetDisplay(dc);
if (!display) {
qWarning("%s: Could not obtain EGL display", __FUNCTION__);
return 0;
return nullptr;
}
if (!major && !libEGL.eglInitialize(display, &major, &minor)) {
@ -279,7 +279,7 @@ QWindowsEGLStaticContext *QWindowsEGLStaticContext::create(QWindowsOpenGLTester:
qWarning("%s: Could not initialize EGL display: error 0x%x", __FUNCTION__, err);
if (err == 0x3001)
qWarning("%s: When using ANGLE, check if d3dcompiler_4x.dll is available", __FUNCTION__);
return 0;
return nullptr;
}
qCDebug(lcQpaGl) << __FUNCTION__ << "Created EGL display" << display << 'v' <<major << '.' << minor;
@ -301,7 +301,7 @@ void *QWindowsEGLStaticContext::createWindowSurface(void *nativeWindow, void *na
{
*err = 0;
EGLSurface surface = libEGL.eglCreateWindowSurface(m_display, nativeConfig,
static_cast<EGLNativeWindowType>(nativeWindow), 0);
static_cast<EGLNativeWindowType>(nativeWindow), nullptr);
if (surface == EGL_NO_SURFACE) {
*err = libEGL.eglGetError();
qWarning("%s: Could not create the EGL window surface: 0x%x", __FUNCTION__, *err);
@ -390,7 +390,7 @@ QWindowsEGLContext::QWindowsEGLContext(QWindowsEGLStaticContext *staticContext,
m_eglConfig = chooseConfig(format);
m_format = m_staticContext->formatFromConfig(m_eglDisplay, m_eglConfig, format);
m_shareContext = share ? static_cast<QWindowsEGLContext *>(share)->m_eglContext : 0;
m_shareContext = share ? static_cast<QWindowsEGLContext *>(share)->m_eglContext : nullptr;
QVector<EGLint> contextAttrs;
contextAttrs.append(EGL_CONTEXT_CLIENT_VERSION);
@ -400,8 +400,8 @@ QWindowsEGLContext::QWindowsEGLContext(QWindowsEGLStaticContext *staticContext,
QWindowsEGLStaticContext::libEGL.eglBindAPI(m_api);
m_eglContext = QWindowsEGLStaticContext::libEGL.eglCreateContext(m_eglDisplay, m_eglConfig, m_shareContext, contextAttrs.constData());
if (m_eglContext == EGL_NO_CONTEXT && m_shareContext != EGL_NO_CONTEXT) {
m_shareContext = 0;
m_eglContext = QWindowsEGLStaticContext::libEGL.eglCreateContext(m_eglDisplay, m_eglConfig, 0, contextAttrs.constData());
m_shareContext = nullptr;
m_eglContext = QWindowsEGLStaticContext::libEGL.eglCreateContext(m_eglDisplay, m_eglConfig, nullptr, contextAttrs.constData());
}
if (m_eglContext == EGL_NO_CONTEXT) {
@ -862,11 +862,11 @@ EGLConfig QWindowsEGLContext::chooseConfig(const QSurfaceFormat &format)
configureAttributes.append(EGL_NONE);
EGLDisplay display = m_staticContext->display();
EGLConfig cfg = 0;
EGLConfig cfg = nullptr;
do {
// Get the number of matching configurations for this set of properties.
EGLint matching = 0;
if (!QWindowsEGLStaticContext::libEGL.eglChooseConfig(display, configureAttributes.constData(), 0, 0, &matching) || !matching)
if (!QWindowsEGLStaticContext::libEGL.eglChooseConfig(display, configureAttributes.constData(), nullptr, 0, &matching) || !matching)
continue;
// Fetch all of the matching configurations and find the

View File

@ -48,13 +48,13 @@ void *QWindowsGdiNativeInterface::nativeResourceForBackingStore(const QByteArray
{
if (!bs || !bs->handle()) {
qWarning("%s: '%s' requested for null backingstore or backingstore without handle.", __FUNCTION__, resource.constData());
return 0;
return nullptr;
}
QWindowsBackingStore *wbs = static_cast<QWindowsBackingStore *>(bs->handle());
if (resource == "getDC")
return wbs->getDC();
qWarning("%s: Invalid key '%s' requested.", __FUNCTION__, resource.constData());
return 0;
return nullptr;
}
QT_END_NAMESPACE

View File

@ -322,7 +322,7 @@ static inline bool
static void describeFormats(HDC hdc)
{
const int pfiMax = DescribePixelFormat(hdc, 0, 0, NULL);
const int pfiMax = DescribePixelFormat(hdc, 0, 0, nullptr);
for (int i = 0; i < pfiMax; i++) {
PIXELFORMATDESCRIPTOR pfd;
initPixelFormatDescriptor(&pfd);
@ -335,7 +335,7 @@ static void describeFormats(HDC hdc)
namespace GDI {
static QSurfaceFormat
qSurfaceFormatFromPixelFormat(const PIXELFORMATDESCRIPTOR &pfd,
QWindowsOpenGLAdditionalFormat *additionalIn = 0)
QWindowsOpenGLAdditionalFormat *additionalIn = nullptr)
{
QSurfaceFormat format;
format.setRenderableType(QSurfaceFormat::OpenGL);
@ -437,7 +437,7 @@ static int choosePixelFormat(HDC hdc, const QSurfaceFormat &format,
return pixelFormat;
}
// 2) No matching format found, manual search loop.
const int pfiMax = DescribePixelFormat(hdc, 0, 0, NULL);
const int pfiMax = DescribePixelFormat(hdc, 0, 0, nullptr);
int bestScore = -1;
int bestPfi = -1;
const bool stereoRequested = format.stereo();
@ -479,7 +479,7 @@ static inline HGLRC createContext(HDC hdc, HGLRC shared)
HGLRC result = QOpenGLStaticContext::opengl32.wglCreateContext(hdc);
if (!result) {
qErrnoWarning("%s: wglCreateContext failed.", __FUNCTION__);
return 0;
return nullptr;
}
if (shared && !QOpenGLStaticContext::opengl32.wglShareLists(shared, result))
qErrnoWarning("%s: wglShareLists() failed.", __FUNCTION__);
@ -590,7 +590,7 @@ static int choosePixelFormat(HDC hdc,
uint numFormats = 0;
while (true) {
const bool valid =
staticContext.wglChoosePixelFormatARB(hdc, iAttributes, 0, 1,
staticContext.wglChoosePixelFormatARB(hdc, iAttributes, nullptr, 1,
&pixelFormat, &numFormats)
&& numFormats >= 1;
if (valid || (!sampleBuffersRequested && !srgbRequested))
@ -646,7 +646,7 @@ static int choosePixelFormat(HDC hdc,
static QSurfaceFormat
qSurfaceFormatFromHDC(const QOpenGLStaticContext &staticContext,
HDC hdc, int pixelFormat,
QWindowsOpenGLAdditionalFormat *additionalIn = 0)
QWindowsOpenGLAdditionalFormat *additionalIn = nullptr)
{
enum { attribSize = 42 };
@ -720,12 +720,12 @@ static HGLRC createContext(const QOpenGLStaticContext &staticContext,
HDC hdc,
const QSurfaceFormat &format,
const QWindowsOpenGLAdditionalFormat &,
HGLRC shared = 0)
HGLRC shared = nullptr)
{
enum { attribSize = 11 };
if (!staticContext.hasExtensions())
return 0;
return nullptr;
int attributes[attribSize];
int attribIndex = 0;
std::fill(attributes, attributes + attribSize, int(0));
@ -797,14 +797,14 @@ static inline HWND createDummyGLWindow()
{
return QWindowsContext::instance()->
createDummyWindow(QStringLiteral("QtOpenGLDummyWindow"),
L"OpenGLDummyWindow", 0, WS_OVERLAPPED | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
L"OpenGLDummyWindow", nullptr, WS_OVERLAPPED | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
}
// Create a dummy GL context (see QOpenGLTemporaryContext).
static inline HGLRC createDummyGLContext(HDC dc)
{
if (!dc)
return 0;
return nullptr;
PIXELFORMATDESCRIPTOR pixelFormDescriptor;
initPixelFormatDescriptor(&pixelFormDescriptor);
pixelFormDescriptor.dwFlags = PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW | PFD_GENERIC_FORMAT;
@ -813,16 +813,16 @@ static inline HGLRC createDummyGLContext(HDC dc)
const int pixelFormat = ChoosePixelFormat(dc, &pixelFormDescriptor);
if (!pixelFormat) {
qErrnoWarning("%s: ChoosePixelFormat failed.", __FUNCTION__);
return 0;
return nullptr;
}
if (!QOpenGLStaticContext::opengl32.setPixelFormat(dc, pixelFormat, &pixelFormDescriptor)) {
qErrnoWarning("%s: SetPixelFormat failed.", __FUNCTION__);
return 0;
return nullptr;
}
HGLRC rc = QOpenGLStaticContext::opengl32.wglCreateContext(dc);
if (!rc) {
qErrnoWarning("%s: wglCreateContext failed.", __FUNCTION__);
return 0;
return nullptr;
}
return rc;
}
@ -1002,7 +1002,7 @@ QOpenGLStaticContext *QOpenGLStaticContext::create(bool softwareRendering)
{
if (!opengl32.init(softwareRendering)) {
qWarning("Failed to load and resolve WGL/OpenGL functions");
return 0;
return nullptr;
}
// We need a current context for wglGetProcAdress()/getGLString() to work.
@ -1033,12 +1033,12 @@ QWindowsGLContext::QWindowsGLContext(QOpenGLStaticContext *staticContext,
QOpenGLContext *context) :
m_staticContext(staticContext),
m_context(context),
m_renderingContext(0),
m_renderingContext(nullptr),
m_pixelFormat(0),
m_extensionsUsed(false),
m_swapInterval(-1),
m_ownsContext(true),
m_getGraphicsResetStatus(0),
m_getGraphicsResetStatus(nullptr),
m_lost(false)
{
if (!m_staticContext) // Something went very wrong. Stop here, isValid() will return false.
@ -1081,7 +1081,7 @@ QWindowsGLContext::QWindowsGLContext(QOpenGLStaticContext *staticContext,
if (ok)
m_ownsContext = false;
else
m_renderingContext = 0;
m_renderingContext = nullptr;
return;
}
@ -1105,8 +1105,8 @@ QWindowsGLContext::QWindowsGLContext(QOpenGLStaticContext *staticContext,
// Create a dummy one as we are not associated with a window yet.
// Try to find a suitable pixel format using preferably ARB extensions
// (default to GDI) and store that.
HWND dummyWindow = 0;
HDC hdc = 0;
HWND dummyWindow = nullptr;
HDC hdc = nullptr;
bool tryExtensions = false;
int obtainedSwapInterval = -1;
do {
@ -1163,7 +1163,7 @@ QWindowsGLContext::QWindowsGLContext(QOpenGLStaticContext *staticContext,
break;
}
// Create context with sharing, again preferably using ARB.
HGLRC sharingRenderingContext = 0;
HGLRC sharingRenderingContext = nullptr;
if (const QPlatformOpenGLContext *sc = context->shareHandle())
sharingRenderingContext = static_cast<const QWindowsGLContext *>(sc)->renderingContext();
@ -1190,7 +1190,7 @@ QWindowsGLContext::QWindowsGLContext(QOpenGLStaticContext *staticContext,
// Make the HGLRC retrievable via QOpenGLContext::nativeHandle().
// Do not provide the window since it is the dummy one and it is about to disappear.
if (m_renderingContext)
context->setNativeHandle(QVariant::fromValue<QWGLNativeContext>(QWGLNativeContext(m_renderingContext, 0)));
context->setNativeHandle(QVariant::fromValue<QWGLNativeContext>(QWGLNativeContext(m_renderingContext, nullptr)));
if (hdc)
ReleaseDC(dummyWindow, hdc);
@ -1281,7 +1281,7 @@ static inline const QOpenGLContextData *
if (e.hwnd == hwnd)
return &e;
}
return 0;
return nullptr;
}
void QWindowsGLContext::swapBuffers(QPlatformSurface *surface)
@ -1365,7 +1365,7 @@ void QWindowsGLContext::doneCurrent()
if (QWindowsContext::verbose > 1)
qCDebug(lcQpaGl) << __FUNCTION__ << this << m_windowContexts.size() << "contexts";
#endif // DEBUG_GL
QOpenGLStaticContext::opengl32.wglMakeCurrent(0, 0);
QOpenGLStaticContext::opengl32.wglMakeCurrent(nullptr, nullptr);
releaseDCs();
}

View File

@ -311,10 +311,10 @@ void QWindowsInputContext::setWindowsImeEnabled(QWindowsWindow *platformWindow,
return;
if (enabled) {
// Re-enable Windows IME by associating default context.
ImmAssociateContextEx(platformWindow->handle(), 0, IACE_DEFAULT);
ImmAssociateContextEx(platformWindow->handle(), nullptr, IACE_DEFAULT);
} else {
// Disable Windows IME by associating 0 context.
ImmAssociateContext(platformWindow->handle(), 0);
ImmAssociateContext(platformWindow->handle(), nullptr);
}
}
@ -539,7 +539,7 @@ bool QWindowsInputContext::composition(HWND hwnd, LPARAM lParamIn)
// attribute sequence specifying the formatting of the converted part.
int selStart, selLength;
m_compositionContext.composition = getCompositionString(himc, GCS_COMPSTR);
m_compositionContext.position = ImmGetCompositionString(himc, GCS_CURSORPOS, 0, 0);
m_compositionContext.position = ImmGetCompositionString(himc, GCS_CURSORPOS, nullptr, 0);
getCompositionStringConvertedRange(himc, &selStart, &selLength);
if ((lParam & CS_INSERTCHAR) && (lParam & CS_NOMOVECARET)) {
// make Korean work correctly. Hope this is correct for all IMEs
@ -620,11 +620,11 @@ void QWindowsInputContext::doneContext()
{
if (!m_compositionContext.hwnd)
return;
m_compositionContext.hwnd = 0;
m_compositionContext.hwnd = nullptr;
m_compositionContext.composition.clear();
m_compositionContext.position = 0;
m_compositionContext.isComposing = false;
m_compositionContext.focusObject = 0;
m_compositionContext.focusObject = nullptr;
}
bool QWindowsInputContext::handleIME_Request(WPARAM wParam,

View File

@ -461,7 +461,7 @@ QPlatformOpenGLContext *QWindowsIntegration::createPlatformOpenGLContext(QOpenGL
if (result->isValid())
return result.take();
}
return 0;
return nullptr;
}
QOpenGLContext::OpenGLModuleType QWindowsIntegration::openGLModuleType()
@ -481,7 +481,7 @@ QWindowsStaticOpenGLContext *QWindowsIntegration::staticOpenGLContext()
{
QWindowsIntegration *integration = QWindowsIntegration::instance();
if (!integration)
return 0;
return nullptr;
QWindowsIntegrationPrivate *d = integration->d.data();
QMutexLocker lock(&d->m_staticContextLock);
if (d->m_staticOpenGLContext.isNull())

View File

@ -70,7 +70,7 @@ bool QWindowsInternalMimeData::hasFormat_sys(const QString &mime) const
return false;
const QWindowsMimeConverter &mc = QWindowsContext::instance()->mimeConverter();
const bool has = mc.converterToMime(mime, pDataObj) != 0;
const bool has = mc.converterToMime(mime, pDataObj) != nullptr;
releaseDataObject(pDataObj);
qCDebug(lcQpaMime) << __FUNCTION__ << mime << has;
return has;

View File

@ -97,7 +97,7 @@ QT_BEGIN_NAMESPACE
static void clearKeyRecorderOnApplicationInActive(Qt::ApplicationState state);
QWindowsKeyMapper::QWindowsKeyMapper()
: m_useRTLExtensions(false), m_keyGrabber(0)
: m_useRTLExtensions(false), m_keyGrabber(nullptr)
{
memset(keyLayout, 0, sizeof(keyLayout));
QGuiApplication *app = static_cast<QGuiApplication *>(QGuiApplication::instance());
@ -162,7 +162,7 @@ static void clearKeyRecorderOnApplicationInActive(Qt::ApplicationState state)
KeyRecord *KeyRecorder::findKey(int code, bool remove)
{
KeyRecord *result = 0;
KeyRecord *result = nullptr;
for (int i = 0; i < nrecs; ++i) {
if (records[i].code == code) {
if (remove) {
@ -605,7 +605,7 @@ inline quint32 winceKeyBend(quint32 keyCode)
}
// Translate a VK into a Qt key code, or unicode character
static inline quint32 toKeyOrUnicode(quint32 vk, quint32 scancode, unsigned char *kbdBuffer, bool *isDeadkey = 0)
static inline quint32 toKeyOrUnicode(quint32 vk, quint32 scancode, unsigned char *kbdBuffer, bool *isDeadkey = nullptr)
{
Q_ASSERT(vk > 0 && vk < 256);
quint32 code = 0;
@ -822,7 +822,7 @@ static void showSystemMenu(QWindow* w)
TPM_LEFTALIGN | TPM_TOPALIGN | TPM_NONOTIFY | TPM_RETURNCMD,
pos.x(), pos.y(),
topLevelHwnd,
0);
nullptr);
if (ret)
qWindowsWndProc(topLevelHwnd, WM_SYSCOMMAND, WPARAM(ret), 0);
}
@ -1023,13 +1023,15 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, MSG msg,
if (dirStatus == VK_LSHIFT
&& ((msg.wParam == VK_SHIFT && GetKeyState(VK_LCONTROL))
|| (msg.wParam == VK_CONTROL && GetKeyState(VK_LSHIFT)))) {
sendExtendedPressRelease(receiver, Qt::Key_Direction_L, 0, scancode, vk_key, nModifiers, QString(), false);
sendExtendedPressRelease(receiver, Qt::Key_Direction_L, nullptr,
scancode, vk_key, nModifiers, QString(), false);
result = true;
dirStatus = 0;
} else if (dirStatus == VK_RSHIFT
&& ( (msg.wParam == VK_SHIFT && GetKeyState(VK_RCONTROL))
|| (msg.wParam == VK_CONTROL && GetKeyState(VK_RSHIFT)))) {
sendExtendedPressRelease(receiver, Qt::Key_Direction_R, 0, scancode, vk_key, nModifiers, QString(), false);
sendExtendedPressRelease(receiver, Qt::Key_Direction_R, nullptr,
scancode, vk_key, nModifiers, QString(), false);
result = true;
dirStatus = 0;
} else {
@ -1140,7 +1142,7 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, MSG msg,
// This will stop the auto-repeat of the key, should a modifier change, for example
if (rec && rec->state != state) {
key_recorder.findKey(int(msg.wParam), true);
rec = 0;
rec = nullptr;
}
// Find unicode character from Windows Message Queue
@ -1150,7 +1152,7 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, MSG msg,
: msgType == WM_IME_KEYDOWN ? WM_IME_CHAR : WM_SYSCHAR);
QChar uch;
if (PeekMessage(&wm_char, 0, charType, charType, PM_REMOVE)) {
if (PeekMessage(&wm_char, nullptr, charType, charType, PM_REMOVE)) {
if (QWindowsContext::filterNativeEvent(&wm_char, lResult))
return true;
if (receiver && QWindowsContext::filterNativeEvent(receiver, &wm_char, lResult))

View File

@ -797,7 +797,7 @@ QWindowsMenuBar *QWindowsMenuBar::menuBarOf(const QWindow *notYetCreatedWindow)
static inline void forceNcCalcSize(HWND hwnd)
{
// Force WM_NCCALCSIZE to adjust margin: Does not appear to work?
SetWindowPos(hwnd, 0, 0, 0, 0, 0,
SetWindowPos(hwnd, nullptr, 0, 0, 0, 0,
SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER);
}

View File

@ -312,7 +312,7 @@ static FORMATETC setCf(int cf)
formatetc.cfFormat = CLIPFORMAT(cf);
formatetc.dwAspect = DVASPECT_CONTENT;
formatetc.lindex = -1;
formatetc.ptd = NULL;
formatetc.ptd = nullptr;
formatetc.tymed = TYMED_HGLOBAL;
return formatetc;
}
@ -328,7 +328,7 @@ static bool setData(const QByteArray &data, STGMEDIUM *pmedium)
GlobalUnlock(hData);
pmedium->tymed = TYMED_HGLOBAL;
pmedium->hGlobal = hData;
pmedium->pUnkForRelease = 0;
pmedium->pUnkForRelease = nullptr;
return true;
}
@ -352,7 +352,7 @@ static QByteArray getData(int cf, IDataObject *pDataObj, int lindex = -1)
ULONG actualRead = 0;
LARGE_INTEGER pos = {{0, 0}};
//Move to front (can fail depending on the data model implemented)
HRESULT hr = s.pstm->Seek(pos, STREAM_SEEK_SET, NULL);
HRESULT hr = s.pstm->Seek(pos, STREAM_SEEK_SET, nullptr);
while(SUCCEEDED(hr)){
hr = s.pstm->Read(szBuffer, sizeof(szBuffer), &actualRead);
if (SUCCEEDED(hr) && actualRead > 0) {
@ -1123,11 +1123,11 @@ bool QWindowsMimeImage::convertFromMime(const FORMATETC &formatetc, const QMimeD
bool QWindowsMimeImage::hasOriginalDIBV5(IDataObject *pDataObj) const
{
bool isSynthesized = true;
IEnumFORMATETC *pEnum =NULL;
IEnumFORMATETC *pEnum = nullptr;
HRESULT res = pDataObj->EnumFormatEtc(1, &pEnum);
if (res == S_OK && pEnum) {
FORMATETC fc;
while ((res = pEnum->Next(1, &fc, 0)) == S_OK) {
while ((res = pEnum->Next(1, &fc, nullptr)) == S_OK) {
if (fc.ptd)
CoTaskMemFree(fc.ptd);
if (fc.cfFormat == CF_DIB)
@ -1398,7 +1398,7 @@ static bool isCustomMimeType(const QString &mimeType)
return mimeType.startsWith(QLatin1String(x_qt_windows_mime), Qt::CaseInsensitive);
}
static QString customMimeType(const QString &mimeType, int *lindex = 0)
static QString customMimeType(const QString &mimeType, int *lindex = nullptr)
{
int len = sizeof(x_qt_windows_mime) - 1;
int n = mimeType.lastIndexOf(QLatin1Char('\"')) - len;
@ -1510,7 +1510,7 @@ QWindowsMime * QWindowsMimeConverter::converterToMime(const QString &mimeType, I
if (m_mimes.at(i)->canConvertToMime(mimeType, pDataObj))
return m_mimes.at(i);
}
return 0;
return nullptr;
}
QStringList QWindowsMimeConverter::allMimesForFormats(IDataObject *pDataObj) const
@ -1523,7 +1523,7 @@ QStringList QWindowsMimeConverter::allMimesForFormats(IDataObject *pDataObj) con
if (hr == NOERROR) {
FORMATETC fmtetc;
while (S_OK == fmtenum->Next(1, &fmtetc, 0)) {
while (S_OK == fmtenum->Next(1, &fmtetc, nullptr)) {
for (int i= m_mimes.size() - 1; i >= 0; --i) {
QString format = m_mimes.at(i)->mimeForFormat(fmtetc);
if (!format.isEmpty() && !formats.contains(format)) {
@ -1550,7 +1550,7 @@ QWindowsMime * QWindowsMimeConverter::converterFromMime(const FORMATETC &formate
if (m_mimes.at(i)->canConvertFromMime(formatetc, mimeData))
return m_mimes.at(i);
}
return 0;
return nullptr;
}
QVector<FORMATETC> QWindowsMimeConverter::allFormatsForMime(const QMimeData *mimeData) const

View File

@ -75,11 +75,11 @@ static inline void compressMouseMove(MSG *msg)
// key release events (kls 2003-05-13):
MSG keyMsg;
bool done = false;
while (PeekMessage(&keyMsg, 0, WM_KEYFIRST, WM_KEYLAST,
while (PeekMessage(&keyMsg, nullptr, WM_KEYFIRST, WM_KEYLAST,
PM_NOREMOVE)) {
if (keyMsg.time < mouseMsg.time) {
if ((keyMsg.lParam & 0xC0000000) == 0x40000000) {
PeekMessage(&keyMsg, 0, keyMsg.message,
PeekMessage(&keyMsg, nullptr, keyMsg.message,
keyMsg.message, PM_REMOVE);
} else {
done = true;
@ -121,7 +121,7 @@ static inline QTouchDevice *createTouchDevice()
{
const int digitizers = GetSystemMetrics(SM_DIGITIZER);
if (!(digitizers & (NID_INTEGRATED_TOUCH | NID_EXTERNAL_TOUCH)))
return 0;
return nullptr;
const int tabletPc = GetSystemMetrics(SM_TABLETPC);
const int maxTouchPoints = GetSystemMetrics(SM_MAXIMUMTOUCHES);
qCDebug(lcQpaEvents) << "Digitizers:" << hex << showbase << (digitizers & ~NID_READY)
@ -159,7 +159,7 @@ QTouchDevice *QWindowsMouseHandler::ensureTouchDevice()
Qt::MouseButtons QWindowsMouseHandler::queryMouseButtons()
{
Qt::MouseButtons result = 0;
Qt::MouseButtons result = nullptr;
const bool mouseSwapped = GetSystemMetrics(SM_SWAPBUTTON);
if (GetAsyncKeyState(VK_LBUTTON) < 0)
result |= mouseSwapped ? Qt::RightButton: Qt::LeftButton;
@ -327,8 +327,8 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd,
QWindow *leaveTarget = m_windowUnderMouse ? m_windowUnderMouse : m_trackedWindow;
qCDebug(lcQpaEvents) << "Generating leave event for " << leaveTarget;
QWindowSystemInterface::handleLeaveEvent(leaveTarget);
m_trackedWindow = 0;
m_windowUnderMouse = 0;
m_trackedWindow = nullptr;
m_windowUnderMouse = nullptr;
}
return true;
}
@ -430,7 +430,7 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd,
if (currentNotCapturing) {
// Clear tracking if capturing and current window is not the capturing window
// to avoid leave when mouse actually leaves the application.
m_trackedWindow = 0;
m_trackedWindow = nullptr;
// We are not officially in any window, but we need to set some cursor to clear
// whatever cursor the left window had, so apply the cursor of the capture window.
platformWindow->applyCursor();
@ -464,7 +464,7 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd,
QWindowsKeyMapper::queryKeyboardModifiers(),
source);
}
m_previousCaptureWindow = hasCapture ? window : 0;
m_previousCaptureWindow = hasCapture ? window : nullptr;
// QTBUG-48117, force synchronous handling for the extra buttons so that WM_APPCOMMAND
// is sent for unhandled WM_XBUTTONDOWN.
return (msg.message != WM_XBUTTONUP && msg.message != WM_XBUTTONDOWN && msg.message != WM_XBUTTONDBLCLK)
@ -595,7 +595,7 @@ bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND,
QTouchPointList touchPoints;
touchPoints.reserve(winTouchPointCount);
Qt::TouchPointStates allStates = 0;
Qt::TouchPointStates allStates = nullptr;
GetTouchInputInfo(reinterpret_cast<HTOUCHINPUT>(msg.lParam),
UINT(msg.wParam), winTouchInputs.data(), sizeof(TOUCHINPUT));

View File

@ -95,7 +95,7 @@ void *QWindowsNativeInterface::nativeResourceForWindow(const QByteArray &resourc
{
if (!window || !window->handle()) {
qWarning("%s: '%s' requested for null window or window without handle.", __FUNCTION__, resource.constData());
return 0;
return nullptr;
}
QWindowsWindow *bw = static_cast<QWindowsWindow *>(window->handle());
int type = resourceType(resource);
@ -108,7 +108,7 @@ void *QWindowsNativeInterface::nativeResourceForWindow(const QByteArray &resourc
return bw->getDC();
if (type == ReleaseDCType) {
bw->releaseDC();
return 0;
return nullptr;
}
break;
case QWindow::VulkanSurface:
@ -121,7 +121,7 @@ void *QWindowsNativeInterface::nativeResourceForWindow(const QByteArray &resourc
break;
}
qWarning("%s: Invalid key '%s' requested.", __FUNCTION__, resource.constData());
return 0;
return nullptr;
}
#ifndef QT_NO_CURSOR
@ -179,7 +179,7 @@ void *QWindowsNativeInterface::nativeResourceForIntegration(const QByteArray &re
}
#endif
return 0;
return nullptr;
}
#ifndef QT_NO_OPENGL
@ -187,7 +187,7 @@ void *QWindowsNativeInterface::nativeResourceForContext(const QByteArray &resour
{
if (!context || !context->handle()) {
qWarning("%s: '%s' requested for null context or context without handle.", __FUNCTION__, resource.constData());
return 0;
return nullptr;
}
QWindowsOpenGLContext *glcontext = static_cast<QWindowsOpenGLContext *>(context->handle());
@ -204,7 +204,7 @@ void *QWindowsNativeInterface::nativeResourceForContext(const QByteArray &resour
}
qWarning("%s: Invalid key '%s' requested.", __FUNCTION__, resource.constData());
return 0;
return nullptr;
}
#endif // !QT_NO_OPENGL

View File

@ -84,7 +84,7 @@ QWindowsOleDataObject::~QWindowsOleDataObject() = default;
void QWindowsOleDataObject::releaseQt()
{
data = 0;
data = nullptr;
}
QMimeData *QWindowsOleDataObject::mimeData() const
@ -142,7 +142,7 @@ QWindowsOleDataObject::QueryGetData(LPFORMATETC pformatetc)
STDMETHODIMP
QWindowsOleDataObject::GetCanonicalFormatEtc(LPFORMATETC, LPFORMATETC pformatetcOut)
{
pformatetcOut->ptd = NULL;
pformatetcOut->ptd = nullptr;
return ResultFromScode(E_NOTIMPL);
}
@ -188,7 +188,7 @@ QWindowsOleDataObject::EnumFormatEtc(DWORD dwDirection, LPENUMFORMATETC FAR* ppe
formatetc.cfFormat = CLIPFORMAT(CF_PERFORMEDDROPEFFECT);
formatetc.dwAspect = DVASPECT_CONTENT;
formatetc.lindex = -1;
formatetc.ptd = NULL;
formatetc.ptd = nullptr;
formatetc.tymed = TYMED_HGLOBAL;
fmtetcs.append(formatetc);
}
@ -197,7 +197,7 @@ QWindowsOleDataObject::EnumFormatEtc(DWORD dwDirection, LPENUMFORMATETC FAR* ppe
*ppenumFormatEtc = enumFmtEtc;
if (enumFmtEtc->isNull()) {
delete enumFmtEtc;
*ppenumFormatEtc = NULL;
*ppenumFormatEtc = nullptr;
sc = E_OUTOFMEMORY;
}
@ -295,7 +295,7 @@ QWindowsOleEnumFmtEtc::Next(ULONG celt, LPFORMATETC rgelt, ULONG FAR* pceltFetch
ULONG i=0;
ULONG nOffset;
if (rgelt == NULL)
if (rgelt == nullptr)
return ResultFromScode(E_INVALIDARG);
while (i < celt) {
@ -311,7 +311,7 @@ QWindowsOleEnumFmtEtc::Next(ULONG celt, LPFORMATETC rgelt, ULONG FAR* pceltFetch
m_nIndex += i;
if (pceltFetched != NULL)
if (pceltFetched != nullptr)
*pceltFetched = i;
if (i != celt)
@ -354,7 +354,7 @@ QWindowsOleEnumFmtEtc::Reset()
STDMETHODIMP
QWindowsOleEnumFmtEtc::Clone(LPENUMFORMATETC FAR* newEnum)
{
if (newEnum == NULL)
if (newEnum == nullptr)
return ResultFromScode(E_INVALIDARG);
QWindowsOleEnumFmtEtc *result = new QWindowsOleEnumFmtEtc(m_lpfmtetcs);
@ -371,7 +371,7 @@ QWindowsOleEnumFmtEtc::Clone(LPENUMFORMATETC FAR* newEnum)
bool QWindowsOleEnumFmtEtc::copyFormatEtc(LPFORMATETC dest, const FORMATETC *src) const
{
if (dest == NULL || src == NULL)
if (dest == nullptr || src == nullptr)
return false;
*dest = *src;

View File

@ -330,10 +330,10 @@ bool QWindowsOpenGLTester::testDesktopGL()
typedef BOOL (WINAPI *MakeCurrentType)(HDC, HGLRC);
typedef PROC (WINAPI *WglGetProcAddressType)(LPCSTR);
HMODULE lib = 0;
HWND wnd = 0;
HDC dc = 0;
HGLRC context = 0;
HMODULE lib = nullptr;
HWND wnd = nullptr;
HDC dc = nullptr;
HGLRC context = nullptr;
LPCTSTR className = L"qtopengltest";
CreateContextType CreateContext = nullptr;
@ -367,18 +367,18 @@ bool QWindowsOpenGLTester::testDesktopGL()
WNDCLASS wclass;
wclass.cbClsExtra = 0;
wclass.cbWndExtra = 0;
wclass.hInstance = static_cast<HINSTANCE>(GetModuleHandle(0));
wclass.hIcon = 0;
wclass.hCursor = 0;
wclass.hInstance = static_cast<HINSTANCE>(GetModuleHandle(nullptr));
wclass.hIcon = nullptr;
wclass.hCursor = nullptr;
wclass.hbrBackground = HBRUSH(COLOR_BACKGROUND);
wclass.lpszMenuName = 0;
wclass.lpszMenuName = nullptr;
wclass.lpfnWndProc = DefWindowProc;
wclass.lpszClassName = className;
wclass.style = CS_OWNDC;
if (!RegisterClass(&wclass))
goto cleanup;
wnd = CreateWindow(className, L"qtopenglproxytest", WS_OVERLAPPED,
0, 0, 640, 480, 0, 0, wclass.hInstance, 0);
0, 0, 640, 480, nullptr, nullptr, wclass.hInstance, nullptr);
if (!wnd)
goto cleanup;
dc = GetDC(wnd);
@ -447,14 +447,14 @@ bool QWindowsOpenGLTester::testDesktopGL()
cleanup:
if (MakeCurrent)
MakeCurrent(0, 0);
MakeCurrent(nullptr, nullptr);
if (context)
DeleteContext(context);
if (dc && wnd)
ReleaseDC(wnd, dc);
if (wnd) {
DestroyWindow(wnd);
UnregisterClass(className, GetModuleHandle(0));
UnregisterClass(className, GetModuleHandle(nullptr));
}
// No FreeLibrary. Some implementations, Mesa in particular, deadlock when trying to unload.

View File

@ -89,7 +89,7 @@ static bool monitorData(HMONITOR hMonitor, QWindowsScreenData *data)
if (data->name == QLatin1String("WinDisc")) {
data->flags |= QWindowsScreenData::LockScreen;
} else {
if (const HDC hdc = CreateDC(info.szDevice, NULL, NULL, NULL)) {
if (const HDC hdc = CreateDC(info.szDevice, nullptr, nullptr, nullptr)) {
const QDpi dpi = monitorDPI(hMonitor);
data->dpi = dpi.first ? dpi : deviceDPI(hdc);
data->depth = GetDeviceCaps(hdc, BITSPIXEL);
@ -137,7 +137,7 @@ BOOL QT_WIN_CALLBACK monitorEnumCallback(HMONITOR hMonitor, HDC, LPRECT, LPARAM
static inline WindowsScreenDataList monitorData()
{
WindowsScreenDataList result;
EnumDisplayMonitors(0, 0, monitorEnumCallback, reinterpret_cast<LPARAM>(&result));
EnumDisplayMonitors(nullptr, nullptr, monitorEnumCallback, reinterpret_cast<LPARAM>(&result));
return result;
}
@ -209,7 +209,7 @@ QPixmap QWindowsScreen::grabWindow(WId window, int xIn, int yIn, int width, int
height = windowSize.height() - yIn;
// Create and setup bitmap
HDC display_dc = GetDC(0);
HDC display_dc = GetDC(nullptr);
HDC bitmap_dc = CreateCompatibleDC(display_dc);
HBITMAP bitmap = CreateCompatibleBitmap(display_dc, width, height);
HGDIOBJ null_bitmap = SelectObject(bitmap_dc, bitmap);
@ -226,7 +226,7 @@ QPixmap QWindowsScreen::grabWindow(WId window, int xIn, int yIn, int width, int
const QPixmap pixmap = qt_pixmapFromWinHBITMAP(bitmap);
DeleteObject(bitmap);
ReleaseDC(0, display_dc);
ReleaseDC(nullptr, display_dc);
return pixmap;
}
@ -237,7 +237,7 @@ QPixmap QWindowsScreen::grabWindow(WId window, int xIn, int yIn, int width, int
QWindow *QWindowsScreen::topLevelAt(const QPoint &point) const
{
QWindow *result = 0;
QWindow *result = nullptr;
if (QWindow *child = QWindowsScreen::windowAt(point, CWP_SKIPINVISIBLE))
result = QWindowsWindow::topLevelOf(child);
qCDebug(lcQpaWindows) <<__FUNCTION__ << point << result;
@ -246,7 +246,7 @@ QWindow *QWindowsScreen::topLevelAt(const QPoint &point) const
QWindow *QWindowsScreen::windowAt(const QPoint &screenPoint, unsigned flags)
{
QWindow* result = 0;
QWindow* result = nullptr;
if (QPlatformWindow *bw = QWindowsContext::instance()->
findPlatformWindowAt(GetDesktopWindow(), screenPoint, flags))
result = bw->window();
@ -576,7 +576,7 @@ const QWindowsScreen *QWindowsScreenManager::screenAtDp(const QPoint &p) const
const QWindowsScreen *QWindowsScreenManager::screenForHwnd(HWND hwnd) const
{
HMONITOR hMonitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONULL);
if (hMonitor == NULL)
if (hMonitor == nullptr)
return nullptr;
const auto it =
std::find_if(m_screens.cbegin(), m_screens.cend(),

View File

@ -58,9 +58,9 @@ static inline bool shellExecute(const QUrl &url)
? QDir::toNativeSeparators(url.toLocalFile())
: url.toString(QUrl::FullyEncoded);
const quintptr result =
reinterpret_cast<quintptr>(ShellExecute(0, 0,
reinterpret_cast<quintptr>(ShellExecute(nullptr, nullptr,
reinterpret_cast<const wchar_t *>(nativeFilePath.utf16()),
0, 0, SW_SHOWNORMAL));
nullptr, nullptr, SW_SHOWNORMAL));
// ShellExecute returns a value greater than 32 if successful
if (result <= 32) {
qWarning("ShellExecute '%s' failed (error %s).", qPrintable(url.toString()), qPrintable(QString::number(result)));
@ -84,7 +84,7 @@ static inline QString mailCommand()
QString keyName;
if (!RegOpenKeyEx(HKEY_CURRENT_USER, mailUserKey, 0, KEY_READ, &handle)) {
DWORD bufferSize = BufferSize;
if (!RegQueryValueEx(handle, L"Progid", 0, 0, reinterpret_cast<unsigned char*>(command), &bufferSize))
if (!RegQueryValueEx(handle, L"Progid", nullptr, nullptr, reinterpret_cast<unsigned char*>(command), &bufferSize))
keyName = QString::fromWCharArray(command);
RegCloseKey(handle);
}
@ -95,7 +95,7 @@ static inline QString mailCommand()
command[0] = 0;
if (!RegOpenKeyExW(HKEY_CLASSES_ROOT, reinterpret_cast<const wchar_t*>(keyName.utf16()), 0, KEY_READ, &handle)) {
DWORD bufferSize = BufferSize;
RegQueryValueEx(handle, L"", 0, 0, reinterpret_cast<unsigned char*>(command), &bufferSize);
RegQueryValueEx(handle, L"", nullptr, nullptr, reinterpret_cast<unsigned char*>(command), &bufferSize);
RegCloseKey(handle);
}
// QTBUG-57816: As of Windows 10, if there is no mail client installed, an entry like
@ -136,8 +136,8 @@ static inline bool launchMail(const QUrl &url)
STARTUPINFO si;
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
if (!CreateProcess(NULL, reinterpret_cast<wchar_t *>(const_cast<ushort *>(command.utf16())),
NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) {
if (!CreateProcess(nullptr, reinterpret_cast<wchar_t *>(const_cast<ushort *>(command.utf16())),
nullptr, nullptr, FALSE, 0, nullptr, nullptr, &si, &pi)) {
qErrnoWarning("Unable to launch '%s'", qPrintable(command));
return false;
}

View File

@ -160,7 +160,7 @@ static inline HWND createTrayIconMessageWindow()
{
QWindowsContext *ctx = QWindowsContext::instance();
if (!ctx)
return 0;
return nullptr;
// Register window class in the platform plugin.
const QString className =
ctx->registerWindowClass(QStringLiteral("QTrayIconMessageWindowClass"),
@ -170,7 +170,8 @@ static inline HWND createTrayIconMessageWindow()
windowName, WS_OVERLAPPED,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
NULL, NULL, (HINSTANCE)GetModuleHandle(0), NULL);
nullptr, nullptr,
static_cast<HINSTANCE>(GetModuleHandle(nullptr)), nullptr);
}
/*!

View File

@ -159,7 +159,7 @@ public:
void run() override
{
m_init = CoInitializeEx(NULL, COINIT_MULTITHREADED);
m_init = CoInitializeEx(nullptr, COINIT_MULTITHREADED);
QMutexLocker readyLocker(&m_readyMutex);
while (!m_cancelled.load()) {
@ -381,7 +381,7 @@ static inline QPalette menuPalette(const QPalette &systemPalette)
static inline QPalette *menuBarPalette(const QPalette &menuPalette)
{
QPalette *result = 0;
QPalette *result = nullptr;
if (booleanSystemParametersInfo(SPI_GETFLATMENU, false)) {
result = new QPalette(menuPalette);
const QColor menubar(getSysColor(COLOR_MENUBAR));
@ -393,13 +393,13 @@ static inline QPalette *menuBarPalette(const QPalette &menuPalette)
}
const char *QWindowsTheme::name = "windows";
QWindowsTheme *QWindowsTheme::m_instance = 0;
QWindowsTheme *QWindowsTheme::m_instance = nullptr;
QWindowsTheme::QWindowsTheme()
{
m_instance = this;
std::fill(m_fonts, m_fonts + NFonts, static_cast<QFont *>(0));
std::fill(m_palettes, m_palettes + NPalettes, static_cast<QPalette *>(0));
std::fill(m_fonts, m_fonts + NFonts, nullptr);
std::fill(m_palettes, m_palettes + NPalettes, nullptr);
refresh();
refreshIconPixmapSizes();
}
@ -408,7 +408,7 @@ QWindowsTheme::~QWindowsTheme()
{
clearPalettes();
clearFonts();
m_instance = 0;
m_instance = nullptr;
}
static inline QStringList iconThemeSearchPaths()
@ -481,7 +481,7 @@ QVariant QWindowsTheme::themeHint(ThemeHint hint) const
void QWindowsTheme::clearPalettes()
{
qDeleteAll(m_palettes, m_palettes + NPalettes);
std::fill(m_palettes, m_palettes + NPalettes, static_cast<QPalette *>(0));
std::fill(m_palettes, m_palettes + NPalettes, nullptr);
}
void QWindowsTheme::refreshPalettes()
@ -498,7 +498,7 @@ void QWindowsTheme::refreshPalettes()
void QWindowsTheme::clearFonts()
{
qDeleteAll(m_fonts, m_fonts + NFonts);
std::fill(m_fonts, m_fonts + NFonts, static_cast<QFont *>(0));
std::fill(m_fonts, m_fonts + NFonts, nullptr);
}
void QWindowsTheme::refreshFonts()
@ -606,7 +606,7 @@ QPixmap QWindowsTheme::standardPixmap(StandardPixmap sp, const QSizeF &pixmapSiz
int resourceId = -1;
SHSTOCKICONID stockId = SIID_INVALID;
UINT stockFlags = 0;
LPCTSTR iconName = 0;
LPCTSTR iconName = nullptr;
switch (sp) {
case DriveCDIcon:
stockId = SIID_DRIVECD;
@ -716,7 +716,7 @@ QPixmap QWindowsTheme::standardPixmap(StandardPixmap sp, const QSizeF &pixmapSiz
}
if (iconName) {
HICON iconHandle = LoadIcon(NULL, iconName);
HICON iconHandle = LoadIcon(nullptr, iconName);
QPixmap pixmap = qt_pixmapFromWinHICON(iconHandle);
DestroyIcon(iconHandle);
if (!pixmap.isNull())
@ -776,7 +776,7 @@ static QPixmap pixmapFromShellImageList(int iImageList, const SHFILEINFO &info)
// For MinGW:
static const IID iID_IImageList = {0x46eb5926, 0x582e, 0x4017, {0x9f, 0xdf, 0xe8, 0x99, 0x8d, 0xaa, 0x9, 0x50}};
IImageList *imageList = 0;
IImageList *imageList = nullptr;
HRESULT hr = SHGetImageList(iImageList, iID_IImageList, reinterpret_cast<void **>(&imageList));
if (hr != S_OK)
return result;
@ -832,7 +832,7 @@ QPixmap QWindowsFileIconEngine::filePixmap(const QSize &size, QIcon::Mode, QIcon
{
/* We don't use the variable, but by storing it statically, we
* ensure CoInitialize is only called once. */
static HRESULT comInit = CoInitialize(NULL);
static HRESULT comInit = CoInitialize(nullptr);
Q_UNUSED(comInit);
static QCache<QString, FakePointer<int> > dirIconEntryCache(1000);

View File

@ -347,7 +347,7 @@ static bool applyBlurBehindWindow(HWND hwnd)
if (DwmIsCompositionEnabled(&compositionEnabled) != S_OK)
return false;
DWM_BLURBEHIND blurBehind = {0, 0, 0, 0};
DWM_BLURBEHIND blurBehind = {0, 0, nullptr, 0};
if (compositionEnabled) {
blurBehind.dwFlags = DWM_BB_ENABLE | DWM_BB_BLURREGION;
@ -403,12 +403,12 @@ static void setWindowOpacity(HWND hwnd, Qt::WindowFlags flags, bool hasAlpha, bo
if (hasAlpha && !accelerated && (flags & Qt::FramelessWindowHint)) {
// Non-GL windows with alpha: Use blend function to update.
BLENDFUNCTION blend = {AC_SRC_OVER, 0, alpha, AC_SRC_ALPHA};
UpdateLayeredWindow(hwnd, NULL, NULL, NULL, NULL, NULL, 0, &blend, ULW_ALPHA);
UpdateLayeredWindow(hwnd, nullptr, nullptr, nullptr, nullptr, nullptr, 0, &blend, ULW_ALPHA);
} else {
SetLayeredWindowAttributes(hwnd, 0, alpha, LWA_ALPHA);
}
} else if (IsWindowVisible(hwnd)) { // Repaint when switching from layered.
InvalidateRect(hwnd, NULL, TRUE);
InvalidateRect(hwnd, nullptr, TRUE);
}
}
@ -764,7 +764,7 @@ QWindowsWindowData
style,
pos.x(), pos.y(),
context->frameWidth, context->frameHeight,
parentHandle, NULL, appinst, NULL);
parentHandle, nullptr, appinst, nullptr);
qCDebug(lcQpaWindows).nospace()
<< "CreateWindowEx: returns " << w << ' ' << result.hwnd << " obtained geometry: "
<< context->obtainedGeometry << ' ' << context->margins;
@ -898,7 +898,7 @@ bool QWindowsGeometryHint::handleCalculateSize(const QMargins &customMargins, co
ncp->rgrc[0].top += customMargins.top();
ncp->rgrc[0].right -= customMargins.right();
ncp->rgrc[0].bottom -= customMargins.bottom();
result = 0;
result = nullptr;
qCDebug(lcQpaWindows).nospace() << __FUNCTION__ << oldClientArea << '+' << customMargins << "-->"
<< ncp->rgrc[0] << ' ' << ncp->rgrc[1] << ' ' << ncp->rgrc[2]
<< ' ' << ncp->lppos->cx << ',' << ncp->lppos->cy;
@ -973,7 +973,7 @@ QWindowsBaseWindow *QWindowsBaseWindow::baseWindowOf(const QWindow *w)
HWND QWindowsBaseWindow::handleOf(const QWindow *w)
{
const QWindowsBaseWindow *bw = QWindowsBaseWindow::baseWindowOf(w);
return bw ? bw->handle() : HWND(0);
return bw ? bw->handle() : HWND(nullptr);
}
bool QWindowsBaseWindow::isTopLevel_sys() const
@ -999,7 +999,7 @@ QMargins QWindowsBaseWindow::frameMargins_sys() const
void QWindowsBaseWindow::hide_sys() // Normal hide, do not activate other windows.
{
SetWindowPos(handle(),0 , 0, 0, 0, 0,
SetWindowPos(handle(), nullptr , 0, 0, 0, 0,
SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
}
@ -1068,7 +1068,7 @@ QWindowsForeignWindow::QWindowsForeignWindow(QWindow *window, HWND hwnd)
void QWindowsForeignWindow::setParent(const QPlatformWindow *newParentWindow)
{
const bool wasTopLevel = isTopLevel_sys();
const HWND newParent = newParentWindow ? reinterpret_cast<HWND>(newParentWindow->winId()) : HWND(0);
const HWND newParent = newParentWindow ? reinterpret_cast<HWND>(newParentWindow->winId()) : HWND(nullptr);
const bool isTopLevel = !newParent;
const DWORD oldStyle = style();
qCDebug(lcQpaWindows) << __FUNCTION__ << window() << "newParent="
@ -1299,7 +1299,7 @@ void QWindowsWindow::destroyWindow()
#endif
DestroyWindow(m_data.hwnd);
context->removeWindow(m_data.hwnd);
m_data.hwnd = 0;
m_data.hwnd = nullptr;
}
}
@ -1348,7 +1348,7 @@ void QWindowsWindow::setDropSiteEnabled(bool dropEnabled)
CoLockObjectExternal(m_dropTarget, false, true);
m_dropTarget->Release();
RevokeDragDrop(m_data.hwnd);
m_dropTarget = 0;
m_dropTarget = nullptr;
}
#endif // QT_CONFIG(clipboard) && QT_CONFIG(draganddrop)
}
@ -1491,7 +1491,7 @@ void QWindowsWindow::updateTransientParent() const
return; // QTBUG-34503, // a popup stays on top, no parent, see also WindowCreationData::fromWindow().
// Update transient parent.
const HWND oldTransientParent = GetWindow(m_data.hwnd, GW_OWNER);
HWND newTransientParent = 0;
HWND newTransientParent = nullptr;
if (const QWindow *tp = window()->transientParent())
if (const QWindowsWindow *tw = QWindowsWindow::windowsWindowOf(tp))
if (!tw->testFlag(WithinDestroy)) // Prevent destruction by parent window (QTBUG-35499, QTBUG-36666)
@ -1584,7 +1584,7 @@ void QWindowsWindow::show_sys() const
if (fakedMaximize) {
setStyle(style() & ~WS_MAXIMIZEBOX);
SetWindowPos(m_data.hwnd, 0, 0, 0, 0, 0,
SetWindowPos(m_data.hwnd, nullptr, 0, 0, 0, 0,
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER
| SWP_FRAMECHANGED);
}
@ -1604,7 +1604,7 @@ void QWindowsWindow::setParent_sys(const QPlatformWindow *parent)
{
// Use GetAncestor instead of GetParent, as GetParent can return owner window for toplevels
HWND oldParentHWND = parentHwnd();
HWND newParentHWND = 0;
HWND newParentHWND = nullptr;
if (parent) {
const QWindowsWindow *parentW = static_cast<const QWindowsWindow *>(parent);
newParentHWND = parentW->handle();
@ -1614,13 +1614,13 @@ void QWindowsWindow::setParent_sys(const QPlatformWindow *parent)
// NULL handle means desktop window, which also has its proper handle -> disambiguate
HWND desktopHwnd = GetDesktopWindow();
if (oldParentHWND == desktopHwnd)
oldParentHWND = 0;
oldParentHWND = nullptr;
if (newParentHWND == desktopHwnd)
newParentHWND = 0;
newParentHWND = nullptr;
if (newParentHWND != oldParentHWND) {
const bool wasTopLevel = oldParentHWND == 0;
const bool isTopLevel = newParentHWND == 0;
const bool wasTopLevel = oldParentHWND == nullptr;
const bool isTopLevel = newParentHWND == nullptr;
setFlag(WithinSetParent);
SetParent(m_data.hwnd, newParentHWND);
@ -1847,7 +1847,7 @@ void QWindowsWindow::releaseDC()
{
if (m_hdc) {
ReleaseDC(handle(), m_hdc);
m_hdc = 0;
m_hdc = nullptr;
}
}
@ -1881,7 +1881,7 @@ bool QWindowsWindow::handleWmPaint(HWND hwnd, UINT message,
// GL software rendering (QTBUG-58178) and Windows 7/Aero off with some AMD cards
// (QTBUG-60527) need InvalidateRect() to suppress artifacts while resizing.
if (testFlag(OpenGLSurface) && (isSoftwareGl() || !dwmIsCompositionEnabled()))
InvalidateRect(hwnd, 0, false);
InvalidateRect(hwnd, nullptr, false);
BeginPaint(hwnd, &ps);
@ -1889,7 +1889,7 @@ bool QWindowsWindow::handleWmPaint(HWND hwnd, UINT message,
if (Q_UNLIKELY(!dwmIsCompositionEnabled())
&& ((testFlag(OpenGLSurface) && testFlag(OpenGLDoubleBuffered)) || testFlag(VulkanSurface)))
{
SelectClipRgn(ps.hdc, NULL);
SelectClipRgn(ps.hdc, nullptr);
}
// If the a window is obscured by another window (such as a child window)
@ -2100,7 +2100,7 @@ void QWindowsWindow::setWindowState_sys(Qt::WindowStates newState)
// it before applying the normal geometry.
if (windowVisibility_sys(m_data.hwnd) == QWindow::Maximized)
ShowWindow(m_data.hwnd, SW_SHOWNOACTIVATE);
SetWindowPos(m_data.hwnd, 0, m_savedFrameGeometry.x(), m_savedFrameGeometry.y(),
SetWindowPos(m_data.hwnd, nullptr, m_savedFrameGeometry.x(), m_savedFrameGeometry.y(),
m_savedFrameGeometry.width(), m_savedFrameGeometry.height(), swpf);
if (!wasSync)
clearFlag(SynchronousGeometryChangeEvent);
@ -2286,7 +2286,7 @@ static HRGN qRegionToWinRegion(const QRegion &region)
void QWindowsWindow::setMask(const QRegion &region)
{
if (region.isEmpty()) {
SetWindowRgn(m_data.hwnd, 0, true);
SetWindowRgn(m_data.hwnd, nullptr, true);
return;
}
const HRGN winRegion = qRegionToWinRegion(region);
@ -2319,7 +2319,7 @@ void QWindowsWindow::requestActivateWindow()
if (QGuiApplication::applicationState() != Qt::ApplicationActive
&& QWindowsNativeInterface::windowActivationBehavior() == QWindowsWindowFunctions::AlwaysActivateWindow) {
if (const HWND foregroundWindow = GetForegroundWindow()) {
foregroundThread = GetWindowThreadProcessId(foregroundWindow, NULL);
foregroundThread = GetWindowThreadProcessId(foregroundWindow, nullptr);
if (foregroundThread && foregroundThread != currentThread)
attached = AttachThreadInput(foregroundThread, currentThread, TRUE) == TRUE;
if (attached) {
@ -2353,7 +2353,7 @@ bool QWindowsWindow::setKeyboardGrabEnabled(bool grab)
context->setKeyGrabber(window());
} else {
if (context->keyGrabber() == window())
context->setKeyGrabber(0);
context->setKeyGrabber(nullptr);
}
return true;
}
@ -2653,7 +2653,7 @@ static HICON createHIcon(const QIcon &icon, int xSize, int ySize)
if (!pm.isNull())
return qt_pixmapToWinHICON(pm);
}
return 0;
return nullptr;
}
void QWindowsWindow::setWindowIcon(const QIcon &icon)
@ -2711,7 +2711,7 @@ void QWindowsWindow::setCustomMargins(const QMargins &newCustomMargins)
newFrame.moveTo(topLeft);
qCDebug(lcQpaWindows) << __FUNCTION__ << oldCustomMargins << "->" << newCustomMargins
<< currentFrameGeometry << "->" << newFrame;
SetWindowPos(m_data.hwnd, 0, newFrame.x(), newFrame.y(), newFrame.width(), newFrame.height(), SWP_NOZORDER | SWP_FRAMECHANGED | SWP_NOACTIVATE);
SetWindowPos(m_data.hwnd, nullptr, newFrame.x(), newFrame.y(), newFrame.width(), newFrame.height(), SWP_NOZORDER | SWP_FRAMECHANGED | SWP_NOACTIVATE);
}
}

View File

@ -90,7 +90,7 @@ HWND hwndForAccessible(const QAccessibleInterface *accessible)
return QWindowsBaseWindow::handleOf(window);
}
}
return NULL;
return nullptr;
}
void clearVariant(VARIANT *variant)