JsonWizard: Fix warning

On macOS, pixelMetric(QStyle::PM_LayoutHorizontalSpacing) will always return -1.

```
QWidget::setMinimumSize: (/QWidget) Negative sizes (-1,-1) are not possible
QWidget::setMaximumSize: (/QWidget) Negative sizes (-1,-1) are not possible
QWidget::setMinimumSize: (/QWidget) Negative sizes (-1,-1) are not possible
QWidget::setMaximumSize: (/QWidget) Negative sizes (-1,-1) are not possible
```

Change-Id: I87d83af9f739dec6cdb898880ad8e9e9eaa411f9
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Marcus Tillmanns
2024-12-11 08:41:05 +01:00
parent 577b5f577e
commit 0cae52c16c

View File

@@ -474,8 +474,8 @@ QWidget *SpacerField::createWidget(const QString &displayName, JsonFieldPage *pa
Q_UNUSED(page) Q_UNUSED(page)
int hspace = QApplication::style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing); int hspace = QApplication::style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing);
int vspace = QApplication::style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing); int vspace = QApplication::style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing);
int hsize = hspace * m_factor; int hsize = qMax(0, hspace * m_factor);
int vsize = vspace * m_factor; int vsize = qMax(0, vspace * m_factor);
auto w = new QWidget(); auto w = new QWidget();
w->setMinimumSize(hsize, vsize); w->setMinimumSize(hsize, vsize);