ColinDuquesnoy / QDarkStyleSheet

A dark style sheet for QtWidgets application
Other
2.76k stars 725 forks source link

No checked hint of checkable actions inside menu entries #338

Open mgrojo opened 7 months ago

mgrojo commented 7 months ago

Describe Your Environment

[Versions from your environment]

Language

C++

Description / Steps to Reproduce [if necessary]

Place a checkable action in a menu. Check and uncheck the entry.

Actual Result

There is no display hint about whether the menu entry is checked or not.

image

Expected Results / Proposed Result

Clear indication of the checked entries, like in the default style:

image

Relevant Code [if necessary]

Related UI definition in DB Browser for SQLite: https://github.com/sqlitebrowser/sqlitebrowser/blob/e77ae65c11a44c00489596120aff990e4df0a9d4/src/MainWindow.ui#L823

     <string>&amp;View</string>
    </property>
    <addaction name="viewDBToolbarAction"/>
    <addaction name="viewExtraDBToolbarAction"/>
    <addaction name="viewProjectToolbarAction"/>
    <addaction name="separator"/>
   </widget>
  <action name="viewDBToolbarAction">
   <property name="checkable">
    <bool>true</bool>
   </property>
   <property name="icon">
    <iconset resource="icons/icons.qrc">
     <normaloff>:/icons/toolbar</normaloff>:/icons/toolbar</iconset>
   </property>
dpizetta commented 7 months ago

Hey @mgrojo thanks for reporting. QMenus and QComboBox are very complicated to deal with and correlated. This case is a special one where there is an icon + checkable action. You can also notice a space between the icon and name, which it was supposed to have a checkbox, or another indicator without this space as you mentioned. This is related to #308 and many other closed ones like #214. @ccordoba12 do you think @conradolandia can help us with this, since its more related to CSS?

ccordoba12 commented 7 months ago

@ccordoba12 do you think @conradolandia can help us with this, since its more related to CSS?

Yep, I think so. Is the idea to add a new css rule to the checked state of actions in QMenus?

conradolandia commented 7 months ago

I think something like this could work:

image

conradolandia commented 7 months ago

I would like to know if its possible to alter the icon in any way or if it's possible to add another icon... if so, I was also thinking about a checkmark icon added to the checked menu items. Something like this:

image

ccordoba12 commented 7 months ago

I think something like this could work

Yep, I think so too.

I would like to know if its possible to alter the icon in any way or if it's possible to add another icon

Probably not with css alone, but I really don't know.

conradolandia commented 7 months ago

Probably not with css alone, but I really don't know.

Maybe using pseudo-classes like .myclass:checked::after {...}?

dpizetta commented 7 months ago

In the first example, maybe we can remove the extra space (where the check status go). It should be tested with checkable combo boxes too. Thanks for your attention on this.