Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Text is partly cut in QPushButton:focus #4183

@jcznk

Description

@jcznk

Testing on Anki 25.07.2 for Windows. The issue has been present since around version 2.1.55, I believe.
Edit: also reproducible in version ⁨25.08b1.

See, for example, this report: https://forums.ankiweb.net/t/anki-25-01-02-beta-rc/54490/50

Notice how the word Yes is partially cut off on both the left and right sides:

Image

This could be related to the following code:

anki/qt/aqt/stylesheets.py

Lines 177 to 183 in c57b7c4

QPushButton:default {{
border: 1px solid {tm.var(colors.BORDER_FOCUS)};
}}
QPushButton:focus {{
border: 2px solid {tm.var(colors.BORDER_FOCUS)};
outline: none;
}}

  • Changing the QPushButton:focus border to 1px seems to prevent the issue, but also alters the appearance of buttons, e.g., in the Editor.
  • Adding any padding to QPushButton:focus, even padding: 0px;, also appears to prevent the issue. However, the underline below the "Y" in "Yes" changes slightly in length when the button is focused versus unfocused. Also, it breaks some styles, e.g., in some add-on created buttons.
  • Changing QPushButton:default's border to 2px produces a similar effect as the previous solution but also breaks some styles (e.g., the Reset Window Sizes button in Preferences).

Here is how the Yes button appears after applying QPushButton:focus {{ padding: 0px; }} (the text is no longer cut off, but the underline under the "Y" is slightly longer):

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions