From 65dd457847a7c6654d6f96974e6bf911deda1373 Mon Sep 17 00:00:00 2001 From: David Capello Date: Tue, 22 Dec 2015 17:14:26 -0300 Subject: [PATCH] Reduce size hint for ui::ComboBox --- src/ui/combobox.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/ui/combobox.cpp b/src/ui/combobox.cpp index 33deb32f0..ddf508a20 100644 --- a/src/ui/combobox.cpp +++ b/src/ui/combobox.cpp @@ -395,8 +395,8 @@ void ComboBox::onResize(ResizeEvent& ev) void ComboBox::onSizeHint(SizeHintEvent& ev) { - Size reqSize(0, 0); Size entrySize = m_entry->sizeHint(); + Size reqSize = entrySize; // Get the text-length of every item and put in 'w' the maximum value ListItems::iterator it, end = m_items.end(); @@ -404,14 +404,11 @@ void ComboBox::onSizeHint(SizeHintEvent& ev) int item_w = 2*guiscale()+ font()->textLength((*it)->text().c_str())+ - 10*guiscale(); + 16*guiscale(); reqSize.w = MAX(reqSize.w, item_w); } - reqSize.w += entrySize.w; - reqSize.h += entrySize.h; - Size buttonSize = m_button->sizeHint(); reqSize.w += buttonSize.w; reqSize.h = MAX(reqSize.h, buttonSize.h);