File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99 property string path
1010 property string _format: CUtils .imageFormat (path)
1111
12- readonly property int status: ( loader .item as Image) ? .status ?? Image .Null
12+ readonly property int status: loader .item ? .status ?? Image .Null // qmllint disable
1313
1414 function reload (): void {
1515 _format = Qt .binding (() => CUtils .imageFormat (path));
2828 id: animatedComponent
2929
3030 AnimatedImage {
31+ anchors .fill : parent
3132 fillMode: AnimatedImage .PreserveAspectCrop
3233 asynchronous: true
3334 playing: true
3940 id: cachingComponent
4041
4142 CachingImage {
43+ anchors .fill : parent
4244 path: root .path
4345 }
4446 }
Original file line number Diff line number Diff line change @@ -139,6 +139,15 @@ QString CUtils::toLocalFile(const QUrl& url) const {
139139 return url.toLocalFile ();
140140}
141141
142+ QString CUtils::imageFormat (const QUrl& url) const {
143+ if (!url.isLocalFile ()) {
144+ qCWarning (lcCUtils) << " imageFormat: url" << url << " is not a local file" ;
145+ return QString ();
146+ }
147+
148+ return imageFormat (url.toLocalFile ());
149+ }
150+
142151QString CUtils::imageFormat (const QString& path) const {
143152 return QString::fromLatin1 (QImageReader::imageFormat (path));
144153}
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ class CUtils : public QObject {
2424 Q_INVOKABLE bool copyFile (const QUrl& source, const QUrl& target, bool overwrite = true ) const ;
2525 Q_INVOKABLE bool deleteFile (const QUrl& path) const ;
2626 Q_INVOKABLE QString toLocalFile (const QUrl& url) const ;
27+ Q_INVOKABLE QString imageFormat (const QUrl& url) const ;
2728 Q_INVOKABLE QString imageFormat (const QString& path) const ;
2829};
2930
You can’t perform that action at this time.
0 commit comments