QTableWidget headers have no horizontal lines in Windows 10. How can I fix it?
I had the same problem. It can be solved with the following style sheet on the table view/widget:
if(QSysInfo::windowsVersion()==QSysInfo::WV_WINDOWS10){
setStyleSheet(
"QHeaderView::section{"
"border-top:0px solid #D8D8D8;"
"border-left:0px solid #D8D8D8;"
"border-right:1px solid #D8D8D8;"
"border-bottom: 1px solid #D8D8D8;"
"background-color:white;"
"padding:4px;"
"}"
"QTableCornerButton::section{"
"border-top:0px solid #D8D8D8;"
"border-left:0px solid #D8D8D8;"
"border-right:1px solid #D8D8D8;"
"border-bottom: 1px solid #D8D8D8;"
"background-color:white;"
"}");}
This is C++ code but it should be easy to adapt to your needs.
Note1: The background-color and padding are unfortunate but they are necessary to make our custom rendering looks like the default one.
Note2: The color of the border is the color of the grid on my system. I did not use the color of the default header.
Note3: The QTableCornerButton::section part is necessary to add the missing border below the top left corner. If the vertical header is not visible, the missing line is invisible too.
Note4: If (like me) you find that the ugly grey rectangle below the name of your rows needs fixing, just add QHeaderView{background-color:white;} to your style sheet.
Hope this helps.
set this stylesheet in tablewidget.
QTableWidget ::section {
border: 1px outset #161618;
}
Related
I am unable to add borders to the tabulator table using the tabulator 4.2.3 css file.
I've tried changing the -is-bordered classes but the displayed table show no border. I find the Bulma theme pleasing but need borders to make it more table and data entry friendly for my users.
CSS section referenced below:
.tabulator.is-bordered {
border: 1px solid black;
}
.tabulator.is-bordered .tabulator-header .tabulator-col {
border-right: 1px solid black;
}
.tabulator.is-bordered .tabulator-tableHolder .tabulator-table
.tabulator-row .tabulator-cell {
border-right: 1px solid black;
}
I thought I would have 1px Black border around each cell and header, but it still shows as no border.
The is-bordered class is working in v 4.4.3.
Are you sure you are only including the tabulator_bulma.css. if you include the tabulator.css as well the two will fight against each other.
I have a navigation menu with css style of border-bottom and border top set to 2px. This gives a fairly plain look. I want to use an image instead of a line. I have tried to use the src option for this but no luck.
my codde:
border-bottom: 2px solid #FFF; border-top: 2px solid #FFF;
Any help would be appreciated.
Gus
Have you tried using the border-image property:
http://www.w3schools.com/cssref/css3_pr_border-image.asp
Note that it's only compatible with newer browsers (read no IE), so leave your normal border declaration in as a fallback.
I want to use GWT Canvas to draw a dashed border around a canvas element like Rectangle.
I like the style that the css attribute border: dashed produces, especially the way the corners are displayed, like seen here: https://developer.mozilla.org/en-US/docs/CSS/border-style
Can the "source" code of how this dashed line is produces be inspected somewhere?
Found this function in the Firefox source: nsCSSRenderingBorders. I don't understand the code, but the answer probably lies in there.
http://mxr.mozilla.org/mozilla-central/source/layout/base/nsCSSRenderingBorders.cpp
If you want that styling for your borders :
element.style {
background-color: palegreen;
border-style: dashed;
}
or
element.style {
border-style: 2px dashed #000;
}
Is this what you want ?
If you want a java function to do so, or some place to start to 'study' go here gwtcanvasdemo. and there is a link to the sources. Also, another post on SO related to the subject dotted stroke in canvas and then, there is /DashedLineRenderer.java
After searching for a while I saw that they way to set a visible border on a groupbox is to use the StyleSheet property. I added:
border: 2px solid gray;
but there are a couple of problems.
1) Everything inside the groupbox also inherits this setting!
2) The border has a little hole/piece missing near the title.
Here is a picture of what I'm talking about:
Anyone know how to do this properly?
Thanks,
David
The first problem is simple enough When you add a stylesheet to a control it automatically propagates the style to all child widgets. However, you can restrict the use of the style sheet in a couple of ways. You can specify the type of control you want the style sheet to apply to. Example:
QGroupBox {
border: 2px solid gray;
border-radius: 3px;
}
This style sheet will only be set on Group boxes. However, if you put a second group box inside this one, the style will propagate to this one as well. Which may be good or bad.
Another way is to specifically the objectName of the widget you are applying the style to. Example:
QGroupBox#MyGroupBox {
border: 2px solid gray;
border-radius: 3px;
}
This will only apply the style to a group box with an object name of MyGroupBox.
As for the space, it is happening because the title is being drawn on top of your border. You can also add a section to your style sheet to change your groupbox title. This includes setting it's background to transparent, and to move the title around to your hearts content.
Example: This will set your title to the top left corner of the group box just inside your border, with no gap.
QGroupBox::title {
background-color: transparent;
subcontrol-position: top left; /* position at the top left*/
padding:2 13px;
}
this worked for me on Qt 5.1.
qApp->setStyleSheet("QGroupBox { border: 1px solid gray;}");
Elimeléc
Specify a selector for the group box style such as:
QGroupBox
{
border: 2px solid gray;
}
As for the gap, you can probably fix that by setting some padding. Check the docs here.
i used:
border: 1px 1px 1px 1px;
border-style:solid;
but the border line seems to be so thick. i can almost be sure that i have seen thinner border line somewhere. could you make it thinner or did they use images for it?
** Copied from my comment on the question itself **
Actually, I just noticed that you have the border short-hand declaration, which expects several parameters in a precise order. (ie. border: 1px solid black) What you have specified above is invalid. Could that be your problem?
Instead of
border: 1px 1px 1px 1px
try
border-width: 1px
Perhaps a lighter color was used on the border, (silver instead of black) which often gives the illusion of being thinner.
If you mean the borders around the table cells then they will appear thicker because they aren't "collapsable" - you have to write this:
table {
border-collapse: collapse;
}
and it should make the borders on every side of a cell one pixel thick (or thin as you want to call it!) within a table.
You may try consolidating your rules into a single short-hand declaration:
border: 1px solid black;