FedoraQt / adwaita-qt

A style to bend Qt applications to look like they belong into GNOME Shell
Other
488 stars 48 forks source link

Spinbox color in dark theme when setting style programmatically #168

Open michaelrossherron opened 2 years ago

michaelrossherron commented 2 years ago

In our software, we have a setting that allows the user to choose the software's theme. I've added options for both the Adaita and Adwaita-Dark themes. In our mainwindow's constructor (and before any UI elements are created), we read the theme setting, and set the style appropriately using a command like this:

qApp->setStyle(QStyleFactory::create("adwaita-dark"));

This works well for our other themes, and also for the Adwaita (light) theme. For some reason, however, when using this method to set the style for the Adwaita Dark theme, almost everything looks correct, except for the spinboxes, which look like they do in the image below.

image

I have found that if I manually pass a -style adwaita-dark flag to the program when I launch it, then the spinboxes look like they should.

image

The software is being built and run on Ubuntu 20.04.4 LTS. I compiled the plugin against Qt 6.2.2, which is also what my main program is compiled against and linking to at runtime. I'm not including any of adwaita-qt's code, or linking to the libraries, I've just copied the compiled plugin into the plugins/styles directory in my Qt installation.

I'm not sure if this is a bug in the plugin, or if I'm doing something wrong, though I would greatly appreciate any insight into the problem.