diff --git a/Apps/Examples/clipping.cpp b/Apps/Examples/clipping.cpp index 38ac732a7c941b1e3a4b2314179de4fe8d79923b..662844dbacec54912be7d6367041f8002d46628c 100644 --- a/Apps/Examples/clipping.cpp +++ b/Apps/Examples/clipping.cpp @@ -98,14 +98,17 @@ void Clipping::slot_spinBox_GridResolution(int i) updateGL(); } -void Clipping::slot_doubleSpinBox_GridColor(double c) +void Clipping::slot_pushButton_changePlanesColor() { - float r = dynamic_cast(dockWidget())->doubleSpinBox_GridColorR->value(); - float g = dynamic_cast(dockWidget())->doubleSpinBox_GridColorG->value(); - float b = dynamic_cast(dockWidget())->doubleSpinBox_GridColorB->value(); + QColor NewColor; + QColorDialog ColDialog; - m_planeDrawable->setColor(Geom::Vec4f(r, g, b, 1.0)); - updateGL(); + NewColor = ColDialog.getColor(); + + int r, g, b; + NewColor.getRgb(&r, &g, &b); + + m_planeDrawable->setColor(Geom::Vec4f((float)r/255.0, (float)g/255.0, (float)b/255.0, 1.0)); } void Clipping::slot_pushButton_addSphere() @@ -134,14 +137,17 @@ void Clipping::slot_spinBox_SphereResolution(int i) updateGL(); } -void Clipping::slot_doubleSpinBox_SphereGridColor(double c) +void Clipping::slot_pushButton_changeSpheresColor() { - float r = dynamic_cast(dockWidget())->doubleSpinBox_SphereGridColorR->value(); - float g = dynamic_cast(dockWidget())->doubleSpinBox_SphereGridColorG->value(); - float b = dynamic_cast(dockWidget())->doubleSpinBox_SphereGridColorB->value(); + QColor NewColor; + QColorDialog ColDialog; - m_sphereDrawable->setColor(Geom::Vec4f(r, g, b, 1.0)); - updateGL(); + NewColor = ColDialog.getColor(); + + int r, g, b; + NewColor.getRgb(&r, &g, &b); + + m_sphereDrawable->setColor(Geom::Vec4f((float)r/255.0, (float)g/255.0, (float)b/255.0, 1.0)); } void Clipping::slot_doubleSpinBox_ColorAttenuationFactor(double c) @@ -270,9 +276,7 @@ void Clipping::initGUI() setCallBack(dock.pushButton_addPlane, SIGNAL(clicked()), SLOT(slot_pushButton_addPlane())); setCallBack(dock.spinBox_GridResolution, SIGNAL(valueChanged(int)), SLOT(slot_spinBox_GridResolution(int))); - setCallBack(dock.doubleSpinBox_GridColorR, SIGNAL(valueChanged(double)), SLOT(slot_doubleSpinBox_GridColor(double))); - setCallBack(dock.doubleSpinBox_GridColorG, SIGNAL(valueChanged(double)), SLOT(slot_doubleSpinBox_GridColor(double))); - setCallBack(dock.doubleSpinBox_GridColorB, SIGNAL(valueChanged(double)), SLOT(slot_doubleSpinBox_GridColor(double))); + setCallBack(dock.pushButton_changePlanesColor, SIGNAL(clicked()), SLOT(slot_pushButton_changePlanesColor())); setCallBack(dock.compileButton, SIGNAL(clicked()), SLOT(button_compile()) ); @@ -282,27 +286,17 @@ void Clipping::initGUI() unsigned int planesPrecision1, planesPrecision2; m_planeDrawable->getPrecisionDrawing(planesPrecision1, planesPrecision2); dock.spinBox_GridResolution->setValue(planesPrecision1); - Geom::Vec4f planesColor = m_planeDrawable->getColor(); - dock.doubleSpinBox_GridColorR->setValue(planesColor[0]); - dock.doubleSpinBox_GridColorG->setValue(planesColor[1]); - dock.doubleSpinBox_GridColorB->setValue(planesColor[2]); setCallBack(dock.pushButton_addSphere, SIGNAL(clicked()), SLOT(slot_pushButton_addSphere())); setCallBack(dock.spinBox_SphereResolution, SIGNAL(valueChanged(int)), SLOT(slot_spinBox_SphereResolution(int))); - setCallBack(dock.doubleSpinBox_SphereGridColorR, SIGNAL(valueChanged(double)), SLOT(slot_doubleSpinBox_SphereGridColor(double))); - setCallBack(dock.doubleSpinBox_SphereGridColorG, SIGNAL(valueChanged(double)), SLOT(slot_doubleSpinBox_SphereGridColor(double))); - setCallBack(dock.doubleSpinBox_SphereGridColorB, SIGNAL(valueChanged(double)), SLOT(slot_doubleSpinBox_SphereGridColor(double))); + setCallBack(dock.pushButton_changeSpheresColor, SIGNAL(clicked()), SLOT(slot_pushButton_changeSpheresColor())); unsigned int spheresPrecision1, spheresPrecision2; m_sphereDrawable->getPrecisionDrawing(spheresPrecision1, spheresPrecision2); dock.spinBox_GridResolution->setValue(spheresPrecision1); - Geom::Vec4f spheresColor = m_sphereDrawable->getColor(); - dock.doubleSpinBox_SphereGridColorR->setValue(spheresColor[0]); - dock.doubleSpinBox_SphereGridColorG->setValue(spheresColor[1]); - dock.doubleSpinBox_SphereGridColorB->setValue(spheresColor[2]); diff --git a/Apps/Examples/clipping.h b/Apps/Examples/clipping.h index 756a0037f1780e01b1552e81b7377f1610e13bf0..8799498c5da375b70e397c4f43f780bff8362bb5 100644 --- a/Apps/Examples/clipping.h +++ b/Apps/Examples/clipping.h @@ -140,12 +140,12 @@ public slots: void slot_pushButton_addPlane(); void slot_spinBox_GridResolution(int i); - void slot_doubleSpinBox_GridColor(double c); + void slot_pushButton_changePlanesColor(); void slot_pushButton_addSphere(); void slot_spinBox_SphereResolution(int i); - void slot_doubleSpinBox_SphereGridColor(double c); + void slot_pushButton_changeSpheresColor(); void slot_doubleSpinBox_ColorAttenuationFactor(double c); void slot_radioButton_ClippingMode(bool b); diff --git a/Apps/Examples/clipping.ui b/Apps/Examples/clipping.ui index 733404f380f834dc074c610887cac0003a072385..2ac642c2b7eae2435dd5bfa15a6fcc38cf36cbd2 100644 --- a/Apps/Examples/clipping.ui +++ b/Apps/Examples/clipping.ui @@ -6,7 +6,7 @@ 0 0 - 424 + 455 468 @@ -190,68 +190,31 @@ - - - - 1.000000000000000 - - - 0.100000000000000 - - - - + Res. - + 200 - + Color - - - - 0.100000000000000 - - - - - + + - Size - - - - - - - 1.000000000000000 - - - 0.100000000000000 - - - - - - - 1.000000000000000 - - - 0.100000000000000 + Change Color @@ -302,16 +265,6 @@ - - - - 1.000000000000000 - - - 0.100000000000000 - - - @@ -333,23 +286,10 @@ - - - - 1.000000000000000 - - - 0.100000000000000 - - - - - - 1.000000000000000 - - - 0.100000000000000 + + + Change Color