You are not logged in.

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

zekigulser

Beginner

  • "zekigulser" is male
  • "zekigulser" started this thread

Posts: 14

Location: Istanbul, TURKEY

Occupation: Computer Engineer

  • Send private message

1

Wednesday, January 21st 2009, 9:58am

general style sheet problem

Hi,

I want to know that is it possible to give a background color to the buttons inside a frame from the source code by not setting the style sheets of each button one by one. Notably, this background color should be set after a button is pressed! I type something like the following but it did not work!

myMainFrame.setStyleSheet(" QPushButton:pressed{ background-color: red}");

Regards

2

Wednesday, January 21st 2009, 11:07am

try

Source code

1
qApp->setStyleSheet( "QPushButton:pressed { background-color: red; }" );

zekigulser

Beginner

  • "zekigulser" is male
  • "zekigulser" started this thread

Posts: 14

Location: Istanbul, TURKEY

Occupation: Computer Engineer

  • Send private message

3

Wednesday, January 21st 2009, 11:17am

Hi,

I tried it but it didn't work either. But when I remove the ":pressed" state, it works.

4

Wednesday, January 21st 2009, 12:20pm

I just tried, it works
Nicolas SOUCHON has attached the following file:
  • wait1.jpg (4.49 kB - 16 times downloaded - latest: Dec 15th 2010, 9:47am)

zekigulser

Beginner

  • "zekigulser" is male
  • "zekigulser" started this thread

Posts: 14

Location: Istanbul, TURKEY

Occupation: Computer Engineer

  • Send private message

5

Wednesday, January 21st 2009, 12:30pm

I think it is not related but where did you put the code line you just wrote above. In main or not?

6

Wednesday, January 21st 2009, 4:55pm

I also think it's not related

Source code

1
2
3
4
5
6
7
8
int main( int ac, char * * av )
{
    QApplication app( ac, av );
    Widget       win;
    app.setStyleSheet( "QPushButton:pressed { background-color: red; }" );
    win.show();
    return( app.exec() );
}