What we need to know about Gtk and QT decorations

When developing applications for Linux, when it comes to visual resources such as buttons, splitters, panels and other graphical components, we need to be aware of Gtk and QT decorations, as they override graphical aspects and styles that you manually enter. For example, although a Splitter can have its color chosen, if we are in a Gtk environment using the theme adwaita, the Splitter will be the color of the theme adwaita and not the color you chose and that makes a lot of sense, do you agree? Think about it, the ideal is that all programs respect the theme I chose and not the programmers who made the program, so a theme dark for the graphic environment will influence the theme of all programs and no program will feel like an ugly duckling.

In a nutshell, if you intend to develop for Windows and Linux, avoid touching component decorations that can be overwritten by the decoration of the graphic environment, because in addition to being a rework, the result will not be better than the theme chosen by the user, from Microsoft or the Linux distribution.

However, sometimes it is necessary for our application to have an appearance that is out of tune with the rest of the graphical environment, in this case, first be aware that the desired change is possible to be made without disturbing the Gtk or QT decoration, remember the Splitter example, you can even choose a color for it, but it will be ignored when your program starts running. If you want a component to have a de-themed look, see if there is an event in the component that allows you to manipulate its design, usually a property called canvas, and also an event that allows you to override the component's appearance, our Splitter example has an event called OnPaint which we can use to manipulate the appearance, see this example:

procedure TForm1.Splitter1Paint(Sender: TObject); begin with (Sender as TSplitter) do begin Canvas.Color:=clBlack; // use Canvas.FillRect if you want to draw something different end; end;

If you want to override the appearance of a component in favor of a Gtk or QT decoration you will have to learn to look in the component for an event that can manipulate the appearance usually using Canvas. But I recommend you avoid it.