forked from github_mirror/framelesshelper
replace qAsConst with std::as_const
qAsConst is being deprecated in latest qtbase code. Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
parent
e77341d128
commit
b1f52837d2
|
@ -66,10 +66,6 @@ QT_END_NAMESPACE
|
||||||
Class &operator=(Class &&) = delete;
|
Class &operator=(Class &&) = delete;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 7, 0))
|
|
||||||
# define qAsConst(i) std::as_const(i)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 10, 0))
|
#if (QT_VERSION < QT_VERSION_CHECK(5, 10, 0))
|
||||||
using QStringView = const QString &;
|
using QStringView = const QString &;
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -259,7 +259,7 @@ void initialize()
|
||||||
|
|
||||||
const QMutexLocker locker(&coreData()->mutex);
|
const QMutexLocker locker(&coreData()->mutex);
|
||||||
if (!coreData()->initHooks.isEmpty()) {
|
if (!coreData()->initHooks.isEmpty()) {
|
||||||
for (auto &&hook : qAsConst(coreData()->initHooks)) {
|
for (auto &&hook : std::as_const(coreData()->initHooks)) {
|
||||||
Q_ASSERT(hook);
|
Q_ASSERT(hook);
|
||||||
if (!hook) {
|
if (!hook) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -281,7 +281,7 @@ void uninitialize()
|
||||||
if (coreData()->uninitHooks.isEmpty()) {
|
if (coreData()->uninitHooks.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (auto &&hook : qAsConst(coreData()->uninitHooks)) {
|
for (auto &&hook : std::as_const(coreData()->uninitHooks)) {
|
||||||
Q_ASSERT(hook);
|
Q_ASSERT(hook);
|
||||||
if (!hook) {
|
if (!hook) {
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -179,7 +179,7 @@ QWindow *Utils::findWindow(const WId windowId)
|
||||||
if (windows.isEmpty()) {
|
if (windows.isEmpty()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
for (auto &&window : qAsConst(windows)) {
|
for (auto &&window : std::as_const(windows)) {
|
||||||
if (window && window->handle()) {
|
if (window && window->handle()) {
|
||||||
if (window->winId() == windowId) {
|
if (window->winId() == windowId) {
|
||||||
return window;
|
return window;
|
||||||
|
|
|
@ -168,7 +168,7 @@ template<typename T>
|
||||||
if (screens.isEmpty()) {
|
if (screens.isEmpty()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
for (auto &&screen : qAsConst(screens)) {
|
for (auto &&screen : std::as_const(screens)) {
|
||||||
# if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
# if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
const auto qxcbScreen = dynamic_cast<QNativeInterface::Private::QXcbScreen *>(screen->handle());
|
const auto qxcbScreen = dynamic_cast<QNativeInterface::Private::QXcbScreen *>(screen->handle());
|
||||||
if (qxcbScreen && (qxcbScreen->virtualDesktopNumber() == virtualDesktopNumber)) {
|
if (qxcbScreen && (qxcbScreen->virtualDesktopNumber() == virtualDesktopNumber)) {
|
||||||
|
|
|
@ -590,7 +590,7 @@ Q_GLOBAL_STATIC(MacUtilsData, g_macUtilsData);
|
||||||
if (g_macUtilsData()->hash.isEmpty()) {
|
if (g_macUtilsData()->hash.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (auto &&proxy : qAsConst(g_macUtilsData()->hash)) {
|
for (auto &&proxy : std::as_const(g_macUtilsData()->hash)) {
|
||||||
Q_ASSERT(proxy);
|
Q_ASSERT(proxy);
|
||||||
if (!proxy) {
|
if (!proxy) {
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -487,7 +487,7 @@ void FramelessQuickHelperPrivate::emitSignalForAllInstances(const QByteArray &si
|
||||||
if (instances.isEmpty()) {
|
if (instances.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (auto &&instance : qAsConst(instances)) {
|
for (auto &&instance : std::as_const(instances)) {
|
||||||
QMetaObject::invokeMethod(instance, signal.constData());
|
QMetaObject::invokeMethod(instance, signal.constData());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -767,20 +767,20 @@ bool FramelessQuickHelperPrivate::isInTitleBarDraggableArea(const QPoint &pos) c
|
||||||
QRegion region = titleBarRect;
|
QRegion region = titleBarRect;
|
||||||
const auto systemButtons = {data.windowIconButton, data.contextHelpButton,
|
const auto systemButtons = {data.windowIconButton, data.contextHelpButton,
|
||||||
data.minimizeButton, data.maximizeButton, data.closeButton};
|
data.minimizeButton, data.maximizeButton, data.closeButton};
|
||||||
for (auto &&button : qAsConst(systemButtons)) {
|
for (auto &&button : std::as_const(systemButtons)) {
|
||||||
if (button && button->isVisible() && button->isEnabled()) {
|
if (button && button->isVisible() && button->isEnabled()) {
|
||||||
region -= mapItemGeometryToScene(button);
|
region -= mapItemGeometryToScene(button);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!data.hitTestVisibleItems.isEmpty()) {
|
if (!data.hitTestVisibleItems.isEmpty()) {
|
||||||
for (auto &&item : qAsConst(data.hitTestVisibleItems)) {
|
for (auto &&item : std::as_const(data.hitTestVisibleItems)) {
|
||||||
if (item && item->isVisible() && item->isEnabled()) {
|
if (item && item->isVisible() && item->isEnabled()) {
|
||||||
region -= mapItemGeometryToScene(item);
|
region -= mapItemGeometryToScene(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!data.hitTestVisibleRects.isEmpty()) {
|
if (!data.hitTestVisibleRects.isEmpty()) {
|
||||||
for (auto &&rect : qAsConst(data.hitTestVisibleRects)) {
|
for (auto &&rect : std::as_const(data.hitTestVisibleRects)) {
|
||||||
if (rect.isValid()) {
|
if (rect.isValid()) {
|
||||||
region -= rect;
|
region -= rect;
|
||||||
}
|
}
|
||||||
|
|
|
@ -220,7 +220,7 @@ void QuickMicaMaterialPrivate::forceRegenerateWallpaperImageCache()
|
||||||
if (m_nodes.isEmpty()) {
|
if (m_nodes.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (auto &&node : qAsConst(m_nodes)) {
|
for (auto &&node : std::as_const(m_nodes)) {
|
||||||
if (node) {
|
if (node) {
|
||||||
node->maybeGenerateWallpaperImageCache(true);
|
node->maybeGenerateWallpaperImageCache(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -170,7 +170,7 @@ void FramelessWidgetsHelperPrivate::emitSignalForAllInstances(const QByteArray &
|
||||||
if (instances.isEmpty()) {
|
if (instances.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (auto &&instance : qAsConst(instances)) {
|
for (auto &&instance : std::as_const(instances)) {
|
||||||
QMetaObject::invokeMethod(instance, signal.constData());
|
QMetaObject::invokeMethod(instance, signal.constData());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -657,20 +657,20 @@ bool FramelessWidgetsHelperPrivate::isInTitleBarDraggableArea(const QPoint &pos)
|
||||||
QRegion region = titleBarRect;
|
QRegion region = titleBarRect;
|
||||||
const auto systemButtons = {data.windowIconButton, data.contextHelpButton,
|
const auto systemButtons = {data.windowIconButton, data.contextHelpButton,
|
||||||
data.minimizeButton, data.maximizeButton, data.closeButton};
|
data.minimizeButton, data.maximizeButton, data.closeButton};
|
||||||
for (auto &&button : qAsConst(systemButtons)) {
|
for (auto &&button : std::as_const(systemButtons)) {
|
||||||
if (button && button->isVisible() && button->isEnabled()) {
|
if (button && button->isVisible() && button->isEnabled()) {
|
||||||
region -= mapWidgetGeometryToScene(button);
|
region -= mapWidgetGeometryToScene(button);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!data.hitTestVisibleWidgets.isEmpty()) {
|
if (!data.hitTestVisibleWidgets.isEmpty()) {
|
||||||
for (auto &&widget : qAsConst(data.hitTestVisibleWidgets)) {
|
for (auto &&widget : std::as_const(data.hitTestVisibleWidgets)) {
|
||||||
if (widget && widget->isVisible() && widget->isEnabled()) {
|
if (widget && widget->isVisible() && widget->isEnabled()) {
|
||||||
region -= mapWidgetGeometryToScene(widget);
|
region -= mapWidgetGeometryToScene(widget);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!data.hitTestVisibleRects.isEmpty()) {
|
if (!data.hitTestVisibleRects.isEmpty()) {
|
||||||
for (auto &&rect : qAsConst(data.hitTestVisibleRects)) {
|
for (auto &&rect : std::as_const(data.hitTestVisibleRects)) {
|
||||||
if (rect.isValid()) {
|
if (rect.isValid()) {
|
||||||
region -= rect;
|
region -= rect;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue