Important: Please read the Qt Code of Conduct -

Is there a way to get a string of stylesheet errors

  • For example, when my stylesheet is formatted wrong I get errors like

    1. Could not parse stylesheet of object 0x2db36817
    2. Unknown property widt

    I get these errors in the application output in Qt Creator but is there a way to get a string of it? Is there a signal that emits if I get a stylesheet error?

    A signal like void styleSheetError(QStringList errors)

  • Qt Champions 2019

    @tjudg Why do you need it? Do you generate your stylesheets at runtime? If not just make sure there are no such errors when you execute your app while testing it. How would such a signal help you or users of your app?

  • Yes, I generate my stylesheets at runtime. I read the stylesheets from a file so I can change it whenever I want to without having to rebuild the program.

  • Looking at qstylesheetstyle.cpp, I'd say there's no clean way to get these messages. You could install a custom message handler using QtMessageHandler qInstallMessageHandler(QtMessageHandler handler), but that looks like a very ugly hack to me. If you really need the messages, you'll probably have to patch the Qt sources.

Log in to reply