| 227 | } |
| 228 | |
| 229 | void PopupWidget::updateGeometry() |
| 230 | { |
| 231 | Q_ASSERT(parentWidget()); |
| 232 | const int border = list->frameWidth(); |
| 233 | QSize size = parentWidget()->size(); |
| 234 | auto itemHeight = fontMetrics().height() * 2 + 5; // same as itemdelegate |
| 235 | auto height = 10 * itemHeight; |
| 236 | if (model && model->rowCount() < 10) |
| 237 | height = model->rowCount() * itemHeight; |
| 238 | |
| 239 | height = height < minimumHeight() ? minimumHeight() : height; |
| 240 | const QRect rect(parentWidget()->mapToGlobal(QPoint(-border, -(height + 5))), QSize(size.width(), height)); |
| 241 | setGeometry(rect); |
| 242 | } |
| 243 | |
| 244 | void PopupWidget::selectFirstRow() |
| 245 | { |