Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Loading an html file next to app on OSX
Forum Updated to NodeBB v4.3 + New Features

Loading an html file next to app on OSX

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
webengine qt5webengineview
1 Posts 1 Posters 676 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    TOMATO_QT
    wrote on 29 Feb 2016, 03:10 last edited by TOMATO_QT
    #1

    Using WebEngineView, I'm trying to automatically load at launch an html file which is in the same directory as my .app bundle.

    --DemoDirectory
    -----Demo.app
    -----demo1.html

    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

    /Users/Tomato/Documents/builds/build-Timeline_Demo-Desktop_Qt_5_5_1_clang_64bit-Release/demo1.html

    Which of course doesn't work, so I tried prepending `file://" on to that and still no joy. Am I doing something obviously wrong?

    -in main.cpp

       QDir dir = QDir(QCoreApplication::applicationDirPath());
        dir.cdUp();
        dir.cdUp();
        dir.cdUp();
        engine.rootContext()->setContextProperty("workingDirectory", 
                                                 dir.absolutePath());
    
    1 Reply Last reply
    0

    1/1

    29 Feb 2016, 03:10

    • Login

    • Login or register to search.
    1 out of 1
    • First post
      1/1
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved