Browse Source

修改小数问题

Signed-off-by: codeClown <zhaomengshou@126.com>
codeClown 1 year ago
parent
commit
27814175d2

+ 3 - 3
QFD/widgets/GreyClusteringItemDelegate.cpp

@@ -48,8 +48,8 @@ QWidget *GreyClusteringItemSpinDelegate::createEditor(QWidget *parent, const QSt
     QDoubleSpinBox *editor = new QDoubleSpinBox(parent);
 
     editor->setFrame(false);
-    editor->setMinimum(-10000);
-    editor->setMaximum(10000);
+    editor->setMinimum(-1000000);
+    editor->setMaximum(1000000);
     return editor;
 }
 
@@ -66,7 +66,7 @@ void GreyClusteringItemSpinDelegate::setModelData(QWidget *editor, QAbstractItem
 {
     QDoubleSpinBox *spinBox = static_cast<QDoubleSpinBox *>(editor);
     spinBox->interpretText();
-    int value = spinBox->value();
+    double value = spinBox->value();
 
     model->setData(index, value, Qt::EditRole);
 }

+ 2 - 2
QFD/widgets/GreyClusteringItemDelegate.h

@@ -22,8 +22,8 @@ public:
         QLabel *maxLabel = new QLabel("右");
         m_leftSpin       = new QDoubleSpinBox;
         m_rightSpin      = new QDoubleSpinBox;
-        m_leftSpin->setRange(-1000, 1000);
-        m_rightSpin->setRange(-1000, 1000);
+        m_leftSpin->setRange(-1000000, 1000000);
+        m_rightSpin->setRange(-1000000, 1000000);
 
         hLayout->addWidget(minLabel);
         hLayout->addWidget(m_leftSpin);