forked from qt-creator/qt-creator
Utils: Promote a local conversion function to FilePath::fromUrl()
Change-Id: I748cceb50084a29b971f31a8bd2ad7159738d7fd Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
@@ -182,6 +182,19 @@ FilePath FilePath::fromVariant(const QVariant &variant)
|
||||
return fromSettings(variant); // FIXME: Use variant.value<FilePath>()
|
||||
}
|
||||
|
||||
/*!
|
||||
Constructs a FilePath from \a url.
|
||||
|
||||
\sa toVariant()
|
||||
*/
|
||||
FilePath FilePath::fromUrl(const QUrl &url)
|
||||
{
|
||||
FilePath result;
|
||||
if (url.isLocalFile())
|
||||
return FilePath::fromString(url.toLocalFile());
|
||||
return FilePath::fromParts(url.scheme(), url.host(), url.path());
|
||||
}
|
||||
|
||||
FilePath FilePath::fromParts(const QStringView scheme, const QStringView host, const QStringView path)
|
||||
{
|
||||
FilePath result;
|
||||
|
||||
Reference in New Issue
Block a user