From cf144e36098eb624a0b62c48c37f6f3f73d5be06 Mon Sep 17 00:00:00 2001 From: Chris Xiong Date: Wed, 8 Feb 2023 10:22:12 -0500 Subject: Open in file browser fixed for Windows (patch by @BLumia). --- qdeduper/imageitem.cpp | 2 +- qdeduper/utilities.cpp | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/qdeduper/imageitem.cpp b/qdeduper/imageitem.cpp index b037df4..a0e9788 100644 --- a/qdeduper/imageitem.cpp +++ b/qdeduper/imageitem.cpp @@ -148,7 +148,7 @@ QSize ImageItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QMod vpsz.setWidth(vpsz.width() - vw); vpsz.setHeight(vpsz.height() - hh); QPixmap pm = index.data(Qt::ItemDataRole::DecorationRole).value(); - QSize onscsz = pm.size() / pm.devicePixelRatioF(); + QSize onscsz = pm.isNull() ? QSize(0, 0) : pm.size() / pm.devicePixelRatioF(); int imh = onscsz.height(); if (onscsz.width() > vpsz.width() - 2 * MARGIN - 2 * BORDER) imh = (vpsz.width() - 2 * MARGIN - 2 * BORDER) / (double)onscsz.width() * onscsz.height(); diff --git a/qdeduper/utilities.cpp b/qdeduper/utilities.cpp index aef471d..29e986b 100644 --- a/qdeduper/utilities.cpp +++ b/qdeduper/utilities.cpp @@ -10,6 +10,9 @@ #include #include #endif +#ifdef _WIN32 +#include +#endif namespace utilities { @@ -40,7 +43,7 @@ fs::path qstring_to_path(const QString &s) void open_containing_folder(const fs::path &path) { #ifdef _WIN32 - QProcess::startDetached("explorer", QStringList() << "/select," << fspath_to_qstring(path)); + QProcess::startDetached("explorer", QStringList() << "/select," << QDir::toNativeSeparators(fspath_to_qstring(path))); #else #ifdef HAS_QTDBUS auto conn = QDBusConnection::sessionBus(); -- cgit v1.2.3