| Summary: | KisIntegerParseSpinBox and KisDoubleParseSpinBox's sizeHint().height() sometimes returns 26 and sometimes 25 based on the parent element | ||
|---|---|---|---|
| Product: | [Applications] krita | Reporter: | littlelightlittlefire |
| Component: | Dockers | Assignee: | Deif Lou <ginoba> |
| Status: | RESOLVED INTENTIONAL | ||
| Severity: | normal | CC: | amy |
| Priority: | NOR | ||
| Version First Reported In: | git master (please specify the git hash!) | ||
| Target Milestone: | --- | ||
| Platform: | Other | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
|
Description
littlelightlittlefire
2022-04-28 14:42:58 UTC
The links from the MR doesn't seem to work, here's them again: The line references are: 1. https://invent.kde.org/graphics/krita/-/blob/c3b812170829a38ab2df92a26ca0974bc9d336a8/libs/widgets/kis_color_input.cpp#L57 2. https://invent.kde.org/graphics/krita/-/blob/c3b812170829a38ab2df92a26ca0974bc9d336a8/libs/widgets/kis_color_input.cpp#L480 Place `qDebug() << m_input->sizeHint().height();` and `qDebug() << input->sizeHint().height();` in those positions respectively. I remade the slider spin boxes but I didn't touch those color sliders. Do everything points to that weird +1, maybe a leftover of the old widgets. I cannot check right now, but if you can, try removing that and see if it is solved, and tell me. Gu(In reply to Deif Lou from comment #2) > I remade the slider spin boxes but I didn't touch those color sliders. Do > everything points to that weird +1, maybe a leftover of the old widgets. I > cannot check right now, but if you can, try removing that and see if it is > solved, and tell me. I've removed the sliders and it does not help. I've created an easy reproduction here (patch onto master): https://invent.kde.org/lllf/krita/-/commit/7279a8c797d3dffaf348e4e37006858f5d1ca4a6 Creating the component in the constructor results in 26, creating the component in the update() methods results in 25 The issue is not in Krita's slider spinbox widgets. It can be reproduced using QDoubleSpinBox as well. And I don't think it is an issue with sizeHint. If one uses: > qDebug() << input->fontMetrics().height(); instead of: > qDebug() << input->sizeHint().height() it can be seen that the real problem is in the font size. I don't know yet how the font size is changing, but it seems that there is not a problem specific to this docker. The issue is that the font of the dockers is set to one with smaller size with: > dockWidget->setFont(KisUiFont::dockFont()); and docFont is: > QFont dockFont() > { > QFont font = normalFont(); > font.setPointSizeF(font.pointSizeF() * 0.9); > return font; > } Since the font size is taken into account in the QDoubleSpinBox::sizeHint, this also influences the spinbox size. It seems to be an intentional thing, so I'm nor sure this is a bug. |