Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Loading an html file next to app on OSX
TOMATO_QT last edited by TOMATO_QT
WebEngineView, I'm trying to automatically load at launch an html file which is in the same directory as my .app bundle.
I've discovered that
QGuiApplication::applicationDirPath()points to a directory inside the bundle so that wasn't working.I made somewhat hackish progress with the code snippet below.
After concatenating the html file name, the path I end up with is
Which of course doesn't work, so I tried prepending `file://" on to that and still no joy. Am I doing something obviously wrong?
QDir dir = QDir(QCoreApplication::applicationDirPath()); dir.cdUp(); dir.cdUp(); dir.cdUp(); engine.rootContext()->setContextProperty("workingDirectory", dir.absolutePath());