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(); const bool inLayout = not allDetails->value(id).IsInLayout();
ToggleDetailInLayout *togglePrint = new ToggleDetailInLayout(id, inLayout, m_data, m_doc); 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); qApp->getUndoStack()->push(togglePrint);
} }
@ -194,7 +194,7 @@ void VWidgetDetails::ShowContextMenu(const QPoint &pos)
if (not select == m_data->DataDetails()->value(id).IsInLayout()) if (not select == m_data->DataDetails()->value(id).IsInLayout())
{ {
ToggleDetailInLayout *togglePrint = new ToggleDetailInLayout(id, select, m_data, m_doc); 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); 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 int ToggleDetailInLayout::id() const
{ {
@ -134,8 +118,7 @@ void ToggleDetailInLayout::Do(bool state)
VDetail det = m_data->DataDetails()->value(m_id); VDetail det = m_data->DataDetails()->value(m_id);
det.SetInLayout(state); det.SetInLayout(state);
m_data->UpdateDetail(m_id, det); m_data->UpdateDetail(m_id, det);
emit UpdateList();
emit NeedLiteParsing(Document::LiteParse);
} }
else else
{ {

View File

@ -50,10 +50,12 @@ public:
virtual ~ToggleDetailInLayout(); virtual ~ToggleDetailInLayout();
virtual void undo() Q_DECL_OVERRIDE; virtual void undo() Q_DECL_OVERRIDE;
virtual void redo() 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; virtual int id() const Q_DECL_OVERRIDE;
quint32 getDetId() const; quint32 getDetId() const;
bool getNewState() const; bool getNewState() const;
signals:
void UpdateList();
private: private:
Q_DISABLE_COPY(ToggleDetailInLayout) Q_DISABLE_COPY(ToggleDetailInLayout)
quint32 m_id; quint32 m_id;