forked from qt-creator/qt-creator
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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user