void Group::responseReceived(int id, const QVariant &response) { Q_UNUSED(id) m_lightIds.clear(); QVariantMap attributes = response.toMap(); QVariantList lightsMap = attributes.value("lights").toList(); foreach (const QVariant &lightId, lightsMap) { m_lightIds << lightId.toUInt(); } emit lightsChanged(); QVariantMap action = attributes.value("action").toMap(); m_on = action.value("on").toBool(); m_bri = action.value("bri").toUInt(); m_hue = action.value("hue").toUInt(); m_sat = action.value("sat").toUInt(); m_xy = action.value("xy").toPointF(); m_ct = action.value("ct").toInt(); m_alert = action.value("alert").toString(); m_effect = action.value("effect").toString(); QString colorModeString = action.value("colormode").toString(); if (colorModeString == "hs") { m_colormode = ColorModeHS; } else if (colorModeString == "xy") { m_colormode = ColorModeXY; } else if (colorModeString == "ct") { m_colormode = ColorModeCT; } m_reachable = true;//action.value("reachable").toBool(); emit stateChanged(); }
void Group::responseReceived(int id, const QVariant &response) { Q_UNUSED(id) m_lightIds.clear(); QVariantMap attributes = response.toMap(); QVariantList lightsMap = attributes.value("lights").toList(); foreach (const QVariant &lightId, lightsMap) { m_lightIds << lightId.toUInt(); } emit lightsChanged(); QVariantMap action = attributes.value("action").toMap(); m_on = action.value("on").toBool(); emit stateChanged(); }
void PointLightBlock::addLight(Qt3DRender::QAbstractLight *light) { m_lights.append(light); emit lightsChanged(); }
void VolumeViewer::initUserInterfaceWidgets() { // Create a toolbar at the top of the window. QToolBar *toolbar = addToolBar("toolbar"); // Add preferences widget and callback. PreferencesDialog *preferencesDialog = new PreferencesDialog(this, boundingBox); QAction *showPreferencesAction = new QAction("Preferences", this); connect(showPreferencesAction, SIGNAL(triggered()), preferencesDialog, SLOT(show())); toolbar->addAction(showPreferencesAction); // Add the "auto rotate" widget and callback. autoRotateAction = new QAction("Auto rotate", this); autoRotateAction->setCheckable(true); connect(autoRotateAction, SIGNAL(toggled(bool)), this, SLOT(autoRotate(bool))); toolbar->addAction(autoRotateAction); // Add the "next timestep" widget and callback. QAction *nextTimeStepAction = new QAction("Next timestep", this); connect(nextTimeStepAction, SIGNAL(triggered()), this, SLOT(nextTimeStep())); toolbar->addAction(nextTimeStepAction); // Add the "play timesteps" widget and callback. QAction *playTimeStepsAction = new QAction("Play timesteps", this); playTimeStepsAction->setCheckable(true); connect(playTimeStepsAction, SIGNAL(toggled(bool)), this, SLOT(playTimeSteps(bool))); toolbar->addAction(playTimeStepsAction); // Connect the "play timesteps" timer. connect(&playTimeStepsTimer, SIGNAL(timeout()), this, SLOT(nextTimeStep())); // Add the "add geometry" widget and callback. QAction *addGeometryAction = new QAction("Add geometry", this); connect(addGeometryAction, SIGNAL(triggered()), this, SLOT(addGeometry())); toolbar->addAction(addGeometryAction); // Add the "screenshot" widget and callback. QAction *screenshotAction = new QAction("Screenshot", this); connect(screenshotAction, SIGNAL(triggered()), this, SLOT(screenshot())); toolbar->addAction(screenshotAction); // Create the transfer function editor dock widget, this widget modifies the transfer function directly. QDockWidget *transferFunctionEditorDockWidget = new QDockWidget("Transfer Function", this); transferFunctionEditor = new TransferFunctionEditor(transferFunction); transferFunctionEditorDockWidget->setWidget(transferFunctionEditor); connect(transferFunctionEditor, SIGNAL(committed()), this, SLOT(commitVolumes())); connect(transferFunctionEditor, SIGNAL(committed()), this, SLOT(render())); addDockWidget(Qt::LeftDockWidgetArea, transferFunctionEditorDockWidget); // Set the transfer function editor widget to its minimum allowed height, to leave room for other dock widgets. transferFunctionEditor->setMaximumHeight(transferFunctionEditor->minimumSize().height()); // Create slice editor dock widget. QDockWidget *sliceEditorDockWidget = new QDockWidget("Slices", this); sliceEditor = new SliceEditor(boundingBox); sliceEditorDockWidget->setWidget(sliceEditor); connect(sliceEditor, SIGNAL(slicesChanged(std::vector<SliceParameters>)), this, SLOT(setSlices(std::vector<SliceParameters>))); addDockWidget(Qt::LeftDockWidgetArea, sliceEditorDockWidget); // Create isosurface editor dock widget. QDockWidget *isosurfaceEditorDockWidget = new QDockWidget("Isosurfaces", this); isosurfaceEditor = new IsosurfaceEditor(); isosurfaceEditorDockWidget->setWidget(isosurfaceEditor); connect(isosurfaceEditor, SIGNAL(isovaluesChanged(std::vector<float>)), this, SLOT(setIsovalues(std::vector<float>))); addDockWidget(Qt::LeftDockWidgetArea, isosurfaceEditorDockWidget); // Create the light editor dock widget, this widget modifies the light directly. QDockWidget *lightEditorDockWidget = new QDockWidget("Lights", this); LightEditor *lightEditor = new LightEditor(ambientLight, directionalLight); lightEditorDockWidget->setWidget(lightEditor); connect(lightEditor, SIGNAL(lightsChanged()), this, SLOT(render())); addDockWidget(Qt::LeftDockWidgetArea, lightEditorDockWidget); // Create the probe dock widget. QDockWidget *probeDockWidget = new QDockWidget("Probe", this); probeWidget = new ProbeWidget(this); probeDockWidget->setWidget(probeWidget); addDockWidget(Qt::LeftDockWidgetArea, probeDockWidget); // Tabify dock widgets. tabifyDockWidget(transferFunctionEditorDockWidget, sliceEditorDockWidget); tabifyDockWidget(transferFunctionEditorDockWidget, isosurfaceEditorDockWidget); tabifyDockWidget(transferFunctionEditorDockWidget, lightEditorDockWidget); tabifyDockWidget(transferFunctionEditorDockWidget, probeDockWidget); // Tabs on top. setTabPosition(Qt::LeftDockWidgetArea, QTabWidget::North); // Default to showing transfer function tab widget. transferFunctionEditorDockWidget->raise(); // Add the current OSPRay object file label to the bottom status bar. statusBar()->addWidget(¤tFilenameInfoLabel); }