Results 1 to 5 of 5

Thread: Qt 5: handling of CSS imports in QtHelp

  1. #1
    Join Date
    Mar 2010
    Posts
    319
    Thanks
    1
    Thanked 14 Times in 12 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Qt 5: handling of CSS imports in QtHelp

    Hi,

    I use QtHelp for my application’s help. It’s all very simple HTML and CSS code. In my help’s home page, I link a CSS file as follows:

    Qt Code:
    1. <link href="res/stylesheet.css" rel="stylesheet" type="text/css"/>
    To copy to clipboard, switch view to plain text mode 

    Then, in my res/stylesheet.css file, I import another CSS file as follows:

    Qt Code:
    1. @import "/doc/res/common.css";
    To copy to clipboard, switch view to plain text mode 

    /doc is the root folder for my application’s help and it’s how QtHelp (in Qt 4.8) used to require the import to be done (see this previous thread of mine).

    However, now, the above @import statement just doesn’t work, meaning that my application’s help doesn’t get styled anymore.

    So, was I doing the right thing before and/or have things changed in Qt 5? What is certain is that if I include my CSS code directly in res/stylesheet.css, then everything is fine, telling me that the issue is with @import…

    Anyway, any help would be much appreciated…

    Cheers, Alan.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt 5: handling of CSS imports in QtHelp

    Qt5 now uses WebKit2, so it might be easiest to ask at the WebKit forum (ask about differences between WebKit1 and WebKit2).
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Qt 5: handling of CSS imports in QtHelp

    Ensure the import is at the top of the file: see http://www.w3.org/TR/css3-cascade/#at-import

  4. #4
    Join Date
    Mar 2010
    Posts
    319
    Thanks
    1
    Thanked 14 Times in 12 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qt 5: handling of CSS imports in QtHelp

    @wysota: sorry, I hadn't noticed that there is a WebKit forum on Qt Centre. I am going to ask there. Thanks.

    @ChrisW67: yes, I am aware that imports should be at the top of a file and this is what I have. Yet, it doesn't work anymore as it used to.

  5. #5
    Join Date
    Mar 2010
    Posts
    319
    Thanks
    1
    Thanked 14 Times in 12 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qt 5: handling of CSS imports in QtHelp

    Copy/paste of the solution I posted in the Qt Webkit sub-forum:

    FWIW, I just came back to the above issue and found out what happened. Basically, the syntax changed (?) between Qt 4 and Qt 5. So, rather than having something like:

    Qt Code:
    1. @import "/doc/res/common.css";
    To copy to clipboard, switch view to plain text mode 
    We should now have:

    Qt Code:
    1. @import "qthelp://namespace/virtualFolder/doc/res/common.css";
    To copy to clipboard, switch view to plain text mode 
    Now, I wish it had been documented somewhere...

Similar Threads

  1. Replies: 3
    Last Post: 24th January 2013, 09:18
  2. Problem with SDK 1.2 (Qt 4.8) and QtHelp
    By agarny in forum Qt Programming
    Replies: 3
    Last Post: 3rd February 2012, 16:24
  3. Replies: 3
    Last Post: 22nd October 2010, 20:49
  4. qtHelp namespaces
    By winkle99 in forum Qt Programming
    Replies: 1
    Last Post: 10th July 2010, 01:32
  5. QtHelp
    By WinchellChung in forum General Discussion
    Replies: 5
    Last Post: 14th May 2008, 23:46

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.