I am using a custom CSS for a Qt5 window, but there is an ugly horizontal line on the selected button that I would like to get rid of it, or customize it.
This is the CSS I'm using right now.
* {
background-color: black;
color: white;
font: 24px;
}
QPushButton:disabled {
background-color: rgb(67, 67, 67);
border-color: rgb(67, 67, 67);
}
QPushButton {
color: black;
background-color: yellow;
border-width: 1px;
border-color: yellow;
border-style: solid;
border-radius: 10px;
min-width: 3em;
min-height: 30px;
padding: 6px;
}
QPushButton:pressed {
background-color: rgb(255, 193, 0);
border-color: rgb(255, 193, 0);
}
QPushButton:hover {
border-color: rgb(255, 193, 0);
}
QPushButton:default {
background-color: rgb(255, 255, 255);
}
Related
I want to change the text color and background color of the links when hovered? The background color changes but the text does not change color
CSS:
.choice-container {
display: flex;
margin-bottom: 0.5rem;
width: 100%;
font-size: 1.8rem;
color: rgb(255, 238, 0);
background-color: rgb(0, 0, 0);
border: 0.1rem solid rgb(255, 238, 0);
}
.choice-container:hover {
cursor: pointer;
transform: translateY(-0.1rem);
transition: transform 150ms;
color: rgb(0, 0, 0) !important;
background-color: rgb(255, 238, 0);
border: 0.1rem solid rgb(255, 255, 255);
box-shadow: 0 0.4rem 2.4rem 0 rgb(255, 238, 0);
}
It seems to be working without any error.
.choice-container {
display: flex;
margin-bottom: 0.5rem;
width: 100%;
font-size: 1.8rem;
color: rgb(255, 238, 0);
background-color: rgb(0, 0, 0);
border: 0.1rem solid rgb(255, 238, 0);
}
.choice-container:hover {
cursor: pointer;
transform: translateY(-0.1rem);
transition: transform 150ms;
color: rgb(0, 0, 0) !important;
background-color: rgb(255, 238, 0);
border: 0.1rem solid rgb(255, 255, 255);
box-shadow: 0 0.4rem 2.4rem 0 rgb(255, 238, 0);
}
Google
Here, it is in jsfiddle: https://jsfiddle.net/kt1wzv08/
When not hovering:
When hovering:
I have a code:
button {
background: rgb(1, 81, 227);
background: linear-gradient(
90deg,
rgba(1, 81, 227, 1) 35%,
rgba(0, 90, 255, 1) 100%
);
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 20px;
margin: 4px 2px;
cursor: pointer;
border-radius: 6px;
}
And a ton of buttons. I want to apply that css code for all buttons except two, with the IDs startAction & endAction.
How do I do that?
button:not(#startAction):not(#endAction)
by #underscore_d
Your startAction and endAction buttons probably share some of those styles.
If so, just keep those shared lines within the generic button declaration and move the other stuff into a new style and then apply that to the rest of the buttons.
Something like...
button {
display: inline-block;
border: none;
color: white;
...
}
.fancybutton {
background: rgb(1, 81, 227);
background: linear-gradient(
90deg,
rgba(1, 81, 227, 1) 35%,
rgba(0, 90, 255, 1) 100%
);
margin: 4px 2px;
...
}
I am able to customize scrollbar which now looks like below
But, the scrollbar-button looks ugly. I am trying to make the buttons looking like below:
Can anyone please help?
I am using the below css for customizing the scrollbar.
::-webkit-scrollbar {
width: 16px;
}
::-webkit-scrollbar-track {
background: rgb(224, 224, 224);
}
::-webkit-scrollbar-thumb {
background: rgb(200, 200, 200);
border: 0.05em solid #eeeeee;
}
::-webkit-scrollbar-thumb:hover {
background: rgb(180, 180, 180);
}
::-webkit-scrollbar-thumb:active {
background: rgb(117, 117, 117);
}
::-webkit-scrollbar-button {
border-style: solid;
height: 16px;
width: 16px;
}
::-webkit-scrollbar-button:vertical:decrement {
border-width: 0 7px 14px 7px;
border-color: transparent transparent rgb(117, 117, 117) transparent;
}
::-webkit-scrollbar-button:vertical:decrement:hover {
border-color: transparent transparent rgb(180, 180, 180) transparent;
}
::-webkit-scrollbar-button:vertical:increment {
border-width: 14px 7px 0 7px;
border-color: rgb(117, 117, 117) transparent transparent transparent;
}
::-webkit-scrollbar-button:vertical:increment:hover {
border-color: rgb(180, 180, 180) transparent transparent transparent;
}
Please try below
.scrollbar
{
margin-left: 30px;
float: left;
height: 300px;
width: 50px;
background: #F5F5F5;
overflow-y: scroll;
margin-bottom: 25px;
}
.overflow
{
min-height: 400px;
}
#wrapper
{
text-align: center;
width: 500px;
margin: auto;
}
#stylescroll::-webkit-scrollbar-track
{
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
background-color: #F5F5F5;
}
#stylescroll::-webkit-scrollbar
{
width: 6px;
background-color: #F5F5F5;
}
#stylescroll::-webkit-scrollbar-thumb
{
background-color: #a6aebb;
}
<div id="wrapper">
<div class="scrollbar" id="stylescroll">
<div class="overflow"></div>
</div>
</div>
Scrollbar with Custom buttons(both horizontal and vertical bar).....Have a look
Have to customize these classes like:
::-webkit-scrollbar-button:single-button:vertical:decrement {
border-radius: 5px 5px 0 0
height: 16px;
width: 16px;
background-position: center 4px;
background-image: url("data:image/svg+xml;utf8,<svg
xmlns='http://www.w3.org/2000/svg' width='100' height='100' fill='rgb(121, 255,
108)'><polygon points='50,00 0,50 100,50'/></svg>");
}
I have created this interface:
My Question is: HOW TO GET RID OF THAT OBSOLETE LINE using my stylesheet.
The black frame (objectname= mainTabBarWidget(QWidget)) is laid out vertically. It has a Fixed height (38px) and contains these elements from left to right: QToolButton, QTabBar, QToolButton, and another QToolButton.
Its stylesheet is the following:
QWidget#mainTabBarWidget {
border-bottom: 1px solid black;
background-color: rgb(107, 102, 102);
}
The "+" QToolButton creates a new Tab whenever its clicked. The QTabBar (called tabBar) has this stylesheet:
QTabBar#tabBar{
left: 10px; /* move to the right by 5px */
border-bottom: none;
}
QTabBar::tab {
background-color: rgb(194, 180, 180);
border-top: 2px solid rgb(107, 102, 102);
border-left: 2px solid rgb(107, 102, 102);
border-right: 2px solid rgb(107, 102, 102);
border-bottom: none;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
border-bottom-left-radius: -8px;
border-bottom-right-radius: -8px;
min-width: 100px;
max-width: 100px;
height: 35px;
padding: 2px;
}
QTabBar::tab:hover {
background-color: rgb(216, 209, 209);
}
QTabBar::tab:selected {
background-color: rgb(243, 231, 231);
border-color: rgb(0, 0, 0);
}
QTabBar::scroller { /* the width of the scroll buttons */
border: none;
width: 20px;
background-color: rgba(0,0,0,55);
}
QTabBar::tear {
border: none;
background-color: rgba(222,221,15, 45);
width: 0px;
}
QTabBar::tab:disabled {
border: none;
}
P.S.1. When 3 or 4 tabs are added, the line disappears too.
P.S.2. I tried setting the tab width to 120px and the line disappeared, but when I add other tabs and the scroll buttons show up, this line re-appears.
I had a similar problem, but it was solved below.
http://doc.qt.io/qt-5/qtabbar.html#drawBase-prop
QTabBar::setDrawBase(false);
I am trying to apply some style-sheet for scrollbars of QScrollArea and my style sheet as follows.
QScrollBar:vertical {
border-color: rgb(227, 227, 227);
border-width: 1px;
border-style: solid;
background-color: rgb(240, 240, 240);
width: 15px;
margin: 21px 0 21px 0;
}
QScrollBar::handle:vertical {
background-color: rgb(200, 200, 200);
min-height: 25px;
}
QScrollBar::add-line:vertical {
border: 1px solid grey;
background-color: rgb(241, 241, 241);
height: 20px;
subcontrol-position: bottom;
subcontrol-origin: margin;
}
QScrollBar::sub-line:vertical {
border: 1px solid grey;
background-color: rgb(241, 241, 241);
height: 20px;
subcontrol-position: top;
subcontrol-origin: margin;
}
QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {
background: none;
}
QScrollBar::up-arrow:vertical
{
image: url(:/BarIcon/Icons/uparrow.png);
}
QScrollBar::down-arrow:vertical
{
image: url(:/BarIcon/Icons/downarrow.png);
}
QScrollBar:horizontal {
border-color: rgb(227, 227, 227);
border-width: 1px;
border-style: solid;
background-color: rgb(240, 240, 240);
width: 15px;
margin: 0px 21px 0 21px;
}
QScrollBar::handle:horizontal {
background-color: rgb(200, 200, 200);
min-height: 25px;
}
QScrollBar::add-line:horizontal {
border: 1px solid grey;
background-color: rgb(241, 241, 241);
width: 20px;
subcontrol-position: right;
subcontrol-origin: margin;
}
QScrollBar::sub-line:horizontal {
border: 1px solid grey;
background-color: rgb(241, 241, 241);
width: 20px;
subcontrol-position: left;
subcontrol-origin: margin;
}
QScrollBar:left-arrow:horizontal
{
image: url(:/BarIcon/Icons/leftarrow.png);
}
QScrollBar::right-arrow:horizontal
{
image: url(:/BarIcon/Icons/rightarrow.png);
}
QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal {
background: none;
}
This stylesheet perfectly does what it was supposed to for vertical scrollbar but with presence of any single stylesheet related to QScrollBar:horizontal, the bar just disappears.
Please can anyone point out my flaw and what should I do?
Notes:
The styleSheet have been applied on QScrollArea object by using Change styleSheet option of Qt Designer.
And please kindly acknowledge in case where the horizontal scrollbar shows up with this styleSheet on.
You are lucky, the same thing just happened to me today.
This really simple, this is because you just copy-past your vertical style for the horizontal and just change the word "vertical" to "horizontal", but actually there is a few more things to change:
The "width" parameters become "height" in horizontal.
The "height" parameters become "width".
"top" and "bottom" become "left" and "right" (that you did).
Also, if you have asymmetrical margins or such, don't forget to adapt them (you did that too).
This gives the following stylesheet for your particular case:
QScrollBar:vertical {
border-color: rgb(227, 227, 227);
border-width: 1px;
border-style: solid;
background-color: rgb(240, 240, 240);
width: 15px;
margin: 21px 0 21px 0;
}
QScrollBar::handle:vertical {
background-color: rgb(200, 200, 200);
min-height: 25px;
}
QScrollBar::add-line:vertical {
border: 1px solid grey;
background-color: rgb(241, 241, 241);
height: 20px;
subcontrol-position: bottom;
subcontrol-origin: margin;
}
QScrollBar::sub-line:vertical {
border: 1px solid grey;
background-color: rgb(241, 241, 241);
height: 20px;
subcontrol-position: top;
subcontrol-origin: margin;
}
QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {
background: none;
}
QScrollBar::up-arrow:vertical
{
image: url(:/BarIcon/Icons/uparrow.png);
}
QScrollBar::down-arrow:vertical
{
image: url(:/BarIcon/Icons/downarrow.png);
}
QScrollBar:horizontal {
border-color: rgb(227, 227, 227);
border-width: 1px;
border-style: solid;
background-color: rgb(240, 240, 240);
height: 15px;
margin: 0px 21px 0 21px;
}
QScrollBar::handle:horizontal {
background-color: rgb(200, 200, 200);
min-width: 25px;
}
QScrollBar::add-line:horizontal {
border: 1px solid grey;
background-color: rgb(241, 241, 241);
height: 20px;
subcontrol-position: right;
subcontrol-origin: margin;
}
QScrollBar::sub-line:horizontal {
border: 1px solid grey;
background-color: rgb(241, 241, 241);
height: 20px;
subcontrol-position: left;
subcontrol-origin: margin;
}
QScrollBar:left-arrow:horizontal
{
image: url(:/BarIcon/Icons/leftarrow.png);
}
QScrollBar::right-arrow:horizontal
{
image: url(:/BarIcon/Icons/rightarrow.png);
}
QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal {
background: none;
}