下面寫個很簡單可以改變按鈕外觀的方法
到designer裡按右鍵,變更樣式表即可
Another way, to edit it's StyleSheets. It's easy!
#include <QApplication>
#include <QPushButton>
#include <QFont>
#include <QMenu>
#include <QLabel>
int main(int argc, char *argv[]) {
QApplication app(argc, argv);
QPushButton *btn = new QPushButton("Close");
btn->setWindowTitle("Signal & Slot");
btn->setFont(QFont("Courier", 18, QFont::Bold));
btn->resize(250, 50);
btn->setStyleSheet("background-color: yellow");
QObject::connect(btn, SIGNAL(clicked()), &app, SLOT(quit()));
btn->show();
return app.exec();
}
全站熱搜
留言列表