44 : QWidget(parent),
m_d(new
Imp)
46 m_d->ui.setupUi(
this);
51 m_d->linewidthsDisabled =
false;
52 m_d->pointsizesDisabled =
false;
53 m_d->complexityDisabled =
false;
54 m_d->baselightingDisabled =
false;
55 m_d->group =
new SoGroup;
56 m_d->group->setName(
"DrawOptionsGroup");
58 m_d->complexity =
new SoComplexity;
59 m_d->complexity->ref();
60 m_d->drawStyle =
new SoDrawStyle;
61 m_d->drawStyle->ref();
62 m_d->baseLightModel =
new SoLightModel;
63 m_d->baseLightModel->ref();
64 m_d->baseLightModel->model = SoLightModel::BASE_COLOR;
65 m_d->lastEmittedComplexity = 0.5;
67 connect(
m_d->ui.horizontalSlider_linewidths,SIGNAL(valueChanged(
int)),
this,SLOT(
updateNodes()));
68 connect(
m_d->ui.horizontalSlider_pointsizes,SIGNAL(valueChanged(
int)),
this,SLOT(
updateNodes()));
69 connect(
m_d->ui.horizontalSlider_complexity,SIGNAL(valueChanged(
int)),
this,SLOT(
updateNodes()));
70 connect(
m_d->ui.checkBox_useBaseLightModel,SIGNAL(toggled(
bool)),
this,SLOT(
updateNodes()));
187 bool drawStyleAttached(
m_d->group->findChild(
m_d->drawStyle)>=0);
188 if (
m_d->linewidthsDisabled&&
m_d->pointsizesDisabled) {
189 if (drawStyleAttached)
190 m_d->group->removeChild(
m_d->drawStyle);
192 if (!drawStyleAttached)
193 m_d->group->addChild(
m_d->drawStyle);
196 bool complexityAttached(
m_d->group->findChild(
m_d->complexity)>=0);
197 if (
m_d->complexityDisabled) {
198 if (complexityAttached)
199 m_d->group->removeChild(
m_d->complexity);
201 if (!complexityAttached)
202 m_d->group->addChild(
m_d->complexity);
205 bool lightModelAttached(
m_d->group->findChild(
m_d->baseLightModel)>=0);
206 bool lightModelAttachedGoal = !
m_d->baselightingDisabled &&
m_d->ui.checkBox_useBaseLightModel->isChecked();
207 if (lightModelAttachedGoal!=lightModelAttached) {
208 if (lightModelAttached)
209 m_d->group->removeChild(
m_d->baseLightModel);
211 m_d->group->addChild(
m_d->baseLightModel);
216 if (
m_d->lastEmittedComplexity!=complexityval) {
217 m_d->lastEmittedComplexity=complexityval;
222 if (!
m_d->complexityDisabled){
224 complexityval = std::min<double>(1.0,std::max<double>(0.0,0.01+0.991*complexityval));
226 if (
m_d->complexity->value.getValue()!=complexityval){
227 m_d->complexity->value.setValue(complexityval);
229 if (!
m_d->linewidthsDisabled||!
m_d->pointsizesDisabled) {
232 if (
m_d->drawStyle->lineWidth.getValue()!=val_lw)
233 m_d->drawStyle->lineWidth = val_lw;
234 if (
m_d->drawStyle->pointSize.getValue()!=val_ps)
235 m_d->drawStyle->pointSize = val_ps;