28 lines
574 B
C++
28 lines
574 B
C++
// urlhelper.h
|
|
#ifndef URLHELPER_H
|
|
#define URLHELPER_H
|
|
|
|
#include <QObject>
|
|
#include <QUrl>
|
|
|
|
class UrlHelper : public QObject
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit UrlHelper(QObject *parent = nullptr) {}
|
|
|
|
Q_INVOKABLE QString fromLocalFile(const QString &localPath) {
|
|
return QUrl::fromLocalFile(localPath).toString();
|
|
}
|
|
|
|
Q_INVOKABLE QUrl fromLocalFileUrl(const QString &localPath) {
|
|
return QUrl::fromLocalFile(localPath);
|
|
}
|
|
|
|
Q_INVOKABLE QString toLocalFile(const QUrl &url) {
|
|
return url.toLocalFile();
|
|
}
|
|
};
|
|
|
|
#endif // URLHELPER_H
|