Some issues with QPushButtons custom stylesheet's padding (Windows)
- Dominant language
- Rust
- Stars
- 31.2k
- Forks
- 3.2k
- Avg merge
- 2d 8h
- Merged PRs (30d)
- 72
Description
Testing on Anki 25.08 beta 5. Also reproducible as far back as ~ 2.1.55/2.1.56.
`Stylesheet.py` uses this custom styling
```
def button(self, tm: ThemeManager) -> str:
# For some reason, Windows needs a larger padding to look the same
button_pad = 25 if is_win else 15
return f"""
QPushButton {{ padding-left: {button_pad}px; padding-right: {button_pad}px; }}
```
I believe this code may be an updated version of the one found in [this PR](https://github.com/ankitects/anki/pull/2115), intended to address the same issue - namely, as a workaround to increase the width of the **Help**, **Add**, **History**, and **Close** buttons in the Add window.
This works well for the most part, but it also introduces some issues, particularly with certain add-ons. Since this is a static CSS rule, it doesn’t account for the actual space available around the buttons.
For example, the extra padding may reduce the space available for button icons or placeholders.
---
**[Advanced Copy Fields](https://ankiweb.net/shared/info/1898445115)** — affected button: the one with the `>>` symbol, second line from the top.
1. **Current custom stylesheet** (the `>>` symbol is missing):
2. **After disabling**
`QPushButton {{ padding-left: {button_pad}px; padding-right: {button_pad}px; }}`:
3. **After disabling all `QPushButton` custom styles** (using Fusion as the Qt style):
---
**[Searching PDF Reading and Note-Taking in Add Dialog (Fixed by Shigeඞ)](https://ankiweb.net/shared/info/1250212877)**
1. **Current custom stylesheet** (the labels of the buttons at the bottom of the screen are clipped on both sides, making them unreadable):
2. **After disabling**
`QPushButton {{ padding-left: {button_pad}px; padding-right: {button_pad}px; }}`:
3. **After disabling all `QPushButton` custom styles** (using Fusion as the Qt style):
---
Contributor guide
Research direction
Start in Stylesheet.py at the QPushButton padding rule and reproduce the reported behavior on Windows with the Advanced Copy Fields and PDF Reading add-ons. Compare the Help, Add, History, Close, and add-on buttons; done means the intended button sizing remains while icons, placeholders, and labels are not clipped or missing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100