Drop Qt 5 support
Qt 6 has been available for almost 4 years. Qt 5 is no longer officially supported by Qt for opensource, it's time to drop Qt 5.
This commit is contained in:
@@ -43,11 +43,7 @@ void OpenInFileManager(const QString &path, const QUrl &url) {
|
||||
if (!url.isLocalFile()) return;
|
||||
|
||||
QProcess proc;
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
proc.startCommand(QStringLiteral("xdg-mime query default inode/directory"));
|
||||
#else
|
||||
proc.start(QStringLiteral("xdg-mime"), QStringList() << QStringLiteral("query") << QStringLiteral("default") << QStringLiteral("inode/directory"));
|
||||
#endif
|
||||
proc.waitForFinished();
|
||||
QString desktop_file = QString::fromUtf8(proc.readLine()).simplified();
|
||||
QString xdg_data_dirs = QString::fromUtf8(qgetenv("XDG_DATA_DIRS"));
|
||||
@@ -68,11 +64,7 @@ void OpenInFileManager(const QString &path, const QUrl &url) {
|
||||
if (cmd.isEmpty()) break;
|
||||
static const QRegularExpression regex(QStringLiteral("[%][a-zA-Z]*( |$)"), QRegularExpression::CaseInsensitiveOption);
|
||||
cmd = cmd.remove(regex);
|
||||
# if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
|
||||
command_params = cmd.split(QLatin1Char(' '), Qt::SkipEmptyParts);
|
||||
# else
|
||||
command_params = cmd.split(QLatin1Char(' '), QString::SkipEmptyParts);
|
||||
# endif
|
||||
command = command_params.first();
|
||||
command_params.removeFirst();
|
||||
}
|
||||
|
||||
@@ -28,13 +28,7 @@ namespace Utilities {
|
||||
|
||||
QScreen *GetScreen(QWidget *widget) {
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||
QScreen *screen = widget->screen();
|
||||
#else
|
||||
QScreen *screen = (widget->window() && widget->window()->windowHandle() ? widget->window()->windowHandle()->screen() : nullptr);
|
||||
#endif
|
||||
|
||||
return screen;
|
||||
return widget->screen();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -34,33 +34,6 @@ HRGN qt_RectToHRGN(const QRect &rc) {
|
||||
return CreateRectRgn(rc.left(), rc.top(), rc.right() + 1, rc.bottom() + 1);
|
||||
}
|
||||
|
||||
HRGN toHRGN(const QRegion ®ion);
|
||||
HRGN toHRGN(const QRegion ®ion) {
|
||||
|
||||
# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
return region.toHRGN();
|
||||
# else
|
||||
|
||||
const int rect_count = region.rectCount();
|
||||
if (rect_count == 0) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
HRGN resultRgn = nullptr;
|
||||
QRegion::const_iterator rects = region.begin();
|
||||
resultRgn = qt_RectToHRGN(rects[0]);
|
||||
for (int i = 1; i < rect_count; ++i) {
|
||||
HRGN tmpRgn = qt_RectToHRGN(rects[i]);
|
||||
const int res = CombineRgn(resultRgn, resultRgn, tmpRgn, RGN_OR);
|
||||
if (res == ERROR) qWarning("Error combining HRGNs.");
|
||||
DeleteObject(tmpRgn);
|
||||
}
|
||||
|
||||
return resultRgn;
|
||||
|
||||
# endif // Qt 6
|
||||
}
|
||||
|
||||
void enableBlurBehindWindow(QWindow *window, const QRegion ®ion) {
|
||||
|
||||
DWM_BLURBEHIND dwmbb = { 0, 0, nullptr, 0 };
|
||||
@@ -68,7 +41,7 @@ void enableBlurBehindWindow(QWindow *window, const QRegion ®ion) {
|
||||
dwmbb.fEnable = TRUE;
|
||||
HRGN rgn = nullptr;
|
||||
if (!region.isNull()) {
|
||||
rgn = toHRGN(region);
|
||||
rgn = region.toHRGN();
|
||||
if (rgn) {
|
||||
dwmbb.hRgnBlur = rgn;
|
||||
dwmbb.dwFlags |= DWM_BB_BLURREGION;
|
||||
|
||||
Reference in New Issue
Block a user