Qt: How to delete the white lines? - qt

I want to delete the white lines of the tabwidget on the right and bottom side, but I don't know how.
I've tried to set the border-right-color and border-bottom-color, but it doesn't work.

Try to make it via css
Like that in .qrc in .css:
QTabWidget
{
border: 3px solid grey;
}
or via QWidget::setStyleSheet(const QString &styleSheet)

Related

WordPress Simple CSS PostGrid Background-Color Problem

Im looking to create a demosite (http://emc.ow-media.de/main)
I want to create a grey border (#eeeeee) around the Post Grid-Elements in the top and the bottom.
Where is my mistake?
I set Custom CSS for the bottom post-grids like this:
.layer-wrapper layout-105
{
background-color: #eee;
} ```
If i understand it correctly you need to change the selector to: .layer-wrapper.layout-105
You are basically trying to select an element inside the .layer-wrapper called <layout-105>, that of course does not exist. When you want to select a class don't forget the dot in front. In this case you want to select an element with two classes applied, so don't use a whitespace between the classes.
if you want to add border use border property not background
you forget to add "." in layout-105 & both class combine with "." not use space betwwen two same div classs.
Result
https://ibb.co/74hjDjK
use this:
.layer-wrapper.layout-105 {
border-top: 2px solid #000;
border-bottom: 2px solid #000;
}

QHeaderView has no horizontal lines in Windows 10

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;
}

Get rid of Qt's dotted outline on QListView items

I'm trying to remove the dotted border on the text in this QListView::item using stylesheets:
I've tried variations of border: 0 and show-decoration-selected: 0 on QListView, QListView::item and QListView::item::text to no effect.
I'm using PyQt, but I believe the stylesheet rules are the same as in the C++ libraries.
After some more testing, I found that the following stylesheet works:
QListView {
outline: 0;
}
Setting "outline: 0;" in the stylesheet doesn't work for me (anymore?).
The only solution I could find was to set the ListView's FocusPolicy to "Qt::NoFocus", which comes with obvious drawbacks.
Setting the border to none seems to have done the trick for me.
QListView::item {
border: none;
}

How can the css dottled border be implemented?

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

QGroupBox border

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.

Resources