I am using Pyside2 for python GUI. I am currently working on a QTableWidget. This QTableWidget has 3 columns and 10 rows.
First, when I click on any item in the QTableWidget, I want the entire row to be selected. So I set the selection behaviour using
self.ui.tableWidget.setSelectionBehavior(QAbstractItemView.SelectRows)
Next, I want the entire row to be highlighted in a rounded rectangle shape, so I set the qt style sheet:
QTableWidget::item:selected{
outline: none;
background-color: #dbe7f4;
border-radius: 9px;
}
But the result is like this:
This is not what I expected. As shown in the picture, every cell in this row is highlighted with a rounded rectangle. But I expect the entire row to be highlighted with a rounded rectangle, which means I want the item in the first row to be 'rounded' in the top-left corner and bottom-left corner, and the item in the third row to be 'rounded' in the top-right corner and bottom-right corner.
Later I tried the qss below:
QTableWidget::item:column(0) {
border-top-left-radius: 5px;
border-bottom-left-radius: 5px;
background-color: #dbe7f4;
}
QTableWidget::item:column(2) {
border-top-left-radius: 5px;
border-bottom-left-radius: 5px;
background-color: #dbe7f4;
}
However, it is not working. I also tried:
QTableWidget::item:selected:column(0) {
border-top-left-radius: 5px;
border-bottom-left-radius: 5px;
background-color: #dbe7f4;
}
QTableWidget::item:selected:column(2) {
border-top-left-radius: 5px;
border-bottom-left-radius: 5px;
background-color: #dbe7f4;
}
It is not working either. It just didn't make any difference.
What am I supposed to do? Is there a better way?
Related
Observe the below simple example:
div {
border-bottom: 1px solid black;
border-radius: 20%;
padding: 10px;
}
<div>Test</div>
In Safari, this causes part of the upper borders to be drawn:
I don't want those "ghosted" upper borders. How do I compensate for this?
You need to remove the rounded border on the top side of your div like so:
div {
border-bottom: 1px solid black;
border-radius: 0 0 20% 20%;
padding: 10px;
}
This is using the border-radius shorthand with 4 values where
first value applies to top-left, second value applies to top-right,
third value applies to bottom-right, and fourth value applies to
bottom-left corner"
https://www.w3schools.com/cssref/css3_pr_border-radius.asp
I need to apply style sheet for the QCombobox. Can anyone please give
me an example? I thought using the QScrollView will affect the
QCombobox but it didn't. And how to limit the number of items shown in
a combo box?
You should start from official documentation for QCombobox stylesheets. Basically it is like:
QComboBox {
border: 1px solid gray;
border-radius: 3px;
padding: 1px 18px 1px 3px;
min-width: 6em;
}
QComboBox:editable {
background: white;
}
You can limit number of visible items in QComboBox by using maxVisibleItems property.
Okay so I am currently using this for my <a> tags in HTML, and here is my css for it
#button {
border-style: solid;
border-width: 1px;
border-bottom-width: 5px;
width: auto;
padding-left: 2px;
padding-right: 2px;
text-decoration:none;
color: gray;
}
#button:hover {
color: black;
}
But sadly the buttons are bigger then a standard line and just overlap eachother, for example:
Here is some text [button]
here is some more text [button]
Where the [button]s is beneath/ontop of the other it overlaps in the browser, (if that makes sense)
Here is a screenshot:
How can I make it so it creates a kind of area around it where it cant overlap and will push other elements outwards or so, margin seems to not work (top and bottom does nothing) and padding seems to make the 1px border bigger in height, thanks!
Add
display:inline-block;
to your button selector, e.g.:
#button {
border-style: solid;
border-width: 1px;
border-bottom-width: 5px;
width: auto;
padding-left: 2px;
padding-right: 2px;
text-decoration:none;
color: gray;
display:inline-block;
}
As an aside, i'd recommend that button is a class rather than an id, because you shouldn't really have multiple elements with the same id on the same page.
The distance between the lines in your example is too short to display a Button-Text surrounded by border with space that fits into that line.
So I sugesst to increase the line-height of the default Text.
Here an example: JSFiddle-Example
After much poking around online, I've found lots of advice and examples for using CSS to style submit buttons, but they all result in rectangular buttons. I want to make a non-rectangular button that automatically sizes itself to fit the button legend. Specifically, I want the button to look like this (plus or minus the rounded corners):
Any suggestions?
Totally possible with border radius, but you will have to submit with JavaScript instead of the <button> element.
For instance:
.icon {
background-color: lightblue;
width: 100px;
padding: 4px;
margin: 10px;
border-top-left-radius: 10px;
-moz-border-radius-topleft: 10px;
border-bottom-left-radius: 10px;
-moz-border-radius-bottomleft: 10px;
border-top-right-radius: 60px 22px;
-moz-border-radius-topright: 60px 22px;
border-bottom-right-radius: 60px 22px;
-moz-border-radius-bottomright: 60px 22px;
}
Makes:
See it live:
http://jsfiddle.net/9zamA/
You could use the CSS border triangle trick: http://css-tricks.com/snippets/css/css-triangle/
You could use svg.
I'm using the combobox control:
http://demos.telerik.com/aspnet-mvc/razor/ComboBox?theme=vista
And I want it to be not white, like it is now. Which css property can do this? Is it possible?
I want it to look like this:
You should be able to achieve that with a custom background color on the select element and some rounded corners on its container. Try placing the combobox in a containing DIV and give it these CSS styles:
.rounded {
border-radius: 10px;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
padding: 5px;
background: #333;
}
.rounded select {
width: 100%;
background: #333;
color: #fff;
border: 0;
outline: 0;
}
http://jsfiddle.net/mpHgR/1/
It might be a little off, but it's close to what you want.