问题
I'am using Qt4.8 to create a pushbutton,and then I using setStyleSheet function to set style for this button and tooltip. But this code only applied for button and tooltip is doesn't work. This is my code
QPushButton *status_label;
this->
cellGUI.status_label->setStyleSheet(QString::fromUtf8("QPushButton {color:#E6E6E6;font-weight:bolder;font-family:tahoma;font-size:6px;background-color:rgb(255, 153, 0)} QPushButton::QToolTip {color:#2E2E2E;background-color:#CCCCCC;border:none}"));
Please help me.
回答1:
You need add style sheet for QToolTip. Ex.:
QString style = QString(
"QPushButton {"
// StyleSheet for your push button
" background: blue;"
"}"
"QToolTip {"
// StyleSheet for tool tip
" background: red;"
"}"
);
this->cellGUI.status_label->setStyleSheet(style);
来源:https://stackoverflow.com/questions/31979224/how-to-custom-stylesheet-qtooltip