Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef UTILS_H
- #define UTILS_H
- #include <QtCore/QFileInfo>
- #include <QtCore/QUrl>
- class Utils : public QObject {
- Q_OBJECT
- public:
- Q_INVOKABLE static QUrl fromUserInput(const QString& userInput);
- };
- inline QUrl Utils::fromUserInput(const QString& userInput)
- {
- QFileInfo fileInfo(userInput);
- if (fileInfo.exists())
- return QUrl::fromLocalFile(fileInfo.absoluteFilePath());
- return QUrl::fromUserInput(userInput);
- }
- #endif // UTILS_H
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement