forked from qt-creator/qt-creator
QmlDesigner: Avoid visual artefacts
Avoid visual artefacts when changing states. Change-Id: I00aa1499ff027d060b06699b60ebd2d5162d0e16 Reviewed-by: Henning Gründl <henning.gruendl@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -234,12 +234,12 @@ void FormEditorView::createFormEditorWidget()
|
||||
connect(m_formEditorWidget->resetAction(), &QAction::triggered, this, &FormEditorView::resetNodeInstanceView);
|
||||
}
|
||||
|
||||
void FormEditorView::temporaryBlockView()
|
||||
void FormEditorView::temporaryBlockView(int duration)
|
||||
{
|
||||
m_formEditorWidget->graphicsView()->setUpdatesEnabled(false);
|
||||
static auto timer = new QTimer(qApp);
|
||||
timer->setSingleShot(true);
|
||||
timer->start(1000);
|
||||
timer->start(duration);
|
||||
|
||||
connect(timer, &QTimer::timeout, this, [this]() {
|
||||
m_formEditorWidget->graphicsView()->setUpdatesEnabled(true);
|
||||
@@ -496,6 +496,11 @@ void FormEditorView::customNotification(const AbstractView * /*view*/, const QSt
|
||||
m_formEditorWidget->zoomAction()->zoomOut();
|
||||
}
|
||||
|
||||
void FormEditorView::currentStateChanged(const ModelNode & /*node*/)
|
||||
{
|
||||
temporaryBlockView(100);
|
||||
}
|
||||
|
||||
AbstractFormEditorTool *FormEditorView::currentTool() const
|
||||
{
|
||||
return m_currentTool;
|
||||
|
@@ -84,7 +84,12 @@ public:
|
||||
|
||||
void documentMessagesChanged(const QList<DocumentMessage> &errors, const QList<DocumentMessage> &warnings) override;
|
||||
|
||||
void customNotification(const AbstractView *view, const QString &identifier, const QList<ModelNode> &nodeList, const QList<QVariant> &data) override;
|
||||
void customNotification(const AbstractView *view,
|
||||
const QString &identifier,
|
||||
const QList<ModelNode> &nodeList,
|
||||
const QList<QVariant> &data) override;
|
||||
|
||||
void currentStateChanged(const ModelNode &node) override;
|
||||
|
||||
// FormEditorView
|
||||
WidgetInfo widgetInfo() override;
|
||||
@@ -134,7 +139,7 @@ private:
|
||||
void removeNodeFromScene(const QmlItemNode &qmlItemNode);
|
||||
void hideNodeFromScene(const QmlItemNode &qmlItemNode);
|
||||
void createFormEditorWidget();
|
||||
void temporaryBlockView();
|
||||
void temporaryBlockView(int duration = 1000);
|
||||
void resetNodeInstanceView();
|
||||
|
||||
QPointer<FormEditorWidget> m_formEditorWidget;
|
||||
|
Reference in New Issue
Block a user