26 #include <dtkGuiSupport/dtkColorButton.h>
27 #include <dtkGuiSupport/dtkSplitter.h>
31 class axlInspectorObjectConePrivate
36 QDoubleSpinBox *coordinateApex_x;
37 QDoubleSpinBox *coordinateApex_y;
38 QDoubleSpinBox *coordinateApex_z;
40 QDoubleSpinBox *coordinateBasePoint_x;
41 QDoubleSpinBox *coordinateBasePoint_y;
42 QDoubleSpinBox *coordinateBasePoint_z;
44 QDoubleSpinBox *radius;
46 dtkColorButton *colorButton;
48 QComboBox *comboBoxShader;
50 QCheckBox *checkBoxShader;
51 QLineEdit *lineEditShader;
52 QPushButton *buttonShader;
54 QSlider *sliderOpacity;
60 d(new axlInspectorObjectConePrivate)
62 d->coordinateApex_x = NULL;
63 d->coordinateApex_y = NULL;
64 d->coordinateApex_z = NULL;
66 d->coordinateBasePoint_x = NULL;
67 d->coordinateBasePoint_y = NULL;
68 d->coordinateBasePoint_z = NULL;
72 d->colorButton = NULL;
74 d->comboBoxShader = NULL;
76 d->checkBoxShader = NULL;
77 d->lineEditShader = NULL;
78 d->buttonShader = NULL;
80 d->sliderOpacity = NULL;
92 return QSize(300, 300);
99 connect(d->cone, SIGNAL(modifiedGeometry()),
this, SLOT(
updateValues()));
102 void axlInspectorObjectCone::initWidget()
104 QVBoxLayout *layoutTop =
new QVBoxLayout(
this);
105 layoutTop->addWidget(
new QLabel(
"axlInspectorObjectCone",
this));
108 d->coordinateApex, onCoordDataChangedApex,
112 d->coordinateBasePoint, onCoordDataChangedBasePoint,
113 d->cone->basePoint());
120 d->comboBoxShader, d->checkBoxShader, d->lineEditShader, d->buttonShader,
124 QWidget *top =
new QWidget(
this);
125 top->setMaximumWidth(295);
126 top->setLayout(layoutTop);
132 d->lineEditShader->setText(this->
filePath(shader));
135 QString axlInspectorObjectCone::initShaderValue(
void)
137 return d->cone->shader();
140 QColor axlInspectorObjectCone::initColorValue(
void)
142 return d->cone->color();
145 int axlInspectorObjectCone::initOpacityValue(
void)
147 double initOpacity = 0.0;
148 double opacity = d->cone->opacity();
150 if(opacity > initOpacity)
151 initOpacity = opacity;
153 return 100 * (1.0 - initOpacity);
158 if(d->lineEditShader->isEnabled()) {
160 fileToOpen = QFileDialog::getOpenFileName(
this, tr(
"Open shader"),
"", tr(
"vs file (*.vs)"));
161 d->lineEditShader->setText(fileToOpen);
167 d->cone->setShader(shader);
171 d->cone->touchProperty();
177 d->comboBoxShader->setEnabled(
true);
178 d->lineEditShader->setEnabled(
true);
179 d->buttonShader->setEnabled(
true);
182 d->comboBoxShader->setEnabled(
false);
183 d->lineEditShader->setEnabled(
false);
184 d->buttonShader->setEnabled(
false);
185 d->cone->setShader(
"");
190 d->cone->touchProperty();
195 d->cone->apex()->x() = x;
196 d->cone->touchGeometry();
202 d->cone->apex()->y() = y;
203 d->cone->touchGeometry();
209 d->cone->apex()->z() = z;
210 d->cone->touchGeometry();
216 d->cone->basePoint()->x() = x;
217 d->cone->touchGeometry();
223 d->cone->basePoint()->y() = y;
224 d->cone->touchGeometry();
230 d->cone->basePoint()->z() = z;
231 d->cone->touchGeometry();
237 d->cone->setRadius(radius);
238 d->cone->touchGeometry();
244 QVariant variant = d->cone->QObject::property(
"color");
246 if(variant.isValid()) {
247 d->cone->setColor(color);
250 d->cone->touchProperty();
258 double opacity_d = 1.0 - 0.01 * opacity;
260 QVariant variant = d->cone->QObject::property(
"opacity");
262 if(variant.isValid()) {
263 d->cone->setOpacity(opacity_d);
266 d->cone->touchProperty();
276 const QSignalBlocker blockerApexX(d->coordinateApex_x);
277 const QSignalBlocker blockerApexY(d->coordinateApex_y);
278 const QSignalBlocker blockerApexZ(d->coordinateApex_z);
279 const QSignalBlocker blockerBasePointX(d->coordinateBasePoint_x);
280 const QSignalBlocker blockerBasePointY(d->coordinateBasePoint_y);
281 const QSignalBlocker blockerBasePointZ(d->coordinateBasePoint_z);
282 const QSignalBlocker blockerRadius(d->radius);
284 d->coordinateApex_x->setValue(d->cone->apex()->x());
285 d->coordinateApex_y->setValue(d->cone->apex()->y());
286 d->coordinateApex_z->setValue(d->cone->apex()->z());
287 d->coordinateBasePoint_x->setValue(d->cone->basePoint()->x());
288 d->coordinateBasePoint_y->setValue(d->cone->basePoint()->y());
289 d->coordinateBasePoint_z->setValue(d->cone->basePoint()->z());
290 d->radius->setValue(d->cone->radius());
QSize sizeHint(void) const
#define addColorButton(layoutTop, colorButton, slot, init)
#define addOpacitySlider(layoutTop, sliderOpacity, slot, init)
void setData(axlCone *cone)
#define addPointLayout(layoutTop, name, title, coordinatePoint, slot, init)
#define addValueLayout(layoutTop, name, title, data, slot, init)
void onCoordDataChangedBasePoint_x(double x)
void onShaderStateChanged(bool isShader)
void onColorChanged(QColor color)
void onLineEditShaderChanged(QString)
~axlInspectorObjectCone(void)
void onCoordDataChangedBasePoint_y(double y)
void onShaderChanged(QString)
void onCoordDataChangedApex_y(double y)
void onCoordDataChangedApex_z(double z)
void onCoordDataChangedApex_x(double x)
axlInspectorObjectCone(QWidget *parent=0)
Class axlCone defines 3D cones.
void onOpacityChanged(int opacity)
#define addShaderComboBox(layoutTop, comboBoxShader, checkBoxShader, lineEditShader, buttonShader, onComboBoxChanged, onCheckBoxChanged, onTextChanged, openShader, init)
void onRadiusChanged(double radius)
void onCoordDataChangedBasePoint_z(double z)
QString filePath(const QString &shader)