wumu
2024-01-31 a9d5d7f29fe1ab664c66d87e898ac34a03b044c2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "clientmainwindow.h"
#include <QApplication>
 
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    ClientMainWindow w;
    //w.setStyleSheet("background-color:#FFC7F0");
    // 蓝色渐变
    //w.setStyleSheet("background-color:qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #7bbfea,stop:0.5 #afdfe4 ,stop:1 #7bbfea)");
 
    // 绿色渐变
    //w.setStyleSheet("background-color:qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #a3cf62,stop:0.5 #bed742 ,stop:1 #a3cf62)");
 
 
//    QLinearGradient gradient(0, 0, 1, 1); // 创建线性渐变对象
//    gradient.setColorAt(0.0, QColor(255, 0, 0)); // 设置起始颜色
//    gradient.setColorAt(1.0, QColor(0, 255, 0)); // 设置结束颜色
 
//    // 将渐变效果应用到 QWidget 上
//    QPalette palette;
//    palette.setBrush(QPalette::Background,gradient);
//    w.setBackgroundRole(QPalette::Highlight);
//    w.setPalette(palette);
//    w.setAutoFillBackground(true);
 
 
    w.show();
 
    return a.exec();
}