Advertisement
Guest User

Федя 19 лет. Не ебался

a guest
Jan 21st, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. #ifndef UTILS_H
  2. #define UTILS_H
  3.  
  4. #include <QtCore/QFileInfo>
  5. #include <QtCore/QUrl>
  6.  
  7. class Utils : public QObject {
  8. Q_OBJECT
  9. public:
  10. Q_INVOKABLE static QUrl fromUserInput(const QString& userInput);
  11. };
  12.  
  13. inline QUrl Utils::fromUserInput(const QString& userInput)
  14. {
  15. QFileInfo fileInfo(userInput);
  16. if (fileInfo.exists())
  17. return QUrl::fromLocalFile(fileInfo.absoluteFilePath());
  18. return QUrl::fromUserInput(userInput);
  19. }
  20.  
  21. #endif // UTILS_H
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement