Hi everyone,
I want to change pushbutton color on click. Suppose if current color is red, on click it ll change to green and after release also it ll be green. There should not any effect between red and green.
Can anybody please help me ?
Thanks.
Hi everyone,
I want to change pushbutton color on click. Suppose if current color is red, on click it ll change to green and after release also it ll be green. There should not any effect between red and green.
Can anybody please help me ?
Thanks.
Why do you use then a QPushbutton? There are another controls for thi e.g canvas. You can connect it with a onClick method. I think this is easier to make an custom button.
Thanks for reply.
I dont know about canvas. Is qt 4.7 supports canvas ? Can you please give some example or link ?
What are other controls which can be used ?
Yes I was trying to reimplement the paintEvent. But I have some queries. How I will know paintEvent is called for focus in/out, mouse press/release ?
I think using custom widget i can do this. I ll try this.
Is stylesheets will work for a flat button ?
Ok my actual goal is to make something like QtCreater left most widget( widget contain debug,design,edit,project etc).
So please sugget how to do this.
Thanks.
That's a blind route. fecub is talking about QtQuick which you are not using.
You won't and you shouldn't care. paintEvent is called for redrawing the widget and not for other event handlers. It is your responsibility to preserve the state of the widget so that it can be queried in the paintEvent and used to draw the current state of the widget.How I will know paintEvent is called for focus in/out, mouse press/release ?
Stylesheets will work for any widget albeit that is not the right tool for this task.Is stylesheets will work for a flat button ?
I don't see how you'd obtain this by painting a button red or green. Creator uses a custom style with regular widgets and custom widgets with custom painting. The effect you mention is based on the value of QAbstractButton::checked property.Ok my actual goal is to make something like QtCreater left most widget( widget contain debug,design,edit,project etc).
I didnt get you. Are you telling me to store the present state and paint according to that ?
What I am trying to do is : In left side vertically I want to put some button(any control) and when you click color will change and right side I will load some information.
It is some thing equivalent to tabWidget.
Thanks.
Bookmarks