1

I am using a QWidgetAction to create a QMenu "item" that has a QLabel and a QLineEdit. These are added to a QHBoxLayout which is added to a QWidget which is set as the default in the QWidgetAction.

The end result is that everything works, except the QLabel is displayed with grayed out text, as if disabled. Calling setEnabled(true) on everything mentioned above has no effect. The only thing that seems to help is forcing the text color of the QLabel using a stylesheet or rich text, but it's impossible to match the color of the other, regular, menu items. What am I missing?

durka42
  • 1,502
  • 10
  • 17
  • Tested this with Qt 5.12.0 MinGW 64-bit on Windows 10, result looks fine to me (if I understood the question correctly). Screenshot: [link](https://ibb.co/ChTF6Vq). Code: [link](https://pastebin.com/z2TbZcrb). Please provide more info, such as source code and system info to help troubleshoot this problem. – VVV Oct 12 '19 at 06:50
  • Noticed that your question is about setting default widget and not subclassing as im my previous comment. Checked that approach - same result, label text not greyed out. Only difference is that this way the widget action can't be shown in the menu and toolbar simultaneously (as docummented "If a QWidgetAction with only a default widget is added to two toolbars at the same time then the default widget is shown only in the first toolbar the action was added to."). Code: [link](https://pastebin.com/Qwb47w7f). – VVV Oct 12 '19 at 07:08

0 Answers0