Qt style sheet properties for toolbox buttons - qt

I want to give some color to the area where they are toolbox buttons with icons (light grey on picture). Please help in determining what is a parameter style sheet?

If I understand correctly, you are trying to change the background color of the toolbar area.
Suppose I have a mainwindow with a toolbar called mainToolBar. Here is what I did :
ui->mainToolBar->setStyleSheet("QWidget { background : red; } QToolButton { background : green; }");
The first part of the stylesheet will change the background color of the toolbar where there is no toolbuttons.
The second part of the stylesheet will change the background color of the toolbuttons.
Note : I tested the code snippet above on Windows, I suppose it should work on a Mac too, but I cannot guarantee.

Related

GTK3 theme dialog box renders solid black background in Audacity

I was using Audacity with a GTK 3 theme I created. On some of the dialog boxes the background comes up as a solid black color, while the theme's background color is a light yellow. I noticed this happens only on some of the dialog boxes.
Below is an image of the Compressor dialog.
I want to know how to get the proper background color, as I checked some other themes with GTK Inspector and they render correctly.
The code for the gtk-widgets.css file is on this GitHub page.
Perhaps you can try:
window > box > widget > widget { background-color:yellow; }

Angular Material Progress Spinner with Image icons - (mat-spinner)

I Implemented mat-spinner in my project, but it only has few configurable changes like Color, mode of spinning. I want to include Image Icon which is the Logo of a brand/Company inside the spinner, how can i achieve it ?
Below is the Stackblitz link:
https://stackblitz.com/angular/lmgppgejqxdv
It has mode and color change but how do i include any image to fit inside the progress spinner ?
you can access the background layer of the spinner using:
.mat-progress-spinner svg {
background: red;
}
Note however that the svg is subject to transforms, so the background may end up being rotated as well.

QT Tab bar's top highlight with stylesheet

I have a problem when trying to change the color of QTabBar's top line (blue line in the picture below).
Is this a separate part of tabBar (like scroller or tear) or its top border ? And how can I change its color with styleSheet and leave the other parts of tabBar unchanged?
P.S. : My tabBar::styleSheet returns an empty string, so I can't get current style and make changes in it.
If you're using a "system" style, you may not be able to change the color of the line (cause representation of UI elements is not handled by Qt but by the system).
You should define a complete style for QTabBar (and maybe QTabWidget too) that you can customize as you wish.
See the Qt Style Sheets Examples page.
Problem solved:
setStyleSheet("QTabBar::tab:selected { selection-background-color: red; }");

Remove Focus Box Around TextField

Using JavaFX when I create a TextField and set
numberField.setFocusTraversable(false);
and then click on the field the blue box shows up around it. I guess that makes sense
but there is no
setFocus(bool)
command.
I want to get rid of the box. Any suggestions?
The setFocusTraversable(false) disables the focus traversing (by TAB and SHIFT+TAB) for that node. Thus it has nothing related with node's GUI style. To hide the focused blue color do:
Via code
numberField.setStyle("-fx-focus-color: transparent;");
or via css file
.text-field {
-fx-focus-color: transparent;
}
or pseudo class in css file
.text-field:focused{
-fx-focus-color: transparent;
}
-fx-focus-color is not a css property, it is a predefined color of caspian.css (JavaFX 2).
This answer is related to and referenced from: How do I remove the default border glow of a JavaFX button (when selected)?.

How to prevent the default blue border being drawn on QLineEdit focus

I am trying to achieve a borderless QLineEdit through CSS. It works fine when the QLineEdit is not in focus but when in focus the default blue border always comes up. The simple CSS I am using:
QLineEdit, QLineEdit:focus { border: none; }
I have tried with different background color through CSS for focus and not-in-focus, it works but I am unable to remove the blue border while in focus. Just to inform, I am working on a Mac.
You might get rid of the focus border by setting:
QLineEdit.setAttribute(Qt::WA_MacShowFocusRect, 0)
Read the documentation, there are plenty of other Mac specific settings
WidgetAttribute-enum
There is rather a similar question too
Refer this question
Maybe also like this way:
ui->treeView->setAttribute(Qt::WA_MacShowFocusRect, 0);
Reference: http://doc.qt.digia.com/4.6/demos-interview-main-cpp.html

Resources