Speed optimization for switching "In layout" state.
--HG-- branch : develop
This commit is contained in:
parent
38ce1f6265
commit
b43962d40d
|
@ -8,6 +8,7 @@
|
||||||
- Added ability to search measurements by regex.
|
- Added ability to search measurements by regex.
|
||||||
- [#927] Freeze prefix language on pattern/project creation.
|
- [#927] Freeze prefix language on pattern/project creation.
|
||||||
- [#929] New variable type: Separator.
|
- [#929] New variable type: Separator.
|
||||||
|
- Speed optimization for switching "In layout" state.
|
||||||
|
|
||||||
# Version 0.6.2 (unreleased)
|
# Version 0.6.2 (unreleased)
|
||||||
- [#903] Bug in tool Cut Spline path.
|
- [#903] Bug in tool Cut Spline path.
|
||||||
|
|
|
@ -81,6 +81,27 @@ void VWidgetDetails::SelectDetail(quint32 id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VWidgetDetails::ToggledPiece(quint32 id)
|
||||||
|
{
|
||||||
|
const QHash<quint32, VPiece> *details = m_data->DataPieces();
|
||||||
|
const int rowCount = ui->tableWidget->rowCount();
|
||||||
|
for (int row = 0; row < rowCount; ++row)
|
||||||
|
{
|
||||||
|
QTableWidgetItem *item = ui->tableWidget->item(row, 0);
|
||||||
|
|
||||||
|
if (item->data(Qt::UserRole).toUInt() == id)
|
||||||
|
{
|
||||||
|
if (details->contains(id))
|
||||||
|
{
|
||||||
|
details->value(id).IsInLayout() ? item->setIcon(QIcon("://icon/16x16/allow_detail.png")) :
|
||||||
|
item->setIcon(QIcon("://icon/16x16/forbid_detail.png"));
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VWidgetDetails::InLayoutStateChanged(int row, int column)
|
void VWidgetDetails::InLayoutStateChanged(int row, int column)
|
||||||
{
|
{
|
||||||
|
@ -97,7 +118,7 @@ void VWidgetDetails::InLayoutStateChanged(int row, int column)
|
||||||
const bool inLayout = not allDetails->value(id).IsInLayout();
|
const bool inLayout = not allDetails->value(id).IsInLayout();
|
||||||
|
|
||||||
TogglePieceInLayout *togglePrint = new TogglePieceInLayout(id, inLayout, m_data, m_doc);
|
TogglePieceInLayout *togglePrint = new TogglePieceInLayout(id, inLayout, m_data, m_doc);
|
||||||
connect(togglePrint, &TogglePieceInLayout::UpdateList, this, &VWidgetDetails::UpdateList);
|
connect(togglePrint, &TogglePieceInLayout::Toggled, this, &VWidgetDetails::ToggledPiece);
|
||||||
qApp->getUndoStack()->push(togglePrint);
|
qApp->getUndoStack()->push(togglePrint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,7 +126,7 @@ void VWidgetDetails::InLayoutStateChanged(int row, int column)
|
||||||
void VWidgetDetails::FillTable(const QHash<quint32, VPiece> *details)
|
void VWidgetDetails::FillTable(const QHash<quint32, VPiece> *details)
|
||||||
{
|
{
|
||||||
const int selectedRow = ui->tableWidget->currentRow();
|
const int selectedRow = ui->tableWidget->currentRow();
|
||||||
ui->tableWidget->clear();
|
ui->tableWidget->clearContents();
|
||||||
|
|
||||||
ui->tableWidget->setColumnCount(2);
|
ui->tableWidget->setColumnCount(2);
|
||||||
ui->tableWidget->setRowCount(details->size());
|
ui->tableWidget->setRowCount(details->size());
|
||||||
|
@ -167,14 +188,13 @@ void VWidgetDetails::ToggleSectionDetails(bool select)
|
||||||
|
|
||||||
for (int i = 0; i<ui->tableWidget->rowCount(); ++i)
|
for (int i = 0; i<ui->tableWidget->rowCount(); ++i)
|
||||||
{
|
{
|
||||||
QTableWidgetItem *item = ui->tableWidget->item(i, 0);
|
const quint32 id = ui->tableWidget->item(i, 0)->data(Qt::UserRole).toUInt();
|
||||||
const quint32 id = item->data(Qt::UserRole).toUInt();
|
|
||||||
if (allDetails->contains(id))
|
if (allDetails->contains(id))
|
||||||
{
|
{
|
||||||
if (not (select == allDetails->value(id).IsInLayout()))
|
if (not (select == allDetails->value(id).IsInLayout()))
|
||||||
{
|
{
|
||||||
TogglePieceInLayout *togglePrint = new TogglePieceInLayout(id, select, m_data, m_doc);
|
TogglePieceInLayout *togglePrint = new TogglePieceInLayout(id, select, m_data, m_doc);
|
||||||
connect(togglePrint, &TogglePieceInLayout::UpdateList, this, &VWidgetDetails::UpdateList);
|
connect(togglePrint, &TogglePieceInLayout::Toggled, this, &VWidgetDetails::ToggledPiece);
|
||||||
qApp->getUndoStack()->push(togglePrint);
|
qApp->getUndoStack()->push(togglePrint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -251,7 +271,7 @@ void VWidgetDetails::ShowContextMenu(const QPoint &pos)
|
||||||
select = not allDetails->value(id).IsInLayout();
|
select = not allDetails->value(id).IsInLayout();
|
||||||
|
|
||||||
TogglePieceInLayout *togglePrint = new TogglePieceInLayout(id, select, m_data, m_doc);
|
TogglePieceInLayout *togglePrint = new TogglePieceInLayout(id, select, m_data, m_doc);
|
||||||
connect(togglePrint, &TogglePieceInLayout::UpdateList, this, &VWidgetDetails::UpdateList);
|
connect(togglePrint, &TogglePieceInLayout::Toggled, this, &VWidgetDetails::ToggledPiece);
|
||||||
qApp->getUndoStack()->push(togglePrint);
|
qApp->getUndoStack()->push(togglePrint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,6 +54,7 @@ signals:
|
||||||
public slots:
|
public slots:
|
||||||
void UpdateList();
|
void UpdateList();
|
||||||
void SelectDetail(quint32 id);
|
void SelectDetail(quint32 id);
|
||||||
|
void ToggledPiece(quint32 id);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void InLayoutStateChanged(int row, int column);
|
void InLayoutStateChanged(int row, int column);
|
||||||
|
|
|
@ -1480,7 +1480,7 @@ void VToolSeamAllowance::ShowOptions()
|
||||||
void VToolSeamAllowance::ToggleInLayout(bool checked)
|
void VToolSeamAllowance::ToggleInLayout(bool checked)
|
||||||
{
|
{
|
||||||
TogglePieceInLayout *togglePrint = new TogglePieceInLayout(m_id, checked, &(VAbstractTool::data), doc);
|
TogglePieceInLayout *togglePrint = new TogglePieceInLayout(m_id, checked, &(VAbstractTool::data), doc);
|
||||||
connect(togglePrint, &TogglePieceInLayout::UpdateList, doc, &VAbstractPattern::CheckInLayoutList);
|
connect(togglePrint, &TogglePieceInLayout::Toggled, doc, &VAbstractPattern::CheckInLayoutList);
|
||||||
qApp->getUndoStack()->push(togglePrint);
|
qApp->getUndoStack()->push(togglePrint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,7 @@ void TogglePieceInLayout::Do(bool state)
|
||||||
VPiece det = m_data->DataPieces()->value(m_id);
|
VPiece det = m_data->DataPieces()->value(m_id);
|
||||||
det.SetInLayout(state);
|
det.SetInLayout(state);
|
||||||
m_data->UpdatePiece(m_id, det);
|
m_data->UpdatePiece(m_id, det);
|
||||||
emit UpdateList();
|
emit Toggled(m_id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -47,7 +47,7 @@ public:
|
||||||
virtual void undo() override;
|
virtual void undo() override;
|
||||||
virtual void redo() override;
|
virtual void redo() override;
|
||||||
signals:
|
signals:
|
||||||
void UpdateList();
|
void Toggled(quint32 id);
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(TogglePieceInLayout)
|
Q_DISABLE_COPY(TogglePieceInLayout)
|
||||||
quint32 m_id;
|
quint32 m_id;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user