0

I have one QToolBar with two QActions, defined in .ui file.

     <widget class="QToolBar" name="mainToolBar">
      <action name="reviewAct">
       <property name="text">
        <string>Review</string>
       </property>
       <property name="toolTip">
        <string>Review Job</string>
       </property>
      </action>
      <action name="enableAct">
       <property name="text">
        <string>Enable</string>
       </property>
       <property name="toolTip">
        <string>Enable b</string>
       </property>
      </action>
      <addaction name="reviewAct"/>
      <addaction name="enableAct"/>
     </widget>

The tooltip of reviewAct is "Review Job". The enableAct is for setting reviewAct enable or not.

    ui.enableAct->setCheckable(true);
    connect(ui.enableAct, SIGNAL(triggered(bool)), ui.reviewAct, SLOT(setEnabled(bool)));

Then set stylesheet below:

QToolButton[text="Review"] {
  qproperty-shortcut: "Ctrl+Shift+Return";
  qproperty-toolTip: "Review Job (Ctrl+Shift+Return)";
  background-color: red; border: none;
  }

The tooltip is changed to "Review Job (Ctrl+Shift+Return)". Everything is ok until ui.enableAct is triggered, the tooltip will reset to "Review Job". It is not reasonable and I don't know why.

enter image description here

Why tooltip set by qstylesheet is covered?

hiki
  • 1

0 Answers0