Using Hover and Pressed stylesheet Qt
I used this in my button pushButton stylesheet
QPushButton#pushButton
background-color: yellow;
QPushButton#pushButton:pressed
background-color: rgb(224, 0, 0);
QPushButton#pushButton:hover
background-color: rgb(224, 255, 0);
when I hover my mouse over it, it changes color, like I expect it to , But the hover color remains even when I press the button.
I tried changing the order, but its still the same problem .
little new in Qt.
qt hover stylesheet rollover
add a comment |
I used this in my button pushButton stylesheet
QPushButton#pushButton
background-color: yellow;
QPushButton#pushButton:pressed
background-color: rgb(224, 0, 0);
QPushButton#pushButton:hover
background-color: rgb(224, 255, 0);
when I hover my mouse over it, it changes color, like I expect it to , But the hover color remains even when I press the button.
I tried changing the order, but its still the same problem .
little new in Qt.
qt hover stylesheet rollover
2
'pusButton'. Eeew!
– Michael Scheper
Aug 3 '16 at 21:33
add a comment |
I used this in my button pushButton stylesheet
QPushButton#pushButton
background-color: yellow;
QPushButton#pushButton:pressed
background-color: rgb(224, 0, 0);
QPushButton#pushButton:hover
background-color: rgb(224, 255, 0);
when I hover my mouse over it, it changes color, like I expect it to , But the hover color remains even when I press the button.
I tried changing the order, but its still the same problem .
little new in Qt.
qt hover stylesheet rollover
I used this in my button pushButton stylesheet
QPushButton#pushButton
background-color: yellow;
QPushButton#pushButton:pressed
background-color: rgb(224, 0, 0);
QPushButton#pushButton:hover
background-color: rgb(224, 255, 0);
when I hover my mouse over it, it changes color, like I expect it to , But the hover color remains even when I press the button.
I tried changing the order, but its still the same problem .
little new in Qt.
qt hover stylesheet rollover
qt hover stylesheet rollover
edited Nov 29 '16 at 18:45
mitjap
1381312
1381312
asked Oct 3 '13 at 13:54
harveyslashharveyslash
3,12363778
3,12363778
2
'pusButton'. Eeew!
– Michael Scheper
Aug 3 '16 at 21:33
add a comment |
2
'pusButton'. Eeew!
– Michael Scheper
Aug 3 '16 at 21:33
2
2
'pusButton'. Eeew!
– Michael Scheper
Aug 3 '16 at 21:33
'pusButton'. Eeew!
– Michael Scheper
Aug 3 '16 at 21:33
add a comment |
3 Answers
3
active
oldest
votes
You can combine states, for example:
QPushButton:hover:!pressed
border: 1px solid red;
QSS reference - states
okay ! works fine. thanks a lot I used this :: QPushButton#pushButton background-color:red QPushButton#pushButton:hover:!pressed background-color:green QPushButton#pushButton:hover background-color:yellow
– harveyslash
Oct 3 '13 at 14:42
It is an answer to your question, but in one line. I'll adjust it, if you don't understand ;). Main idea, that you can combine states as you wish. I propose to read qt documentation, there are a lot of useful samples - doc.qt.digia.com/4.7/stylesheet-reference.html
– Dmitry Sazonov
Oct 3 '13 at 14:43
add a comment |
Css, and Qt CSS, depends on the order of declarations. Later declarations with the same specificity will overwrite previous declarations. So, in order to have the pressed
state take precedence, simply move it below the hover
state.
QPushButton#pushButton
background-color: yellow;
QPushButton#pushButton:hover
background-color: rgb(224, 255, 0);
QPushButton#pushButton:pressed
background-color: rgb(224, 0, 0);
add a comment |
You can set the image in QPushButton:
QPushButton#pushButton
background-url(Images/image1.png);
QPushButton#pushButton:pressed
background-url(Images/image2.png);
QPushButton#pushButton:hover
background-url(Images/image3.png);
10
Why did you think the question was about background images?
– Michael Scheper
Aug 17 '16 at 16:00
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f19161119%2fusing-hover-and-pressed-stylesheet-qt%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can combine states, for example:
QPushButton:hover:!pressed
border: 1px solid red;
QSS reference - states
okay ! works fine. thanks a lot I used this :: QPushButton#pushButton background-color:red QPushButton#pushButton:hover:!pressed background-color:green QPushButton#pushButton:hover background-color:yellow
– harveyslash
Oct 3 '13 at 14:42
It is an answer to your question, but in one line. I'll adjust it, if you don't understand ;). Main idea, that you can combine states as you wish. I propose to read qt documentation, there are a lot of useful samples - doc.qt.digia.com/4.7/stylesheet-reference.html
– Dmitry Sazonov
Oct 3 '13 at 14:43
add a comment |
You can combine states, for example:
QPushButton:hover:!pressed
border: 1px solid red;
QSS reference - states
okay ! works fine. thanks a lot I used this :: QPushButton#pushButton background-color:red QPushButton#pushButton:hover:!pressed background-color:green QPushButton#pushButton:hover background-color:yellow
– harveyslash
Oct 3 '13 at 14:42
It is an answer to your question, but in one line. I'll adjust it, if you don't understand ;). Main idea, that you can combine states as you wish. I propose to read qt documentation, there are a lot of useful samples - doc.qt.digia.com/4.7/stylesheet-reference.html
– Dmitry Sazonov
Oct 3 '13 at 14:43
add a comment |
You can combine states, for example:
QPushButton:hover:!pressed
border: 1px solid red;
QSS reference - states
You can combine states, for example:
QPushButton:hover:!pressed
border: 1px solid red;
QSS reference - states
edited Sep 26 '18 at 11:49
answered Oct 3 '13 at 14:41
Dmitry SazonovDmitry Sazonov
6,96512354
6,96512354
okay ! works fine. thanks a lot I used this :: QPushButton#pushButton background-color:red QPushButton#pushButton:hover:!pressed background-color:green QPushButton#pushButton:hover background-color:yellow
– harveyslash
Oct 3 '13 at 14:42
It is an answer to your question, but in one line. I'll adjust it, if you don't understand ;). Main idea, that you can combine states as you wish. I propose to read qt documentation, there are a lot of useful samples - doc.qt.digia.com/4.7/stylesheet-reference.html
– Dmitry Sazonov
Oct 3 '13 at 14:43
add a comment |
okay ! works fine. thanks a lot I used this :: QPushButton#pushButton background-color:red QPushButton#pushButton:hover:!pressed background-color:green QPushButton#pushButton:hover background-color:yellow
– harveyslash
Oct 3 '13 at 14:42
It is an answer to your question, but in one line. I'll adjust it, if you don't understand ;). Main idea, that you can combine states as you wish. I propose to read qt documentation, there are a lot of useful samples - doc.qt.digia.com/4.7/stylesheet-reference.html
– Dmitry Sazonov
Oct 3 '13 at 14:43
okay ! works fine. thanks a lot I used this :: QPushButton#pushButton background-color:red QPushButton#pushButton:hover:!pressed background-color:green QPushButton#pushButton:hover background-color:yellow
– harveyslash
Oct 3 '13 at 14:42
okay ! works fine. thanks a lot I used this :: QPushButton#pushButton background-color:red QPushButton#pushButton:hover:!pressed background-color:green QPushButton#pushButton:hover background-color:yellow
– harveyslash
Oct 3 '13 at 14:42
It is an answer to your question, but in one line. I'll adjust it, if you don't understand ;). Main idea, that you can combine states as you wish. I propose to read qt documentation, there are a lot of useful samples - doc.qt.digia.com/4.7/stylesheet-reference.html
– Dmitry Sazonov
Oct 3 '13 at 14:43
It is an answer to your question, but in one line. I'll adjust it, if you don't understand ;). Main idea, that you can combine states as you wish. I propose to read qt documentation, there are a lot of useful samples - doc.qt.digia.com/4.7/stylesheet-reference.html
– Dmitry Sazonov
Oct 3 '13 at 14:43
add a comment |
Css, and Qt CSS, depends on the order of declarations. Later declarations with the same specificity will overwrite previous declarations. So, in order to have the pressed
state take precedence, simply move it below the hover
state.
QPushButton#pushButton
background-color: yellow;
QPushButton#pushButton:hover
background-color: rgb(224, 255, 0);
QPushButton#pushButton:pressed
background-color: rgb(224, 0, 0);
add a comment |
Css, and Qt CSS, depends on the order of declarations. Later declarations with the same specificity will overwrite previous declarations. So, in order to have the pressed
state take precedence, simply move it below the hover
state.
QPushButton#pushButton
background-color: yellow;
QPushButton#pushButton:hover
background-color: rgb(224, 255, 0);
QPushButton#pushButton:pressed
background-color: rgb(224, 0, 0);
add a comment |
Css, and Qt CSS, depends on the order of declarations. Later declarations with the same specificity will overwrite previous declarations. So, in order to have the pressed
state take precedence, simply move it below the hover
state.
QPushButton#pushButton
background-color: yellow;
QPushButton#pushButton:hover
background-color: rgb(224, 255, 0);
QPushButton#pushButton:pressed
background-color: rgb(224, 0, 0);
Css, and Qt CSS, depends on the order of declarations. Later declarations with the same specificity will overwrite previous declarations. So, in order to have the pressed
state take precedence, simply move it below the hover
state.
QPushButton#pushButton
background-color: yellow;
QPushButton#pushButton:hover
background-color: rgb(224, 255, 0);
QPushButton#pushButton:pressed
background-color: rgb(224, 0, 0);
answered Feb 10 '17 at 13:37
mflodinmflodin
551520
551520
add a comment |
add a comment |
You can set the image in QPushButton:
QPushButton#pushButton
background-url(Images/image1.png);
QPushButton#pushButton:pressed
background-url(Images/image2.png);
QPushButton#pushButton:hover
background-url(Images/image3.png);
10
Why did you think the question was about background images?
– Michael Scheper
Aug 17 '16 at 16:00
add a comment |
You can set the image in QPushButton:
QPushButton#pushButton
background-url(Images/image1.png);
QPushButton#pushButton:pressed
background-url(Images/image2.png);
QPushButton#pushButton:hover
background-url(Images/image3.png);
10
Why did you think the question was about background images?
– Michael Scheper
Aug 17 '16 at 16:00
add a comment |
You can set the image in QPushButton:
QPushButton#pushButton
background-url(Images/image1.png);
QPushButton#pushButton:pressed
background-url(Images/image2.png);
QPushButton#pushButton:hover
background-url(Images/image3.png);
You can set the image in QPushButton:
QPushButton#pushButton
background-url(Images/image1.png);
QPushButton#pushButton:pressed
background-url(Images/image2.png);
QPushButton#pushButton:hover
background-url(Images/image3.png);
answered Dec 4 '15 at 9:03
Bhaskar Kumar SinghBhaskar Kumar Singh
15525
15525
10
Why did you think the question was about background images?
– Michael Scheper
Aug 17 '16 at 16:00
add a comment |
10
Why did you think the question was about background images?
– Michael Scheper
Aug 17 '16 at 16:00
10
10
Why did you think the question was about background images?
– Michael Scheper
Aug 17 '16 at 16:00
Why did you think the question was about background images?
– Michael Scheper
Aug 17 '16 at 16:00
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f19161119%2fusing-hover-and-pressed-stylesheet-qt%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
'pusButton'. Eeew!
– Michael Scheper
Aug 3 '16 at 21:33