helloSystem / QtPlugin

Qt platform plugin and style, required for Qt applications to export their menus over D-Bus in the required format
5 stars 4 forks source link

Make button selected via keyboard visible by changing its outline color #11

Open probonopd opened 3 years ago

probonopd commented 3 years ago

Follow-up to https://github.com/helloSystem/QtPlugin/issues/10.

Now that we do not display PE_FrameFocusRect anymore, we have no way of seeing when a button has the focus by pressing the tab key.

What we would like is the button border to get a different color when it has the focus, just like with drop-down menus and with QLineEdit.

ksnip_20210427-092043

Good:

    case PE_FrameLineEdit: {
        QRect r = option->rect;
        bool hasFocus = option->state & State_HasFocus;
        bool isEnabled = option->state & State_Enabled;
        const qreal rounding = Ph::LineEdit_Rounding;
        auto pen = hasFocus ? S_highlight_outline : S_window_outline;

The problem is that no case PE_PushButton exists. Why?

antonpat commented 3 years ago

I think it is PE_PanelButtonCommand

probonopd commented 3 years ago

That thing already has

        if (hasFocus || isDefault) {
            outline = S_highlight_outline;
        }

so I am puzzled why it is not becoming blue when being focused with tab.

probonopd commented 3 years ago

But then, I am equally puzzled why the text in the buttons is more or less horizontally centered in Linux now but not on FreeBSD...

louies0623 commented 1 year ago

It depends on what text font its button uses, because if I remember right, there is something wrong with the text font of the button. https://github.com/helloSystem/hello/issues/152

probonopd commented 1 year ago

I am puzzled why it is not becoming blue when being focused with tab.

Easy: because we are setting border-color: grey; in /usr/local/etc/xdg/stylesheet.qss...

Moving this file away removes the issue.