how to combine 2 different stylesheet in QT - c++

In my application im having a table widget , by using stylesheet i tried to change header border and cells background colors.refer my code below,
//to set cell background color as white
tableWidget->setStyleSheet(" QTableWidget::item { border: 1px solid white; }" );
//to set header background as white
tableWidget->setStyleSheet("QHeaderView::section{background-color: black;color:white;border: 1px solid white;}");
now i want to combine both in style sheet. Guide me how to combine above two stylesheets into 1 stylesheet.

//to set cell background color as white
QString styleSheet = " QTableWidget::item { border: 1px solid white; }";
//to set header background as white
styleSheet += "QHeaderView::section{background-color: black;color:white;border: 1px solid white;}";
tableWidget->setStyleSheet(stylesheet);
However, you can just put everything in a single line, there is no need to split your stylesheet into two parts like this.

Related

How to remove css-grid gutter from outer edge of a row

I am currently working to replicate a design and I am using css grid for the layout.
I applied the css gap attribute and gutters were created between the rows and columns. However, a gutter was created outside the last row and I have been battling to fix it. from what I know about grid gap and also from css Tricks,the gutters are only created between the columns/rows, not on the outer edges.
Following is a screenshot of how it looks like after my implementation current look You can notice the gutter at the bottom of the last row on the right. I do not want the gutter there, I just want the row to take up the space at the bottom. This is the code for the grid container.
.App {
display: grid;
grid-template-rows: repeat(2, 1fr);
grid-template-columns: repeat(4, 1fr);
gap: 25px;
width: 70%;
height: 55%;
background-color: var(--pry-blue);
}

Coloring a table in apache superset

I want to color the background bars (or the entire cells) of the table as shown in the appended screenshot based on the "Group-By"/dimension value (red for "rot", yellow for "gelb" and green for "grün").
I was able to color the metric-part of other visualizations with label_colors, but I have not yet found a way to color the cells of the table based on a "dimension".
Is there a way to do this?
As of now:
EDIT: I wanted to color it the following way (edited with paint):
This is a tad hacky, but you can add a markdown component and add the following markup:
<style>
th {
color: red; /* or whatever color/hex code you want */
}
</style>
The markdown component will be blank after you add this--i.e. there will just be a blank markdown block-- so you may want to add some copy. Alternatively, if you already have a markdown block, you can add it there, and it won't appear as long as you remember the <style></style> tags.

QComboBox text color doesn't change as expected [duplicate]

This question already has answers here:
QComboBox text colour won't change with style sheet
(3 answers)
Closed 8 years ago.
I have a simple QComboBox but I cannot figure out how to change the text color of the selected item. It stays black but it should be white. I used the color:white; properties but it seems to affect only the color of the popup item list.
this is my current stylesheet:
background: rgb(61,61,61);
color: rgb(255,255,255);
selection-color: rgb(255, 255, 255);
the QComboBox keeps having this behaviour:
as you can see the selected item still has an unspecified black color.
I have solved this by including the padding property:
QComboBox { combobox-popup: 0;
color: white;
padding: 0px 0px 0px 0px; }
It seems setting the padding property (with any value) on the combobox in the style sheet makes it properly obey the colour styling.
See for reference:
https://stackoverflow.com/a/24824810/4022402

set line between qtreewidget items

I have a QTreeWidget that items append to it dynamically, I want to set lines between them, I have first pictures and I want it to be like the second one, but I don't know how doing it?
thank you in advance!
Well you can experiment with stylesheets:
treeWidget->setStyleSheet("QTreeWidget::item { border-bottom: 1px solid black;}");
But I am not sure if can get exactly the look you want. You can also subclass QStyledItemDelegate and provide your own sizeHint() and paint() implementations.
If You need to select items, following works a little better I think:
QString style = "QTreeWidget::item:!selected "
"{ "
"border: 1px solid gainsboro; "
"border-left: none; "
"border-top: none; "
"}"
"QTreeWidget::item:selected {}";
allergiesListView->setStyleSheet(style);

CSS3 Border Images

I'm trying to achieve a 5px gradient around all edges. I've found multiple ways to do this in all browsers except for IE (-mos-border-colors and apply 5 separate colors, border-image, etc...).
I've tried CSS3 Pie, but can't seem to get it to function at all in IE (any version). There are multiple sizes for this column, so images would be a hassle.
Any one have any solutions for this?
.col {
border: 5px solid;
-moz-border-image: url(../images/bg-border.png) 5 5 5 5 stretch;
-webkit-border-image: url(../images/bg-border.png) 5 5 5 5 stretch;
border-image: url(../images/bg-border.png) 5 5 5 5 stretch;
behavior: url(/htc/Support/assets/css/PIE.htc);
}
Maybe box-shadow is an option for you, enabling monochrome gradients/shades…
header {
box-shadow: 0 1em 2em #fff;
-webkit-box-shadow: 0 1em 2em #fff;
-moz-box-shadow: 0 1em 2em #fff; }
Does it really need to look identical in every browser?
Some cross browser solutions: http://webdesignerwall.com/tutorials/cross-browser-css-gradient
Please note not all browsers support CSS gradient. To be safe, you shouldn't rely on CSS gradient when coding the layout. It should only be used for enhancing the layout.
I've tried CSS3 Pie, but can't seem to get it to function at all in IE
(any version).
CSS3-Pie is a bit tricky. Try adding position:relative; to the element you want to apply border image to.
csspie cannot resolve relative paths from your stylesheet to your images. If you do not specify absolute paths from document root to your images, css pie cannot find them.
See this issue here:
http://css3pie.com/documentation/known-issues/#relative-paths