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 <daniel.teske@digia.com>
This commit is contained in:
Alessandro Portale
2014-07-15 17:09:31 +02:00
parent 5f23a89947
commit ff6930d452

View File

@@ -228,7 +228,9 @@ void ListWidget::setOptimalWidth(int width)
int ListWidget::padding() int ListWidget::padding()
{ {
// there needs to be enough extra pixels to show a scrollbar // 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;
} }
//////// ////////