Flashing buttons (C with GTK+) - css

I changed color of buttons using css, but when I move the mouse over them, buttons change their color to the default for a moment.
"button:hover" and "button:active" didn't help.

I used both:
background-image: image(black);
background-color: black;
And now it works great.

Related

How do I change the color of the clicked button in my menu bar?

I need some help changing the color of the clicked menu button! Ive looked everywhere for an answser on wordpress, and now I am looking to the internet! As you can see from the picture, the colors are black and orange, and the blue does not go with that. Please Help.
You can use the CSS element state (Active, and Visited) to specify the color needed.
a:visited, a:active {
color: red;
}
You can change the 'a' with the element class. You can send me your website URL and I will prepare the right code for you.
Thanks, let me know if I can help.

How to add a button with image and transparent background to QVideoWidget?

I created a pushbutton in front of a video (use QVideoWidget and QMediaPlayer). I am using an image with a transparent background to set image button.
How can I set a QPushbutton to be transparent, but the image inside to be visible? I have tried setting it transparent, but the image's background turns black.
I have tried this C++ over Qt : Controlling transparency of Labels and Buttons but it doesn't work. And I tried this :
ui->btn_Touchme->setAttribute(Qt::WA_TranslucentBackground);
ui->btn_Touchme->setStyleSheet("QPushButton{background: transparent;}");
ui->btn_Touchme->setAttribute(Qt::WA_NoSystemBackground, true);
ui->btn_Touchme->setAttribute(Qt::WA_TranslucentBackground, true);
and it is still black
I tried using QLabel, but I got same result. Any suggestions for me?
I am using qt 5.3.2 and ubuntu 14.04LTS
If it is ok to show the button margin on mouse hover over the button, you can use a QToolButton with autoRaise set to true.
Also, you can set following stylesheet too to make button transparent even when mouse hovers over it.
ui->btn_Touchme->setStyleSheet("background-color: rgba(255, 255, 255, 0);");
In order to make a QPushButton transparent, you also need to set the button to be "flat":
button->setFlat(true);
button->setStyleSheet("QPushButton { background-color: transparent }");
Or in other words, set the border in the Stylesheet on 0px:
button->setStyleSheet("QPushButton { background-color: transparent; border: 0px }");
I hope this works for you and others that might have the same problem.
I am using Ubuntu 16.04 LTS Qt 5.7.0, and this works for me:
Change the stylesheet of the button in the .ui file:
border: 0px;
background: transparent; is not needed.
if you use qt designer. select the corresponding button and you have to change undermost of properties window "flat" set true; your css now works.
For me "background-color: rgba(255,255,255,0);border: 0px;" seems to work

creating iOS style back button

I am trying to create a iOS style back button for my jQuery mobile based app here is what i have tried ..
HTML
Back
CSS
.ui-btn-left {
background: linear-gradient(#9fbfe7, #6e84a0) repeat scroll 0 0 #87a2c4;
border: #000000;
}
what i couldn't achieve is
making text color white
making triangle shaped button from left side
like this
here is the Fiddle http://jsfiddle.net/A6u9n/
Here is example of iOS Style “Back” Button in CSS.
http://writings.orangegnome.com/writes/ios-style-back-button-in-css/

How to prevent the default blue border being drawn on QLineEdit focus

I am trying to achieve a borderless QLineEdit through CSS. It works fine when the QLineEdit is not in focus but when in focus the default blue border always comes up. The simple CSS I am using:
QLineEdit, QLineEdit:focus { border: none; }
I have tried with different background color through CSS for focus and not-in-focus, it works but I am unable to remove the blue border while in focus. Just to inform, I am working on a Mac.
You might get rid of the focus border by setting:
QLineEdit.setAttribute(Qt::WA_MacShowFocusRect, 0)
Read the documentation, there are plenty of other Mac specific settings
WidgetAttribute-enum
There is rather a similar question too
Refer this question
Maybe also like this way:
ui->treeView->setAttribute(Qt::WA_MacShowFocusRect, 0);
Reference: http://doc.qt.digia.com/4.6/demos-interview-main-cpp.html

color of QPushButton or QToolButton

I am using a Qstylesheet to control the behavior of some QPushButtons and QToolButtons. When I hover over them, they turn black, as I want them to. However, once I press them, they turn a funny greyish reddish color, and there is a red box drawn inside of them.
What is the property or pseudo state that I have to set in order to avoid this behavior? I have been through all the properties related to selection, and background, and cant get this to go away
Without seeing your style it's a little difficult to fix your problem. So what I'll do is explain a little how things work, and hopefully you can decide how best to address your problem.
First, it's important when your styling your button to ensure that you cover all your bases. I'm sure you know most of this, but just in case...
A QPushButton and QToolButton have a number of states that can be styled, so you want to make sure that you make your button noticeably different for each state so that the user can tell the difference.
QPushButton
{
// The default look of your button
}
QPushButton:disabled
{
}
QPushButton:pressed
{
}
QPushButton:focus
{
}
QPushButton:hover
{
}
QPushButton:checked
{
}
Use things like the background color, foreground color, border color, and generally you are good to go.
background-color: red;
color: white; // foreground color
border-width: 1px;
border-color: black;
The second thing to know is this, styles can be inherited. So be really careful when you add a style to a widget. When you create a style try to be specific. If you give this style to something in your UI, the background color will be blue, but the dangerous thing, is that all child widgets of this one will also inherit this style.
QWidget
{
background-color: blue;
}
Maybe that's what you want, but often not. So if you are styling buttons always put the QPushButton or QToolButton selector around them, the same should apply for other things you are styling too. So it's possible that's where your greyish reddish color is coming from.
Now, the last thing to know about styling buttons is the focus rectangle. It is the irritating dotted line that appears when your button has been focussed. See the picture below.
The unfortunate thing is that there is there is no way to style the focus rectangle using style sheets. But you can get rid of it, if that's what you want. See the following link:
Getting rid of the focus rectangle
So, in summary...
Make sure that your button style covers all the states that you
need.
Make sure that your button isn't influenced by any other
styles you have added to other widgets.
Either change, or get rid
of the focus rectangle as needed.
I hope that helps. If you want more specific help, then please post your style, and I'll take a look at it.

Resources