Add zoom slider to the curve editors toolbar

Removed the "Set Default" button from the toolbar since
it does the same as the "linear interpolation" button
and space is rare in the toolbar.

Fixes: QDS-6951
Change-Id: Ifdbf20af2e5365e9bf9b592783b872394cabb7eb
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Aleksei German <aleksei.german@qt.io>
This commit is contained in:
Knud Dollereder
2022-08-04 15:59:45 +02:00
parent 395e0560d4
commit aea64ca1fa
11 changed files with 40 additions and 65 deletions

View File

@@ -71,10 +71,6 @@ CurveEditor::CurveEditor(CurveEditorModel *model, QWidget *parent)
box->addWidget(m_statusLine);
setLayout(box);
connect(m_toolbar, &CurveEditorToolBar::defaultClicked, [this]() {
m_view->setDefaultInterpolation();
});
connect(m_toolbar, &CurveEditorToolBar::unifyClicked, [this]() {
m_view->toggleUnified();
});
@@ -99,6 +95,13 @@ CurveEditor::CurveEditor(CurveEditorModel *model, QWidget *parent)
m_view->viewport()->update();
});
connect(m_toolbar, &CurveEditorToolBar::zoomChanged, [this](double zoom) {
const bool wasBlocked = m_view->blockSignals(true);
m_view->setZoomX(zoom);
m_view->blockSignals(wasBlocked);
m_view->viewport()->update();
});
connect(
m_view, &GraphicsView::currentFrameChanged,
m_toolbar, &CurveEditorToolBar::setCurrentFrame);
@@ -110,6 +113,11 @@ CurveEditor::CurveEditor(CurveEditorModel *model, QWidget *parent)
m_tree->selectionModel(), &SelectionModel::curvesSelected,
m_view, &GraphicsView::updateSelection);
connect(m_view, &GraphicsView::zoomChanged, [this](double x, double y) {
Q_UNUSED(y);
m_toolbar->setZoom(x);
});
auto updateTimeline = [this, model](bool validTimeline) {
if (validTimeline) {
updateStatusLine();