Several real terminal can be added to terminal strip in one shot

User can select several real terminals in the free terminal editor
and add it with one operation on a terminal strip.
This commit is contained in:
joshua
2022-04-08 20:48:32 +02:00
parent a38d97896d
commit 6197d0215a
7 changed files with 192 additions and 70 deletions

View File

@@ -275,6 +275,30 @@ modelRealTerminalData FreeTerminalModel::dataAtRow(int row) const
}
}
/**
* @brief FreeTerminalModel::realTerminalForIndex
* @param index_list
* @return The QSharedPointer<RealTerminal> associated with the index found in @a index_list
*/
QVector<QSharedPointer<RealTerminal> > FreeTerminalModel::realTerminalForIndex(const QModelIndexList &index_list) const
{
QVector<QSharedPointer<RealTerminal>> vector_;
for (const auto &index : index_list)
{
if (index.isValid()
&& index.model() == this
&& index.row() < m_terminal_vector.size())
{
const auto rt_ = m_terminal_vector.at(index.row());
if (!vector_.contains(rt_)) {
vector_.append(m_terminal_vector.at(index.row()));
}
}
}
return vector_;
}
/**
* @brief FreeTerminalModel::fillTerminalVector
*/