Qt 控件学习1 QPushButton

 QPushButton  *but = new QPushButton(this);  //创建按钮对象
 but->resize(100,30);   //设置大小
 but->move(200,200);    //移动位置
 but->setText("按钮");   //设置显示字符
 //1.设置显示字符大小,2.设置显示字符颜色,3.设置按钮背景色
 but->setStyleSheet("font:20px;color:rgb(255,255,0);background-color:rgb(255,0,0)");
 but->setEnabled(false); //设置按钮失能,点击无效果

 

posted @ 2022-11-12 12:52  ai在西元前  阅读(56)  评论(0)    收藏  举报