设置按钮的背景图片,背景透明度
1 QPushButton *push_button = new QPushButton; 2 push_button->setMaximumSize(32, 32); 3 push_button->setMinimumSize(32, 32); 4 QIcon btn_add_icon; 5 btn_add_icon.addFile("images/add.png"); 6 push_button->setIcon(btn_add_icon); 7 push_button->setIconSize(QSize(32, 32)); 8 // 1、push_button->setFlat(true); //按钮背景为透明,但是有边框 9 // 2、通过样式表改变按钮的背景 10 push_button->setStyleSheet( 11 "QPushButton{background:rgba(0,0,0,0);border:1px solid rgba(0,0,0,0);}");
原文地址:https://www.cnblogs.com/malinzhai/p/12641185.html
时间: 2024-09-28 04:30:29