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. 64-bit Qt Assistant does not recognize external css
Forum Updated to NodeBB v4.3 + New Features

64-bit Qt Assistant does not recognize external css

Scheduled Pinned Locked Moved Solved General and Desktop
10 Posts 3 Posters 662 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.
  • J Offline
    J Offline
    JHerman
    wrote on 30 Aug 2023, 14:37 last edited by JHerman
    #1

    A project I've been working on was recently updated from 32-bit Qt to 64-bit, and the Qt Help Project paired with it stopped recognizing its external css file around this time.

    I've been trying to troubleshoot why it isn't recognizing the file, and made a small test project to work through things. I found that if I run Qt Assistant on this test project using a 64-bit version, the css fails, but if I run everything through 32-bit using the exact same files, the css works.

    I followed the documentation for Qt Help Project and Qt Assistant, and put together test .qhp and .qhcp files.

    .qhp:

    <?xml version="1.0" encoding="UTF-8" ?>
    <QtHelpProject version="1.0">
    <namespace>testcompany.com.testhelp.1.0</namespace>
    <virtualFolder>doc</virtualFolder>
    <customFilter name="Test Help 1.0">
    <filterAttribute>testhelp</filterAttribute>
    <filterAttribute>1.0</filterAttribute>
    </customFilter>
    <filterSection>
    <filterAttribute>testhelp</filterAttribute>
    <filterAttribute>1.0</filterAttribute>
    <toc>
    <section title="Test Help Manual" ref="testproject.html"></section>
    </toc>
    <keywords>
    <keyword name="testproject" ref="testproject.html" />
    </keywords>
    <files>
    <file>testproject.css</file>
    <file>testproject.html</file>
    </files>
    </filterSection>
    </QtHelpProject>
    

    .qhcp:

    <?xml version="1.0" encoding="utf-8" ?>
    <QHelpCollectionProject version="1.0">
    <assistant>
    <title>Test Help</title>
    <enableFilterFunctionality>false</enableFilterFunctionality>
    <enableDocumentationManager>false</enableDocumentationManager>
    <enableAddressBar visible="true">true</enableAddressBar>
    <cacheDirectory>TestCompany/TestHelp</cacheDirectory>
    <aboutMenuText>
    <text>About Test Help</text>
    </aboutMenuText>
    </assistant>
    <docFiles>
    <generate>
    <file>
    <input>test.qhp</input>
    <output>test.qch</output>
    </file>
    </generate>
    <register>
    <file>test.qch</file>
    </register>
    </docFiles>
    </QHelpCollectionProject>
    

    The html and css files I'm using are very simple, just a single heading element and a single paragraph element, and then css to color/resize them in the .css file.

    html:

    <?xml version="1.0" encoding="utf-8" ?>
    <!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Test Project</title>
    <link rel="StyleSheet" href="testproject.css" type="text/css" />
    </head>
    <body>
    <h1>Test Help Project</h1>
    <p> This is a test project to see if I can get css working with Qt Assistant </p>
    </body>
    </html>
    

    css:

    H1 {
    	color: #00ff00;
    	background-color: #0000ff;
    	font-size: 28pt;
    }
    
    p {
    	color: #ff0000;
    	font-size: 15pt;
    }
    

    This is what the page looks like when run through 64-bit:
    e54bb761-ecd2-4194-875f-09c49aa7b4e1-image.png

    And this is what it looks like through 32-bit:
    80fd3c5a-e61d-436b-af6a-68452262aa56-image.png

    I've searched through the documentation for Qt Help and Qt Assistant, and from what I can tell, what I have should work just fine. Does anyone know if there's something I'm missing to get the css to work?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 30 Aug 2023, 18:06 last edited by
      #2

      Hi and welcome to devnet,

      Might be a silly question but are you sure all the files are found at run time by the 64 bit executable ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      J 1 Reply Last reply 30 Aug 2023, 19:23
      0
      • S SGaist
        30 Aug 2023, 18:06

        Hi and welcome to devnet,

        Might be a silly question but are you sure all the files are found at run time by the 64 bit executable ?

        J Offline
        J Offline
        JHerman
        wrote on 30 Aug 2023, 19:23 last edited by
        #3

        @SGaist
        I guess I'm not 100% certain, but I don't see why they wouldn't be found by the 64-bit if they were found by the 32-bit executable.

        Everything is contained and ran in the same directory, including the executable.

        Is how the executable searches for files at run time different between 32-bit and 64-bit?

        S C 2 Replies Last reply 1 Sept 2023, 19:44
        0
        • J JHerman
          30 Aug 2023, 19:23

          @SGaist
          I guess I'm not 100% certain, but I don't see why they wouldn't be found by the 64-bit if they were found by the 32-bit executable.

          Everything is contained and ran in the same directory, including the executable.

          Is how the executable searches for files at run time different between 32-bit and 64-bit?

          S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 1 Sept 2023, 19:44 last edited by
          #4

          AFAIK they should not especially if the files are in the same folder as your application.

          The only thing that comes to mind is the library loading paths.

          On which OS are you ? On Linux you could use strace to check what is getting opened and if the css is somehow missed.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          J 1 Reply Last reply 3 Jan 2024, 15:58
          0
          • J JHerman
            30 Aug 2023, 19:23

            @SGaist
            I guess I'm not 100% certain, but I don't see why they wouldn't be found by the 64-bit if they were found by the 32-bit executable.

            Everything is contained and ran in the same directory, including the executable.

            Is how the executable searches for files at run time different between 32-bit and 64-bit?

            C Offline
            C Offline
            ChrisW67
            wrote on 2 Sept 2023, 04:56 last edited by
            #5

            @JHerman A file opened with a relative path will be looked for in the current working directory of the process. That is not necessarily, or even generally, the same as the location of the executable. Check the the running program's (which I assume is a version of Assistant) current working directory is where you think it is.

            1 Reply Last reply
            2
            • S SGaist
              1 Sept 2023, 19:44

              AFAIK they should not especially if the files are in the same folder as your application.

              The only thing that comes to mind is the library loading paths.

              On which OS are you ? On Linux you could use strace to check what is getting opened and if the css is somehow missed.

              J Offline
              J Offline
              JHerman
              wrote on 3 Jan 2024, 15:58 last edited by
              #6

              @SGaist I had to move away from this issue for a couple months. Looking back at it, the css file is being compressed into the .qch file, so it appears that the Qt Help generation steps are finding it.

              From my understanding looking at the documentation, Assistant looks for the files from where they are compressed in the .qch file, so it should be able to find it.

              I tried a couple other things like using a -stylesheet parameter when I ran assistant from command line, but they haven't worked either.

              S 1 Reply Last reply 3 Jan 2024, 19:53
              0
              • J JHerman
                3 Jan 2024, 15:58

                @SGaist I had to move away from this issue for a couple months. Looking back at it, the css file is being compressed into the .qch file, so it appears that the Qt Help generation steps are finding it.

                From my understanding looking at the documentation, Assistant looks for the files from where they are compressed in the .qch file, so it should be able to find it.

                I tried a couple other things like using a -stylesheet parameter when I ran assistant from command line, but they haven't worked either.

                S Offline
                S Offline
                SGaist
                Lifetime Qt Champion
                wrote on 3 Jan 2024, 19:53 last edited by
                #7

                @JHerman can you provide a minimal compilable project that allows to reproduce that issue ?

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                J 1 Reply Last reply 3 Jan 2024, 21:26
                0
                • S SGaist
                  3 Jan 2024, 19:53

                  @JHerman can you provide a minimal compilable project that allows to reproduce that issue ?

                  J Offline
                  J Offline
                  JHerman
                  wrote on 3 Jan 2024, 21:26 last edited by JHerman 1 Mar 2024, 21:29
                  #8

                  @SGaist I'm not seeing a way to attach files to the thread, but the code snippets in the original post are the entirety of each of the 4 files I used to compile, the .qhp, the .qhcp, the .html, and the .css files.

                  Ah, before I forget, I should mention that the OS running these projects are Windows 10/11.

                  C 1 Reply Last reply 3 Jan 2024, 23:40
                  0
                  • J JHerman
                    3 Jan 2024, 21:26

                    @SGaist I'm not seeing a way to attach files to the thread, but the code snippets in the original post are the entirety of each of the 4 files I used to compile, the .qhp, the .qhcp, the .html, and the .css files.

                    Ah, before I forget, I should mention that the OS running these projects are Windows 10/11.

                    C Offline
                    C Offline
                    ChrisW67
                    wrote on 3 Jan 2024, 23:40 last edited by ChrisW67 1 Apr 2024, 02:46
                    #9

                    @JHerman The rel attribute of the link element in your HTML is mixed-case "StyleSheet". AFAICT this is acceptable in the HTML living "standard", which defines these as case-insensitive. The HTML works correctly in a browsers.

                    However, a quick experiment with your example files on Linux shows it is broken here too. It only works correctly in the Qt help framework if the rel attribute is lower case "stylesheet", exactly as presented in the standard's acceptable values list.

                    <?xml version="1.0" encoding="utf-8"?>
                    <!DOCTYPE html>
                    <html xmlns="http://www.w3.org/1999/xhtml">
                      <head>
                        <title>Test Project</title>
                        <link rel="stylesheet" href="testproject.css" type="text/css"/>
                      </head>
                      <body>
                        <h1>Test Help Project</h1>
                        <p> This is a test project to see if I can get css working with Qt Assistant </p>
                      </body>
                    </html>
                    
                    $ ~/Qt/6.6.1/gcc_64/libexec/qhelpgenerator test.qhcp 
                    $ ~/Qt/6.6.1/gcc_64/bin/assistant -collectionFile test.qhc
                    

                    ff438448-7971-4487-885d-9b7ba0840cc4-image.png
                    Whether this is a deliberate choice or a bug in the help generator or help rendering engine I do not know.

                    J 1 Reply Last reply 4 Jan 2024, 14:58
                    3
                    • C ChrisW67
                      3 Jan 2024, 23:40

                      @JHerman The rel attribute of the link element in your HTML is mixed-case "StyleSheet". AFAICT this is acceptable in the HTML living "standard", which defines these as case-insensitive. The HTML works correctly in a browsers.

                      However, a quick experiment with your example files on Linux shows it is broken here too. It only works correctly in the Qt help framework if the rel attribute is lower case "stylesheet", exactly as presented in the standard's acceptable values list.

                      <?xml version="1.0" encoding="utf-8"?>
                      <!DOCTYPE html>
                      <html xmlns="http://www.w3.org/1999/xhtml">
                        <head>
                          <title>Test Project</title>
                          <link rel="stylesheet" href="testproject.css" type="text/css"/>
                        </head>
                        <body>
                          <h1>Test Help Project</h1>
                          <p> This is a test project to see if I can get css working with Qt Assistant </p>
                        </body>
                      </html>
                      
                      $ ~/Qt/6.6.1/gcc_64/libexec/qhelpgenerator test.qhcp 
                      $ ~/Qt/6.6.1/gcc_64/bin/assistant -collectionFile test.qhc
                      

                      ff438448-7971-4487-885d-9b7ba0840cc4-image.png
                      Whether this is a deliberate choice or a bug in the help generator or help rendering engine I do not know.

                      J Offline
                      J Offline
                      JHerman
                      wrote on 4 Jan 2024, 14:58 last edited by
                      #10

                      @ChrisW67 Tried this out for myself. This was the problem all along it seems. Looks like Qt either made Assistant more strict with HTML standards in newer versions or this was a bug introduced somewhere, because "StyleSheet" worked just fine before.

                      Thank you for all of the help!

                      1 Reply Last reply
                      0
                      • J JHerman has marked this topic as solved on 4 Jan 2024, 14:58

                      • Login

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