Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7190483
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:31:32+00:00 2026-05-28T19:31:32+00:00

I have an application that writes its own stylesheet, based off user input. It

  • 0

I have an application that writes its own stylesheet, based off user input. It changes the back-ground colours / images of indiviual widgets via user selection.

Whenever I begin using this feature, everything works perfect. However, eventually things grind to a halt. No visual changes are made to the window, even though the stylesheet is continually being added to and set onto the application.

Since there is some strong string manipulation involved in generating the CSS, my guess is that there is some error in the CSS that is stopping Qt from interpreting all of it.

I cannot spot this error! My CSS is always in the format of

"#widget { 'correctly formatted properties';} #nextwidget..."

I know for a fact (by the limits of the algorithm and by checking the broken CSS files), that the properties set to each widget are syntactically correct.

I notice that doing this however…

#widget {color: ;}

… does not stop Qt from interpreting the rest of the string, but using non-existing properties (eg: { goose: 2 } ) does.

So, what kind of errors are dismissed by Qt, and what stops the interpretation of the rest of the file? I couldn’t find a list or anything of the sort in the Qt documentation.
(In fact, there’s not even any stylesheet documentation in the PyQt4 package.)

In the case of my CSS, I apply…

 {color: x; background-image:, y, background-color: z }   

to every single widget the User selects (with x,y,z being correct subsitutions).
Are there any visible widgets that don’t support these properties?
(which could be the source of my problem!)


I tried putting the SS in a Validator and here are two CSS fragments that caused error, of which I don’t know why!

#centralwidget { color: #ffffff ;
                background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #aaff00, stop: 1 #aac300)  
                }

and…

#Display { background-image: url('+NewTextureFile+');
         background-repeat: repeat-xy; 
         }

If anybody could help with these too, I’d be extremely appreciative!
(It’s probably obvious I’ve been improving my way into CSS…)

EDIT:
@ Avaris:

Sorry this broken CSS is not minimal; I don’t know what part is broken!

I have a suspicion that it’s because I don’t finish all properties with ‘;’.

#tab{color: #000000 ;background-color: #ff0000    } #tab{color: #000000 ;background-image: url(E:/ChemCalc ULTIMATE/ChemCalc ULTIMATE/Texture Files/Penguins.jpg);background-repeat: repeat-xy;    } #Amount_Unit{color: #000000 ;background-color: #aaff00   } #Conc_Unit2{color: #000000 ;background-color: #aaff00   } #pushButton{color: #000000 ;background-color: #aaff00   } #tab_2{color: #000000 ;background-image: url(E:/ChemCalc ULTIMATE/ChemCalc ULTIMATE/Texture Files/Penguins.jpg);background-repeat: repeat-xy;  } #RMM_Output{color: #000000 ;background-color: #aaff00  } #Conc_Unit1{color: #000000 ;background-color: #aaff00  } #UnitText{color: #000000 ;;  } #Amount_Input{color: #000000 ;;  } #Concentration_Input{color: #000000 ;;  } #Amount_Output{color: #000000 ;;  } #Subshell_Element{color: #000000 ;background-color: #00aaff  } #Charge{color: #000000 ;background-color: #00aaff  } #Simple_Config{color: #000000 ;background-color: #00aaff  } #Actual_Config{color: #000000 ;background-color: #00aaff  } #Save_Simple_Button{color: #ffffff ;background-color: #aaff00  } #Save_Actual_Button{color: #ffffff ;background-color: #aaff00  } #pushButton_2{color: #ffffff ;background-color: #aaff00  } #centralwidget{color: #ffffff ;background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #aaff00, stop: 1 #aac300)  } #pushButton_3{color: #000000 ;background-color: #ff0000  } #Calculate_Proportions_Button{color: #000000 ;background-color: #f80000  } #{color: #000000 ;background-image: url(E:/ChemCalc ULTIMATE/ChemCalc ULTIMATE/Texture Files/Koala.jpg);background-repeat: repeat-xy;  } #tab_4{color: #000000 ;background-image: url(E:/ChemCalc ULTIMATE/ChemCalc ULTIMATE/Texture Files/Koala.jpg);background-repeat: repeat-xy;  }  #LayoutContainer1{color: #000000 ;background-image: url(E:/ChemCalc ULTIMATE/ChemCalc ULTIMATE/Texture Files/Koala.jpg);background-repeat: repeat-xy;  } #AmountInput{color: #ffaa00 ;background-color: #ffff00  } #tab_5{color: #000000 ;background-color: #ffffff  } #menubar{color: #000000 ;background-color: #ffffff  } #tabWidget{color: #000000 ;background-color: #ffffff  } #Reaction_Element_Holder{color: #000000 ;background-image: url(E:/ChemCalc ULTIMATE/ChemCalc ULTIMATE/Texture Files/Penguins.jpg);background-repeat: repeat-xy; } 

Thanks for reading!


PyQt4
python 2.7.2
Windows 7

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T19:31:34+00:00Added an answer on May 28, 2026 at 7:31 pm

    Looking at the example CSS, there is an ID selector without a name:

    #tab{color: #000000 ;background-color: #ff0000    } 
    /* ... */
    #{color: #000000 ;background-image: url(E:/ChemCalc ULTIMATE/ChemCalc ULTIMATE/Texture Files/Koala.jpg);background-repeat: repeat-xy;  } #
    /* ... */
    #Reaction_Element_Holder{color: #000000 ;background-image: url(E:/ChemCalc ULTIMATE/ChemCalc ULTIMATE/Texture Files/Penguins.jpg);background-repeat: repeat-xy; }
    

    which threw the parser and made the rest of CSS after that point invalid.

    As a side point, nameless ID selector is in fact invalid CSS. W3C Validator gives:

    Parse Error  Lexical error at line 1, column 2. Encountered: "{" (123), after : "#"
    

    for:

    #{ color: blue; }
    body { color: red; }
    

    But browsers I tested (Opera, Firefox) was smart enough to ignore and continue. Apparently Qt CSS parser is not comfortable with this kind of errors.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a little tray application that wants to write to its own folder
I have an application that writes to another application and needs to provide the
I have an application that writes information to file. This information is used post-execution
I have an application that writes to a folder on the C:\ drive. The
I have an application that writes many times to a formula/macro-laden workbook. It loops
I have created an application that writes some data to the root folder of
I have a server application that writes to a popen(myCommand, w) file descriptor in
I am writing an application that writes to SQL Compact files that have a
I have a UNIX application written in ansi C that writes data directly to
I'm working on an application. I have a servlet (writeDataBase.class) that writes some information

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.