Improved performans commands Select all/Select none in the list of details in

layout.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2016-10-14 17:11:15 +03:00
parent 87209bc850
commit 710558812a
3 changed files with 10 additions and 25 deletions

View File

@ -81,7 +81,7 @@ void VWidgetDetails::InLayoutStateChanged(int row, int column)
const bool inLayout = not allDetails->value(id).IsInLayout();
ToggleDetailInLayout *togglePrint = new ToggleDetailInLayout(id, inLayout, m_data, m_doc);
connect(togglePrint, &ToggleDetailInLayout::NeedLiteParsing, m_doc, &VAbstractPattern::LiteParseTree);
connect(togglePrint, &ToggleDetailInLayout::UpdateList, this, &VWidgetDetails::UpdateList);
qApp->getUndoStack()->push(togglePrint);
}
@ -194,7 +194,7 @@ void VWidgetDetails::ShowContextMenu(const QPoint &pos)
if (not select == m_data->DataDetails()->value(id).IsInLayout())
{
ToggleDetailInLayout *togglePrint = new ToggleDetailInLayout(id, select, m_data, m_doc);
connect(togglePrint, &ToggleDetailInLayout::NeedLiteParsing, m_doc, &VAbstractPattern::LiteParseTree);
connect(togglePrint, &ToggleDetailInLayout::UpdateList, this, &VWidgetDetails::UpdateList);
qApp->getUndoStack()->push(togglePrint);
}
}

View File

@ -82,22 +82,6 @@ void ToggleDetailInLayout::redo()
}
}
//---------------------------------------------------------------------------------------------------------------------
bool ToggleDetailInLayout::mergeWith(const QUndoCommand *command)
{
const ToggleDetailInLayout *stateCommand = static_cast<const ToggleDetailInLayout *>(command);
SCASSERT(stateCommand != nullptr);
const quint32 id = stateCommand->getDetId();
if (id != m_id)
{
return false;
}
m_newState = stateCommand->getNewState();
return true;
}
//---------------------------------------------------------------------------------------------------------------------
int ToggleDetailInLayout::id() const
{
@ -134,8 +118,7 @@ void ToggleDetailInLayout::Do(bool state)
VDetail det = m_data->DataDetails()->value(m_id);
det.SetInLayout(state);
m_data->UpdateDetail(m_id, det);
emit NeedLiteParsing(Document::LiteParse);
emit UpdateList();
}
else
{

View File

@ -50,16 +50,18 @@ public:
virtual ~ToggleDetailInLayout();
virtual void undo() Q_DECL_OVERRIDE;
virtual void redo() Q_DECL_OVERRIDE;
virtual bool mergeWith(const QUndoCommand *command) Q_DECL_OVERRIDE;
virtual int id() const Q_DECL_OVERRIDE;
quint32 getDetId() const;
bool getNewState() const;
signals:
void UpdateList();
private:
Q_DISABLE_COPY(ToggleDetailInLayout)
quint32 m_id;
VContainer *m_data;
bool m_oldState;
bool m_newState;
quint32 m_id;
VContainer *m_data;
bool m_oldState;
bool m_newState;
void Do(bool state);
};