| 66 | |
| 67 | |
| 68 | QSize ComboBoxDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const |
| 69 | { |
| 70 | Q_UNUSED(option) |
| 71 | Q_UNUSED(index) |
| 72 | |
| 73 | QFontMetrics fm = qApp->fontMetrics(); |
| 74 | QSize maxStringSize(0, 0); |
| 75 | int &width = maxStringSize.rwidth(); |
| 76 | int &height = maxStringSize.rheight(); |
| 77 | |
| 78 | for(const ComboBoxItem &item : comboBoxItems) { |
| 79 | QRect rect = fm.boundingRect(item.first); |
| 80 | |
| 81 | height = rect.height(); // Heights *should* all be the same |
| 82 | width = qMax(rect.width(), width); |
| 83 | } |
| 84 | |
| 85 | QStyleOptionComboBox comobBoxStyleOptions; |
| 86 | return qApp->style()->sizeFromContents(QStyle::CT_ComboBox, &comobBoxStyleOptions, maxStringSize, nullptr); |
| 87 | } |
nothing calls this directly
no outgoing calls
no test coverage detected