Commit d3ed36fb authored by Maire Nicolas's avatar Maire Nicolas

Meilleure gestion des couleurs dans l'interface Qt.

parent b680089a
...@@ -98,14 +98,17 @@ void Clipping::slot_spinBox_GridResolution(int i) ...@@ -98,14 +98,17 @@ void Clipping::slot_spinBox_GridResolution(int i)
updateGL(); updateGL();
} }
void Clipping::slot_doubleSpinBox_GridColor(double c) void Clipping::slot_pushButton_changePlanesColor()
{ {
float r = dynamic_cast<Utils::QT::uiDockInterface*>(dockWidget())->doubleSpinBox_GridColorR->value(); QColor NewColor;
float g = dynamic_cast<Utils::QT::uiDockInterface*>(dockWidget())->doubleSpinBox_GridColorG->value(); QColorDialog ColDialog;
float b = dynamic_cast<Utils::QT::uiDockInterface*>(dockWidget())->doubleSpinBox_GridColorB->value();
m_planeDrawable->setColor(Geom::Vec4f(r, g, b, 1.0)); NewColor = ColDialog.getColor();
updateGL();
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() void Clipping::slot_pushButton_addSphere()
...@@ -134,14 +137,17 @@ void Clipping::slot_spinBox_SphereResolution(int i) ...@@ -134,14 +137,17 @@ void Clipping::slot_spinBox_SphereResolution(int i)
updateGL(); updateGL();
} }
void Clipping::slot_doubleSpinBox_SphereGridColor(double c) void Clipping::slot_pushButton_changeSpheresColor()
{ {
float r = dynamic_cast<Utils::QT::uiDockInterface*>(dockWidget())->doubleSpinBox_SphereGridColorR->value(); QColor NewColor;
float g = dynamic_cast<Utils::QT::uiDockInterface*>(dockWidget())->doubleSpinBox_SphereGridColorG->value(); QColorDialog ColDialog;
float b = dynamic_cast<Utils::QT::uiDockInterface*>(dockWidget())->doubleSpinBox_SphereGridColorB->value();
m_sphereDrawable->setColor(Geom::Vec4f(r, g, b, 1.0)); NewColor = ColDialog.getColor();
updateGL();
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) void Clipping::slot_doubleSpinBox_ColorAttenuationFactor(double c)
...@@ -270,9 +276,7 @@ void Clipping::initGUI() ...@@ -270,9 +276,7 @@ void Clipping::initGUI()
setCallBack(dock.pushButton_addPlane, SIGNAL(clicked()), SLOT(slot_pushButton_addPlane())); setCallBack(dock.pushButton_addPlane, SIGNAL(clicked()), SLOT(slot_pushButton_addPlane()));
setCallBack(dock.spinBox_GridResolution, SIGNAL(valueChanged(int)), SLOT(slot_spinBox_GridResolution(int))); 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.pushButton_changePlanesColor, SIGNAL(clicked()), SLOT(slot_pushButton_changePlanesColor()));
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.compileButton, SIGNAL(clicked()), SLOT(button_compile()) ); setCallBack(dock.compileButton, SIGNAL(clicked()), SLOT(button_compile()) );
...@@ -282,27 +286,17 @@ void Clipping::initGUI() ...@@ -282,27 +286,17 @@ void Clipping::initGUI()
unsigned int planesPrecision1, planesPrecision2; unsigned int planesPrecision1, planesPrecision2;
m_planeDrawable->getPrecisionDrawing(planesPrecision1, planesPrecision2); m_planeDrawable->getPrecisionDrawing(planesPrecision1, planesPrecision2);
dock.spinBox_GridResolution->setValue(planesPrecision1); 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.pushButton_addSphere, SIGNAL(clicked()), SLOT(slot_pushButton_addSphere()));
setCallBack(dock.spinBox_SphereResolution, SIGNAL(valueChanged(int)), SLOT(slot_spinBox_SphereResolution(int))); 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.pushButton_changeSpheresColor, SIGNAL(clicked()), SLOT(slot_pushButton_changeSpheresColor()));
setCallBack(dock.doubleSpinBox_SphereGridColorG, SIGNAL(valueChanged(double)), SLOT(slot_doubleSpinBox_SphereGridColor(double)));
setCallBack(dock.doubleSpinBox_SphereGridColorB, SIGNAL(valueChanged(double)), SLOT(slot_doubleSpinBox_SphereGridColor(double)));
unsigned int spheresPrecision1, spheresPrecision2; unsigned int spheresPrecision1, spheresPrecision2;
m_sphereDrawable->getPrecisionDrawing(spheresPrecision1, spheresPrecision2); m_sphereDrawable->getPrecisionDrawing(spheresPrecision1, spheresPrecision2);
dock.spinBox_GridResolution->setValue(spheresPrecision1); 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]);
......
...@@ -140,12 +140,12 @@ public slots: ...@@ -140,12 +140,12 @@ public slots:
void slot_pushButton_addPlane(); void slot_pushButton_addPlane();
void slot_spinBox_GridResolution(int i); void slot_spinBox_GridResolution(int i);
void slot_doubleSpinBox_GridColor(double c); void slot_pushButton_changePlanesColor();
void slot_pushButton_addSphere(); void slot_pushButton_addSphere();
void slot_spinBox_SphereResolution(int i); void slot_spinBox_SphereResolution(int i);
void slot_doubleSpinBox_SphereGridColor(double c); void slot_pushButton_changeSpheresColor();
void slot_doubleSpinBox_ColorAttenuationFactor(double c); void slot_doubleSpinBox_ColorAttenuationFactor(double c);
void slot_radioButton_ClippingMode(bool b); void slot_radioButton_ClippingMode(bool b);
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>424</width> <width>455</width>
<height>468</height> <height>468</height>
</rect> </rect>
</property> </property>
...@@ -190,68 +190,31 @@ ...@@ -190,68 +190,31 @@
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<item> <item>
<layout class="QGridLayout" name="gridLayout_12"> <layout class="QGridLayout" name="gridLayout_12">
<item row="2" column="2"> <item row="0" column="0">
<widget class="QDoubleSpinBox" name="doubleSpinBox_GridColorG">
<property name="maximum">
<double>1.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_GridResolution"> <widget class="QLabel" name="label_GridResolution">
<property name="text"> <property name="text">
<string>Res.</string> <string>Res.</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="0" column="1">
<widget class="QSpinBox" name="spinBox_GridResolution"> <widget class="QSpinBox" name="spinBox_GridResolution">
<property name="maximum"> <property name="maximum">
<number>200</number> <number>200</number>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0"> <item row="1" column="0">
<widget class="QLabel" name="label_GridColor"> <widget class="QLabel" name="label_GridColor">
<property name="text"> <property name="text">
<string>Color</string> <string>Color</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="1" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBox_GridDisplaySize"> <widget class="QPushButton" name="pushButton_changePlanesColor">
<property name="singleStep">
<double>0.100000000000000</double>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_GridSize">
<property name="text"> <property name="text">
<string>Size</string> <string>Change Color</string>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QDoubleSpinBox" name="doubleSpinBox_GridColorB">
<property name="maximum">
<double>1.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBox_GridColorR">
<property name="maximum">
<double>1.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property> </property>
</widget> </widget>
</item> </item>
...@@ -302,16 +265,6 @@ ...@@ -302,16 +265,6 @@
<layout class="QHBoxLayout" name="horizontalLayout_3"> <layout class="QHBoxLayout" name="horizontalLayout_3">
<item> <item>
<layout class="QGridLayout" name="gridLayout_13"> <layout class="QGridLayout" name="gridLayout_13">
<item row="1" column="2">
<widget class="QDoubleSpinBox" name="doubleSpinBox_SphereGridColorG">
<property name="maximum">
<double>1.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
</widget>
</item>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="label_SphereResolution"> <widget class="QLabel" name="label_SphereResolution">
<property name="text"> <property name="text">
...@@ -333,23 +286,10 @@ ...@@ -333,23 +286,10 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="3">
<widget class="QDoubleSpinBox" name="doubleSpinBox_SphereGridColorB">
<property name="maximum">
<double>1.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
</widget>
</item>
<item row="1" column="1"> <item row="1" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBox_SphereGridColorR"> <widget class="QPushButton" name="pushButton_changeSpheresColor">
<property name="maximum"> <property name="text">
<double>1.000000000000000</double> <string>Change Color</string>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property> </property>
</widget> </widget>
</item> </item>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment