forked from qt-creator/qt-creator
QuickDesigner: Reduce numbers of redraws / state switching in States Editor
nodeInstancePropertyChanged() is called for _every_ state switch ... so the current assumption that it only reflects real changes does not hold. Instead, use the orphaned sceneChanged() method to schedule redraws. However, this still results in some overhead when switching to the base state (sceneChanged() cannot decide whether it has to redraw all other states or not). Reviewed-by: Christiaan Janssen
This commit is contained in:
@@ -339,16 +339,11 @@ void StatesEditorView::nodeOrderChanged(const NodeListProperty &listProperty, co
|
||||
|
||||
void StatesEditorView::nodeInstancePropertyChanged(const ModelNode &node, const QString &propertyName)
|
||||
{
|
||||
if (!m_settingSilentState) {
|
||||
if (QmlModelState(node).isValid()) {
|
||||
startUpdateTimer(modelStateIndex(node) + 1, 0);
|
||||
} else { //a change to the base state update all
|
||||
for (int i = 0; i < m_modelStates.count(); ++i)
|
||||
startUpdateTimer(i, 0);
|
||||
}
|
||||
}
|
||||
|
||||
// sets currentState() used in sceneChanged
|
||||
QmlModelView::nodeInstancePropertyChanged(node, propertyName);
|
||||
|
||||
if (!m_settingSilentState)
|
||||
sceneChanged();
|
||||
}
|
||||
|
||||
void StatesEditorView::stateChanged(const QmlModelState &newQmlModelState, const QmlModelState &oldQmlModelState)
|
||||
@@ -456,8 +451,11 @@ void StatesEditorView::sceneChanged()
|
||||
if (debug)
|
||||
qDebug() << __FUNCTION__;
|
||||
|
||||
// If we are in base state we have to update the pixmaps of all states
|
||||
// otherwise only the pixmpap for the current state
|
||||
// If we are in base state we have to update the pixmaps of all states,
|
||||
// otherwise only the pixmap for the current state
|
||||
|
||||
// TODO: Since a switch to the base state also results in nodePropertyChanged and
|
||||
// therefore sceneChanged calls, we're rendering too much here
|
||||
|
||||
if (currentState().isValid()) { //during setup we might get sceneChanged signals with an invalid currentState()
|
||||
if (currentState().isBaseState()) {
|
||||
|
Reference in New Issue
Block a user