From ff6930d45273376d366d74f39bc944d1de09e021 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Tue, 15 Jul 2014 17:09:31 +0200 Subject: [PATCH] ProjectExplorer: Dynamic padding for mini targetselector ListWidget::padding() returned a contant 30, which can be too small if the style has wider scrollbars than that. This patch add pixel metrics from the style to roughly calculate the needed padding, and adds 10 pixels to it. Change-Id: Ia9b54174f9a91dee80ad99b4d9ad2489cde220c5 Reviewed-by: Daniel Teske --- src/plugins/projectexplorer/miniprojecttargetselector.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/projectexplorer/miniprojecttargetselector.cpp b/src/plugins/projectexplorer/miniprojecttargetselector.cpp index 812fdc737af..91d47f44b70 100644 --- a/src/plugins/projectexplorer/miniprojecttargetselector.cpp +++ b/src/plugins/projectexplorer/miniprojecttargetselector.cpp @@ -228,7 +228,9 @@ void ListWidget::setOptimalWidth(int width) int ListWidget::padding() { // there needs to be enough extra pixels to show a scrollbar - return 30; + return 2 * style()->pixelMetric(QStyle::PM_FocusFrameHMargin, 0, this) + + style()->pixelMetric(QStyle::PM_ScrollBarExtent, 0, this) + + 10; } ////////