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 7878943
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T03:47:35+00:00 2026-06-03T03:47:35+00:00

I have a multi-platform Qt application with a custom palette that we have already

  • 0

I have a multi-platform Qt application with a custom palette that we have already set up to produce the look that we want. The palette was set on the top level widget and so this was inherited by all of the child widgets.

I then wanted to dynamically change the text colour of some QPushButtons. Searching around for the best way to do this, I began reading about Style Sheets which I didn’t know that much about previously. These seemed to be a good option for changing the look of the push buttons and they did this. However, as soon as I set the text colour using a style sheet, the widget palette jumped to the default. It soon became obvious that style sheets are not compatible with custom palettes and it wasn’t possible to mix the two. Most of the info that I found suggested that style sheets should be used rather than custom palettes because, among other things, style sheets offer guarantees across platforms and looks which palette fiddling does not.

From this, it seemed like a good idea to convert my custom palette into a style sheet and set it on the top level widget. Then I would easily be able to change just some parameters of certain child widgets using sub-style-sheets. The problem is that the palette contains many colours that we have set that do not appear to have a style sheet equivalent. Eg, Light, Midlight and Dark. Without being able to set these colours I wasn’t able to produce the same look using style sheets as I previously had with the customised palette.

I would like to know if there is a simple way to convert a customised palette into a style sheet or whether there is some documentation to describe the equivalent style sheet settings for each palette colour. I have done searches on google, stackoverflow and the Qt reference docs but have come up short.

Thanks for any info.

ps. I solved my original problem by dynamically modifying the ButtonText attribute of the palette for the QPushButtons. But I would still rather use style sheets instead if possible without changing the main look of my application.

  • 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-06-03T03:47:36+00:00Added an answer on June 3, 2026 at 3:47 am

    QColor.name() is the hex string for that color. If you want to convert to a stylesheet, just run through all the roles in your palette and print the .name() of that color. You can then find the corresponding stylesheet properties and pseudo states to set the hex colors to.

    One thing you may find frustrating from switching from palettes to stylesheets is that CSS
    does not allow the use of variables, so you’ll have to use the hex string everywhere, rather than just defining named colors and using those.

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

Sidebar

Related Questions

I have an multi-dimensional array that I want to send to a PHP script
I am developing a multi-platform application and in one component I have a class
I need to create a simple application that is multi-platform that will send data
We have multi-part install that needs a reboot to continue. We added a RunOnce
I have a multi view application with individual UIViewControllers and xibs. I have one
I have a multi threaded .NET app that uses async I/O and AsyncCallbacks to
I have a multi-select <asp:listbox> and a button. I want to disable the button
I have a simple Rails application I want to deploy to Heroku. When I
I'm working on a multi-platform application in C where I need to load fonts
In order to do some multi-platform GUI development, I have just switched from GTK

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.