mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-18 05:00:33 +01:00
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:
@@ -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
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user