当前位置:网站首页>When QT uses qtooltip mouse to display text, the picture of the button will also be displayed and the prompt text style will be modified

When QT uses qtooltip mouse to display text, the picture of the button will also be displayed and the prompt text style will be modified

2022-07-07 03:41:00 Program yuan ZCC

Use QToolTip Problems encountered in :

1、 The mouse will put QPushButton Of Background map Show it

2、 Set up QToolTip Style failed

if(preview) {// Preview on 
       ui->preview->setStyleSheet("border-image:url(:/style/preview_icon.png);");
       ui->preview->setToolTip(" Close the preview ");
} else {
       ui->preview->setStyleSheet("border-image:url(:/style/n_preview_icon.png);");
       ui->preview->setToolTip(" Open Preview ");
}

After modifying the code : 

if(preview) {// Preview on 
       ui->preview->setStyleSheet("QPushButton{border-image:url(:/style/preview_icon.png);}"
                                  "QToolTip{background-color: #ffffff; color:#484848;}");
       ui->preview->setToolTip(" Close the preview ");
} else {
       ui->preview->setStyleSheet("QPushButton{border-image:url(:/style/n_preview_icon.png);}"
                                  "QToolTip{background-color: #ffffff; color:#484848;}");
       ui->preview->setToolTip(" Open Preview ");
}

 

原网站

版权声明
本文为[Program yuan ZCC]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/188/202207062028310950.html