Fixed crash in PortStatsFilterDialog while removing selected rows
This commit is contained in:
parent
35f4a8bafb
commit
7b9c1f92a0
@ -80,52 +80,48 @@ QList<uint> PortStatsFilterDialog::getItemList(bool* ok,
|
|||||||
|
|
||||||
void PortStatsFilterDialog::on_tbSelectIn_clicked()
|
void PortStatsFilterDialog::on_tbSelectIn_clicked()
|
||||||
{
|
{
|
||||||
QStandardItem *item;
|
QList<int> rows;
|
||||||
while (lvUnselected->selectionModel()->selectedIndexes().size())
|
|
||||||
|
foreach(QModelIndex idx, lvUnselected->selectionModel()->selectedIndexes())
|
||||||
|
rows.append(idx.row());
|
||||||
|
qSort(rows.begin(), rows.end(), qGreater<int>());
|
||||||
|
|
||||||
|
int count = mSelected.rowCount();
|
||||||
|
|
||||||
|
foreach(int row, rows)
|
||||||
{
|
{
|
||||||
item = mUnselected.takeItem(lvUnselected->selectionModel()->
|
QList<QStandardItem*> items = mUnselected.takeRow(row);
|
||||||
selectedIndexes().at(0).row());
|
mSelected.insertRow(count, items);
|
||||||
if (mUnselected.removeRow(lvUnselected->selectionModel()->
|
|
||||||
selectedIndexes().at(0).row()))
|
|
||||||
mSelected.appendRow(item);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PortStatsFilterDialog::on_tbSelectOut_clicked()
|
void PortStatsFilterDialog::on_tbSelectOut_clicked()
|
||||||
{
|
{
|
||||||
QStandardItem *item;
|
QList<int> rows;
|
||||||
|
|
||||||
while (lvSelected->selectionModel()->selectedIndexes().size())
|
foreach(QModelIndex idx, lvSelected->selectionModel()->selectedIndexes())
|
||||||
|
rows.append(idx.row());
|
||||||
|
qSort(rows.begin(), rows.end(), qGreater<int>());
|
||||||
|
|
||||||
|
foreach(int row, rows)
|
||||||
{
|
{
|
||||||
item = mSelected.takeItem(lvSelected->selectionModel()->
|
QList<QStandardItem*> items = mSelected.takeRow(row);
|
||||||
selectedIndexes().at(0).row());
|
mUnselected.appendRow(items);
|
||||||
if (mSelected.removeRow(lvSelected->selectionModel()->
|
|
||||||
selectedIndexes().at(0).row()))
|
|
||||||
{
|
|
||||||
mUnselected.appendRow(item);
|
|
||||||
mUnselected.sort(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mUnselected.sort(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PortStatsFilterDialog::on_lvUnselected_doubleClicked(const QModelIndex &index)
|
void PortStatsFilterDialog::on_lvUnselected_doubleClicked(const QModelIndex &index)
|
||||||
{
|
{
|
||||||
QStandardItem *item;
|
QList<QStandardItem*> items = mUnselected.takeRow(index.row());
|
||||||
|
mSelected.appendRow(items);
|
||||||
item = mUnselected.takeItem(index.row());
|
|
||||||
if (mUnselected.removeRow(index.row()))
|
|
||||||
mSelected.appendRow(item);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PortStatsFilterDialog::on_lvSelected_doubleClicked(const QModelIndex &index)
|
void PortStatsFilterDialog::on_lvSelected_doubleClicked(const QModelIndex &index)
|
||||||
{
|
{
|
||||||
QStandardItem *item;
|
QList<QStandardItem*> items = mSelected.takeRow(index.row());
|
||||||
|
mUnselected.appendRow(items);
|
||||||
item = mSelected.takeItem(index.row());
|
mUnselected.sort(0);
|
||||||
if (mSelected.removeRow(index.row()))
|
|
||||||
{
|
|
||||||
mUnselected.appendRow(item);
|
|
||||||
mUnselected.sort(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user