Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QWebView doesn't load files in Windows
Qt 6.11 is out! See what's new in the release blog

QWebView doesn't load files in Windows

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 3.2k 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.
  • S Offline
    S Offline
    Serenity
    wrote on last edited by
    #1

    Hi,

    I am developing under Linux a program, which uses QWebView And QWebPage.
    I have some index.html files located in a folder on my PC and the index files are loading images and css files in the same directory.

    In Ubuntu Linux, this works fine. When I load the index.html file, the css and imagefiles located in the same directory are also loaded.
    In Windows, this doesn't work really. It's not opening any file and so, nothing works.
    What can I do, that Windows is also loading the files located in the same directory?

    I am using the same code, no changes, nothing, but it doesn't work

    Greetings

    EDIT:
    Short explaination:
    I have any file, let me say in C:\HTMLdata:

    • index.html
    • image.png
    • stype.css

    I now want to load the index file, which load the other to files with "./image.png" and "./style.png".
    In Linux, it works without any problems. In Windows, it doen't work. But why?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mbnoimi
      wrote on last edited by
      #2

      I expect this related to Windows path issue, because Windows doens't accept "/" while it works with "" so try to use this QDir static function to clean up the paths:

      @QDir::fromNativeSeparators()@

      1 Reply Last reply
      0
      • S Offline
        S Offline
        Serenity
        wrote on last edited by
        #3

        Unfortunately, it doesn't help :(
        I also cannot parse all html files. I think, that cannot be also the problem, because all URLs in the web uses "/", like also this page. Then, I wouldn't open this page also :(

        1 Reply Last reply
        0
        • A Offline
          A Offline
          AcerExtensa
          wrote on last edited by
          #4

          why do you use "./"? HTML doesn't need it. simply include "image.png" and it will try to load it from current folder.

          "./" path exist only in UNIX like systems, but not in windows....

          God is Real unless explicitly declared as Integer.

          1 Reply Last reply
          0
          • S Offline
            S Offline
            Serenity
            wrote on last edited by
            #5

            It also don't work with "image.png". I tested it. That was also one of my first idea.
            I think, it's a bug in Qt. It also doesn't work with QtWeb, but my HTML file works fine in Firefox, Opera, IE etc.
            I think, I have to parse all HTML file and make all strings started with "./" to a absolute path. Then it works also in Windows...

            1 Reply Last reply
            0
            • A Offline
              A Offline
              AcerExtensa
              wrote on last edited by
              #6

              One more idea: what is your current working directory? try to set it to the path where your files are...

              God is Real unless explicitly declared as Integer.

              1 Reply Last reply
              0

              • Login

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