QT设置QPushButton样式

    QPushButton *button = new QPushButton("Button");

    // 设置样式表
    button->setStyleSheet("QPushButton {"
                          "background-color: rgb(181, 255, 184);"
                          "border-style: outset;"
                          "border-width: 2px;"
                          "border-radius: 10px;"
                          "border-color: beige;"
                          "font: bold 14px;"
                          "min-width: 10em;"
                          "padding: 6px;"
                          "}"
                          "QPushButton::pressed {"
                          "background-color: rgb(255, 255, 137);"
                          "border-style: inset;"
                          "}");
    button->setFixedHeight(50);
    ui->verticalLayout->addWidget(button);

 

 

你可能感兴趣的:(QT,qt)