#include #include #include #include int main( int argc, char *argv[] ) { QApplication a( argc, argv ); QPushButton btn( "aaa" ); btn.setMinimumSize( 20, 20 ); btn.resize( 200, 40 ); btn.setStyle( QStyleFactory::create( "Fusion ") ); //// #1 //btn.setStyleSheet( "QPushButton {\n" // "background-color: QLinearGradient( x1: 0.0, y1: 0.0, x2: 1.0, y2: 0.0, stop: 0.0 #008000, stop: 1.0 #ffff00 );\n" //"}\n" ); // #2 btn.setStyleSheet( "QPushButton {\n" "background-color: QLinearGradient( x1: 0.0, y1: 0.0, x2: 1.0, y2: 0.0, stop: 0.0 red, stop: 1.0 yellow );\n" "}\n" ); //// #3 //btn.setStyleSheet( "QPushButton {\n" // "background-color: QLinearGradient( x1: 0.0, y1: 0.0, x2: 1.0, y2: 0.0, stop: 0.0 rgb( 255, 0, 0 ), stop: 1.0 rgb( 255, 255, 0 ) );\n" //"}\n" ); btn.show(); return a.exec(); }