Reset background color for QTabWidget - background-color

I see that QTabWidget background color is lighter than container widget. How to set its background to same as container widget has? Or better make it transparent?
I have following code:
tabWidget->setPalette(palette());
tabWidget->setBackgroundRole(backgroundRole());
tabWidget->setStyle(style()); // Set parent widget style
QPalette pal = tabWidget->palette();
pal.setColor(QPalette::Base, palette().background().color());
tabWidget->setPalette(pal);
which worked for me with QTreeWidget, however does not work for QTabWidget. Why Qt makes it different?

Solved by setting autoFillBackground to true in UI. However tabs titles background still white - any way to solve?

Related

Permanently change the color palette in the GTK color picker

When using the color picker widget GTK applications I often use a different color Palette to the one given by default, as shown in the picture below. While the program is running I can change the defaults colors and they stay changed, however, when I close the program those modifications disappear.
I wonder how I can make those modifications to persistent in disk.
From the tags you chose, the application name seems to be Dia. In the application, nothing lets you set this option. So the short answer is: no.
The issue is that Dia uses the now deprecated GtkColorSelectionDialog (in favor of GtkColorChooserDialog). In the deprecated version, there is a flag to tell the widget to show/hide the color palette, but that's pretty much the only control you have (see gtk_color_selection_set_has_palette).
In the new widget version (which, by the way, looks totally different), you have direct access to a gtk_color_chooser_add_palette:
void
gtk_color_chooser_add_palette (GtkColorChooser *chooser,
GtkOrientation orientation,
gint colors_per_line,
gint n_colors,
GdkRGBA *colors);
You can see you have much more options as far as customizing the palette is concerned. You even have the ability to decide the colors. This means you could save your current selection in the palette. Then, at application quit, you could save all the palette's colors in some sort of settings, and load them back at application start.
As a final note, I looked at the Dia source code and found that they seem to be looking to make the move to the new widget. Here is an excerpt:
// ...
window = self->color_select =
/*gtk_color_chooser_dialog_new (self->edit_color == FOREGROUND ?
_("Select foreground color") : _("Select background color"),
GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self))));*/
gtk_color_selection_dialog_new (self->edit_color == FOREGROUND ?
_("Select foreground color") : _("Select background color"));
selection = gtk_color_selection_dialog_get_color_selection (GTK_COLOR_SELECTION_DIALOG (self->color_select));
self->color_select_active = 1;
//gtk_color_chooser_set_use_alpha (GTK_COLOR_CHOOSER (window), TRUE);
gtk_color_selection_set_has_opacity_control (GTK_COLOR_SELECTION (selection), TRUE);
// ...
From the commented code, it seems they are trying to make the move...

Changing background color of ttk Treeview.Heading

I'm going crazy trying to change the background color of the ttk.Treeview.Heading
I used:
s = ttk.Style()
s.configure('Treeview.Heading', background='black', foreground='dark blue')
The foreground changes no problem, but the background won't change. I've searched around and found a few bugs with the background for the normal Treeview rows, but I'm not sure if this is related to that as well.
Use style_theme_use("clam")
Here is the code
style = ttk.Style(root)
style.theme_use("clam")
style.configure("Treeview.Heading", background="black", foreground="white")

Get gtk system style color

I am trying to get system style colors.
color = gtk_widget_get_style(window)->
bg[GTK_STATE_NORMAL];
window is my main window and it definitely mapped. I tried with another widgets, GtkStyle's fields and GTK_STATEs, nothing similar to my system style colors.
What I am doing wrong?
Thanks

gtk3 transparent menu's

Is it possible in gtk3 to create a menu that is transparent? The underling window would use an image as it's background.
I can use a color for the window background but not a image.
I attempted to do what you said using an example from the gdk2 reference by adding a background image first and then porting it to gtk3. I'm no expert at gtk at all, but I did make it somehow compile:
http://pastebin.com/0XwUW5k3 (note that there has to be a "background.png" in the same folder)
The transparent dark rectangle holding the widgets is most likely the box; I tried settings its background color to full transparency as well, but it didn't work, and you'd probably have to do the composing/drawing of it yourself if you wanted it to be completely transparent, but that's not something I'd suggest because it seems too complex..
Also, you might want to create a background image with an already fitting resolution for the window, then you could skip the scaling part.
The scale function originally comes from this mailling-list thread

Round Rect Button behavior when using a flipview controller

Hia.
I am using some round rect buttons with own images for their states. Each time am displaying a different view for some stuff, the buttons become white and my images are fading in briefly later.
The problem occurs only with the UIModalTransitionStyleCrossDissolve animation.
The other 3, UIModalTransitionStyleCoverVertical, UIModalTransitionStyleFlipHorizontal and UIModalTransitionStylePartialCurl, don't show this effect.
The effect would be ok, ok if the starting color would be black. I didn't find any way to change that color in IB. Where does it come from? Any idea?
Tried to set the background over the inherited properties of UIImage, but he simply ignored it. Switching the Round rect button to a custom one solved it. Leaves the question what to do if I want a round rect. A black background image didn't help. He seems to use the background color to fade.

Resources