forked from qt-creator/qt-creator
QmlDesigner: Disable TimelineEditorView when not visible
Change-Id: If67a027c9ad52b2b2fa62df8cf94afdd1c2c49d7 Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -77,6 +77,10 @@ TimelineView::~TimelineView() = default;
|
|||||||
void TimelineView::modelAttached(Model *model)
|
void TimelineView::modelAttached(Model *model)
|
||||||
{
|
{
|
||||||
AbstractView::modelAttached(model);
|
AbstractView::modelAttached(model);
|
||||||
|
|
||||||
|
if (!isEnabled())
|
||||||
|
return;
|
||||||
|
|
||||||
if (m_timelineWidget)
|
if (m_timelineWidget)
|
||||||
m_timelineWidget->init();
|
m_timelineWidget->init();
|
||||||
}
|
}
|
||||||
|
@@ -537,10 +537,18 @@ void TimelineWidget::setFocus()
|
|||||||
void TimelineWidget::showEvent(QShowEvent *event)
|
void TimelineWidget::showEvent(QShowEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event)
|
Q_UNUSED(event)
|
||||||
|
|
||||||
|
m_timelineView->setEnabled(true);
|
||||||
|
|
||||||
|
if (m_timelineView->model())
|
||||||
|
init();
|
||||||
|
|
||||||
graphicsScene()->setWidth(m_graphicsView->viewport()->width());
|
graphicsScene()->setWidth(m_graphicsView->viewport()->width());
|
||||||
graphicsScene()->invalidateLayout();
|
graphicsScene()->invalidateLayout();
|
||||||
graphicsScene()->invalidate();
|
graphicsScene()->invalidate();
|
||||||
graphicsScene()->onShow();
|
graphicsScene()->onShow();
|
||||||
|
|
||||||
|
QWidget::showEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TimelineWidget::resizeEvent(QResizeEvent *event)
|
void TimelineWidget::resizeEvent(QResizeEvent *event)
|
||||||
@@ -549,6 +557,12 @@ void TimelineWidget::resizeEvent(QResizeEvent *event)
|
|||||||
graphicsScene()->setWidth(m_graphicsView->viewport()->width());
|
graphicsScene()->setWidth(m_graphicsView->viewport()->width());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TimelineWidget::hideEvent(QHideEvent *event)
|
||||||
|
{
|
||||||
|
m_timelineView->setEnabled(false);
|
||||||
|
QWidget::hideEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
TimelineView *TimelineWidget::timelineView() const
|
TimelineView *TimelineWidget::timelineView() const
|
||||||
{
|
{
|
||||||
return m_timelineView;
|
return m_timelineView;
|
||||||
|
@@ -81,6 +81,7 @@ public slots:
|
|||||||
protected:
|
protected:
|
||||||
void showEvent(QShowEvent *event) override;
|
void showEvent(QShowEvent *event) override;
|
||||||
void resizeEvent(QResizeEvent *event) override;
|
void resizeEvent(QResizeEvent *event) override;
|
||||||
|
void hideEvent(QHideEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void connectToolbar();
|
void connectToolbar();
|
||||||
|
Reference in New Issue
Block a user