[vlc-commits] [Git][videolan/vlc][master] qt: handle `QVariant` in `MainCtx::urlListToMimeData()`
Steve Lhomme (@robUx4)
gitlab at videolan.org
Fri Mar 14 10:05:31 UTC 2025
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
b7d7ecc6 by Fatih Uzunoglu at 2025-03-14T09:51:04+00:00
qt: handle `QVariant` in `MainCtx::urlListToMimeData()`
Sometimes the array elements may be variant (`QVariant`),
even though the actual type is a `QUrl` or a `QString`.
This is an odd case because `QUrl` is automatically
converted to `url` value type when passed to QML. However,
the source url may already be provided as a `QVariant`,
where in that case this conversion would not occur.
- - - - -
1 changed file:
- modules/gui/qt/maininterface/mainctx.cpp
Changes:
=====================================
modules/gui/qt/maininterface/mainctx.cpp
=====================================
@@ -766,6 +766,16 @@ QJSValue MainCtx::urlListToMimeData(const QJSValue &array) {
else if (element.isString())
// If the element is string, we assume it is already encoded
decodedUrl = element.toString();
+ else if (element.isVariant())
+ {
+ const QVariant variant = element.toVariant();
+ if (variant.typeId() == QMetaType::QUrl)
+ decodedUrl = variant.toUrl().toString(QUrl::FullyEncoded);
+ else if (variant.typeId() == QMetaType::QString)
+ decodedUrl = variant.toString();
+ else
+ Q_UNREACHABLE();
+ }
else
Q_UNREACHABLE(); // Assertion failure in debug builds
string += decodedUrl + QStringLiteral("\r\n");
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/b7d7ecc6d8f201fcf190b45e37b06a2c09c781e1
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/b7d7ecc6d8f201fcf190b45e37b06a2c09c781e1
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list