WModifyTab: Make use of push_back over operator<<

This commit is contained in:
Lioncash 2020-07-10 16:16:36 -04:00
parent b868a94182
commit 0465029055
1 changed files with 14 additions and 14 deletions

View File

@ -219,23 +219,23 @@ void WModifyTab::OnPickModeExit()
void WModifyTab::OnDeleteLinksClicked() void WModifyTab::OnDeleteLinksClicked()
{ {
if (mpSelectedNode && mpSelectedNode->NodeType() == ENodeType::Script) if (mpSelectedNode == nullptr || mpSelectedNode->NodeType() != ENodeType::Script)
{ return;
ELinkType Type = (sender() == ui->DeleteOutgoingConnectionButton ? ELinkType::Outgoing : ELinkType::Incoming);
QModelIndexList SelectedIndices = (Type == ELinkType::Outgoing ? ui->OutLinksTableView->selectionModel()->selectedRows() : ui->InLinksTableView->selectionModel()->selectedRows());
if (!SelectedIndices.isEmpty()) const ELinkType Type = (sender() == ui->DeleteOutgoingConnectionButton ? ELinkType::Outgoing : ELinkType::Incoming);
{ const QModelIndexList SelectedIndices = (Type == ELinkType::Outgoing ? ui->OutLinksTableView->selectionModel()->selectedRows() : ui->InLinksTableView->selectionModel()->selectedRows());
QVector<uint32> Indices;
for (int iIdx = 0; iIdx < SelectedIndices.size(); iIdx++) if (SelectedIndices.isEmpty())
Indices << SelectedIndices[iIdx].row(); return;
CScriptObject *pInst = static_cast<CScriptNode*>(mpSelectedNode)->Instance(); QVector<uint32> Indices;
CDeleteLinksCommand *pCmd = new CDeleteLinksCommand(mpWorldEditor, pInst, Type, Indices); Indices.reserve(SelectedIndices.size());
mpWorldEditor->UndoStack().push(pCmd); for (const auto& index : SelectedIndices)
} Indices.push_back(index.row());
}
auto *pInst = static_cast<CScriptNode*>(mpSelectedNode)->Instance();
auto *pCmd = new CDeleteLinksCommand(mpWorldEditor, pInst, Type, Indices);
mpWorldEditor->UndoStack().push(pCmd);
} }
void WModifyTab::OnEditLinkClicked() void WModifyTab::OnEditLinkClicked()