Change color text QAction
-
You can use a QWidgetAction like
QWidgetAction *newAct = new QWidgetAction(this); QLabel *label = new QLabel(tr("New")); label->setStyleSheet("color: red"); newAct->setDefaultWidget(label); newAct->setShortcuts(QKeySequence::New); newAct->setStatusTip(tr("Create a new file")); connect(newAct, SIGNAL(triggered()), this, SLOT(newFile())); ... ... menu->addAction(newAct );
-
I can not apply the style directly on QAction?because I work on an application already prepared and I not master code, voila les images de mon QAction
http://server.mediazain.com/capture.png -
QAction does not support styleSheet or Palette as its just a holder class that inherits QObject. Inorder to use stylesheets/color you need to use it a QWidgetAction incase of a QMenu. In the image link where do you use a QAction ?
check
-
I was able to apply style bold in text QAction in ui file
<action name="actionBack">
<property name="icon">
<iconset resource="../sankore.qrc">
<normaloff>:/images/toolbar/previousPageOn.png</normaloff>:/images/toolbar/previousPageOn.png</iconset>
</property>
<property name="text">
<string>Précédent</string>
</property>
<property name="toolTip">
<string>Précédent</string>
</property>
<property name="shortcut">
<string>PgUp</string>
</property>
<property name="font">
<font>
<bold>true</bold>
</font>
</property>
</action>there to there not a way to change the color of text? Thank you for your answer.