Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. User defined StyleSheet and fallback StyleSheet
Qt 6.12 LTS is out! See what's new in the release blog

User defined StyleSheet and fallback StyleSheet

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 510 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.
  • A Offline
    A Offline
    aheimberger
    wrote on last edited by aheimberger
    #1

    Hey guys,

    I am making a Qt Quick application which has a predefined style-sheet which is built into the application, but can also support user defined style-sheets.

    I am currently working on one problem: If I changes entries in my default style-sheet I also have to put them into the user defined style-sheet. If i forget to do this, it could break the layout of the application. In this case it should take the predefined style-sheet which is build into the application, but only the missing property.

    So what I do basically is.
    At the startup of the application I check the users directory if the user has uploaded a stylesheet.
    If a stylesheet exists i load it via
    qmlRegisterSingletonType("file:/....../Style.qml", "Style", 1, 0, "MenuStyle");

    but if there is no style I register
    qmlRegisterSingletonType("qrc:/...../Style.qml", "Style", 1, 0, "MenuStyle");

    Thats actually the starting point of the problem. Now I have either the default style or the user style, but not both.
    In my qml Files for a specific dialog I can use MenuStyle to access the style properties, but when its not defined in the user stylesheet it should take the default style-sheet which is build into the application.

    Do you have any idea how I can make this, and only access MenuStyle?

    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
    • Unsolved