Make viewer transparency respond faster and add to combo viewer (#172)

This commit is contained in:
Jeremy Bullock 2020-09-14 21:54:42 -06:00 committed by GitHub
parent de24d9092c
commit 1e645cf022
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 7 deletions

View file

@ -475,12 +475,15 @@ void ComboViewerPanel::initializeTitleBar(TPanelTitleBar *titleBar) {
titleBar->add(QPoint(x, 0), button); titleBar->add(QPoint(x, 0), button);
button->setButtonSet(viewModeButtonSet, SceneViewer::CAMERA3D_REFERENCE); button->setButtonSet(viewModeButtonSet, SceneViewer::CAMERA3D_REFERENCE);
button = new TPanelTitleBarButton( TPanelTitleBarButtonForCameraView* camButton =
titleBar, getIconThemePath("actions/18/pane_cam.svg")); new TPanelTitleBarButtonForCameraView(
button->setToolTip(tr("Camera View")); titleBar, getIconThemePath("actions/18/pane_cam.svg"));
camButton->setToolTip(tr("Camera View"));
x += +1 + iconWidth; x += +1 + iconWidth;
titleBar->add(QPoint(x, 0), button); titleBar->add(QPoint(x, 0), camButton);
button->setButtonSet(viewModeButtonSet, SceneViewer::CAMERA_REFERENCE); camButton->setButtonSet(viewModeButtonSet, SceneViewer::CAMERA_REFERENCE);
connect(camButton, &TPanelTitleBarButtonForCameraView::updateViewer,
[=]() { m_sceneViewer->update(); });
ret = ret && connect(viewModeButtonSet, SIGNAL(selected(int)), m_sceneViewer, ret = ret && connect(viewModeButtonSet, SIGNAL(selected(int)), m_sceneViewer,
SLOT(setReferenceMode(int))); SLOT(setReferenceMode(int)));

View file

@ -394,8 +394,10 @@ void TPanelTitleBarButtonForCameraView::contextMenuEvent(QContextMenuEvent *e) {
transparencySlider->setRange(20, 100); transparencySlider->setRange(20, 100);
transparencySlider->setValue(CameraViewTransparency); transparencySlider->setValue(CameraViewTransparency);
transparencySlider->setOrientation(Qt::Horizontal); transparencySlider->setOrientation(Qt::Horizontal);
connect(transparencySlider, &QSlider::valueChanged, connect(transparencySlider, &QSlider::valueChanged, [=](int value) {
[=](int value) { CameraViewTransparency = value; }); CameraViewTransparency = value;
emit updateViewer();
});
sliderAction->setDefaultWidget(transparencySlider); sliderAction->setDefaultWidget(transparencySlider);
menu.addAction(sliderAction); menu.addAction(sliderAction);
menu.exec(e->globalPos()); menu.exec(e->globalPos());

View file

@ -107,6 +107,8 @@ public:
protected: protected:
void contextMenuEvent(QContextMenuEvent *event) override; void contextMenuEvent(QContextMenuEvent *event) override;
signals:
void updateViewer();
}; };
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View file

@ -483,6 +483,8 @@ void SceneViewerPanel::initializeTitleBar(TPanelTitleBar *titleBar) {
x += +1 + iconWidth; x += +1 + iconWidth;
titleBar->add(QPoint(x, 0), camButton); titleBar->add(QPoint(x, 0), camButton);
camButton->setButtonSet(viewModeButtonSet, SceneViewer::CAMERA_REFERENCE); camButton->setButtonSet(viewModeButtonSet, SceneViewer::CAMERA_REFERENCE);
connect(camButton, &TPanelTitleBarButtonForCameraView::updateViewer,
[=]() { m_sceneViewer->update(); });
ret = ret && connect(viewModeButtonSet, SIGNAL(selected(int)), m_sceneViewer, ret = ret && connect(viewModeButtonSet, SIGNAL(selected(int)), m_sceneViewer,
SLOT(setReferenceMode(int))); SLOT(setReferenceMode(int)));