Qt相关(自用)

QPushButton

QPushButton:hover {  
    background-color: #45a049; /* 鼠标悬停时的背景色 */  
}  
QPushButton:pressed {  
    background-color: #388e3c; /* 按下时的背景色 */  
}
QPushButton {  
    background-color: #4CAF50; //背景颜色
    border-style: outset;      //视觉效果
                               //outset突出
    border-width: 2px;         //边框宽度
    border-radius: 10px;       //边框圆角半径
    border-color: beige;       //边框颜色(border-width>0)
    font: bold 14px;           //字体样式大小(粗体:bold 斜体:italic)
    font-family:"仿宋";        //字体格式
    padding: 6px;              //button的内容和边框的距离
    color: white;              //文本颜色  
    front-size:20px;           //字体大小
}  
  

QMessageBox

        显示消息框

QMessageBox::information(this, "Title", "Hello, this is a message.");

        显示带有按钮的消息框

QMessageBox::StandardButton reply;
reply = QMessageBox::question(this, "Title", "Do you want to save changes?",
                              QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);

if (reply == QMessageBox::Yes) {
    // 用户选择了 "Yes"
    // 执行保存操作
} else if (reply == QMessageBox::No) {
    // 用户选择了 "No"
    // 不保存,直接关闭
} else {
    // 用户选择了 "Cancel" 或关闭了对话框
    // 可以选择取消当前操作
}

        显示警告消息框

QMessageBox::warning(this, "Warning", "The operation could not be completed.");

        显示报错消息框

QMessageBox::critical(this, "Error", "An error occurred.");

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值