From 5f726ad92bbe15bbcaa36494f9c823ed16cbfc3b Mon Sep 17 00:00:00 2001 From: maelstrom Date: Thu, 5 Jun 2025 15:22:15 +0200 Subject: [PATCH] fix(editor): combo box closes immediately now, and spinbox allows negative values --- editor/panes/propertiesview.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/editor/panes/propertiesview.cpp b/editor/panes/propertiesview.cpp index cb516b5..a65a2a2 100644 --- a/editor/panes/propertiesview.cpp +++ b/editor/panes/propertiesview.cpp @@ -13,8 +13,12 @@ #include #include #include +#include +#include #include +#include #include +#include #include #include @@ -72,6 +76,8 @@ public: if (meta.type.descriptor == &FLOAT_TYPE) { QDoubleSpinBox* spinBox = new QDoubleSpinBox(parent); spinBox->setValue(currentValue.get()); + spinBox->setMinimum(-INFINITY); + spinBox->setMaximum(INFINITY); if (meta.flags & PROP_UNIT_FLOAT) { spinBox->setMinimum(0); @@ -82,6 +88,8 @@ public: return spinBox; } else if (meta.type.descriptor == &INT_TYPE) { QSpinBox* spinBox = new QSpinBox(parent); + spinBox->setMinimum(INT_MIN); + spinBox->setMaximum(INT_MAX); spinBox->setValue(currentValue.get()); return spinBox; @@ -108,6 +116,13 @@ public: comboBox->setCurrentIndex(i); } + // If a selection is made + // https://forum.qt.io/post/426902 + connect(comboBox, static_cast(&QComboBox::currentIndexChanged), [this, comboBox, index]() { + setModelData(comboBox, view->model(), index); + view->closeEditor(comboBox, QAbstractItemDelegate::EndEditHint::NoHint); + }); + return comboBox; } else if (meta.type.descriptor->fromString) { QLineEdit* lineEdit = new QLineEdit(parent);