mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-08-27 19:56:07 -05:00
Enusre that placeholder text is visible for FilterComboBox
This commit is contained in:
@@ -29,6 +29,19 @@ FilterComboBox::FilterComboBox(QWidget *parent, const QString &placehodler)
|
||||
|
||||
if (!placehodler.isEmpty()) {
|
||||
lineEdit()->setPlaceholderText(placehodler);
|
||||
|
||||
// Make sure that the placeholder text is visible
|
||||
QFontMetrics fontMetrics(font());
|
||||
int textWidth = fontMetrics.boundingRect(placehodler).width();
|
||||
|
||||
QStyleOptionComboBox comboBoxOption;
|
||||
comboBoxOption.initFrom(this);
|
||||
int buttonWidth =
|
||||
style()->subControlRect(QStyle::CC_ComboBox,
|
||||
&comboBoxOption,
|
||||
QStyle::SC_ComboBoxArrow, this)
|
||||
.width();
|
||||
setMinimumWidth(buttonWidth + textWidth);
|
||||
}
|
||||
|
||||
setMaxVisibleItems(30);
|
||||
|
||||
Reference in New Issue
Block a user