Commit 872a6d9c authored by Fushan Wen's avatar Fushan Wen
Browse files

kstyle: don't blindly fill contentsRect when calculating textRect



Otherwise in RTL layout the text start position will be the left side of
the button.

Co-authored-by: Alexander Volkov's avatarAlexander Volkov <avolkov@astralinux.ru>

BUG: 459444
FIXED-IN: 5.26


(cherry picked from commit 8e4db038)
parent f4ae4f70
Pipeline #235982 passed with stage
in 6 minutes and 27 seconds
......@@ -4695,10 +4695,8 @@ bool Style::drawToolButtonLabelControl(const QStyleOption *option, QPainter *pai
}
const int padding = (contentsRect.height() - textSize.height()) / 2;
textRect = {
QPoint(iconRect.right() + Metrics::ToolButton_ItemSpacing + 1, contentsRect.top() + padding),
QPoint(contentsRect.right(), contentsRect.bottom() - padding)
};
textRect = {QPoint(iconRect.right() + Metrics::ToolButton_ItemSpacing + 1, contentsRect.top() + padding),
QSize(textSize.width(), contentsRect.height() - 2 * padding)};
// Don't use QRect::isEmpty(). It does not return true if size is 0x0.
hasText = !textRect.size().isEmpty();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment