void LightDialog::lightChanged(int i) { disconnectControls(); currLight = i; lightSpinBox->setValue(currLight); //load new light Light light = renderer->getLight(i); lightEnable->setChecked(light.isEnabled); Color a = light.ambient; Color d = light.diffuse; Color s = light.specular; Vector3f p = light.pos; ar->setValue(int(a.r*100)); ag->setValue(int(a.g*100)); ab->setValue(int(a.b*100)); dr->setValue(int(d.r*100)); dg->setValue(int(d.g*100)); db->setValue(int(d.b*100)); sr->setValue(int(s.r*100)); sg->setValue(int(s.g*100)); sb->setValue(int(s.b*100)); px->setValue( int(p.x / LIGHT_MAX_X * 100) ); py->setValue( int(p.y / LIGHT_MAX_Y * 100) ); pz->setValue( int(p.z / LIGHT_MAX_Z * 100) ); //px->setText(QString::number(p.x)); py->setText(QString::number(p.y)); pz->setText(QString::number(p.z)); typeComboBox->setCurrentIndex((int)p.w); connectControls(); }
void EMainWindow::changePainting(int index) { if (index == -1) { // если удалили последнюю вкладку - обнуляем все _currentPainting = 0; _currentView = 0; return; } if (_tabs.size() <= index) return; if (_currentPainting) disconnectControls(_currentPainting); // отсоединяем контроллеры _currentPainting = _tabs[index].painting; // обновляем указатели _currentView = _tabs[index].view; connectControls(_currentPainting); // присоединяем контроллеры }