1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-07-30 20:52:26 -04:00

Merge pull request #841 from srcejon/fix_table_clear_assertion

Fix assertion when removing all elements from model
This commit is contained in:
Edouard Griffiths 2021-04-13 22:53:48 +02:00 committed by GitHub
commit cd0fc3dfd1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 36 additions and 24 deletions

View File

@ -378,7 +378,9 @@ public:
}
void removeAllAirports() {
beginRemoveRows(QModelIndex(), 0, m_airports.count());
if (m_airports.count() > 0)
{
beginRemoveRows(QModelIndex(), 0, m_airports.count() - 1);
m_airports.clear();
m_airportDataFreq.clear();
m_airportDataFreqRows.clear();
@ -387,6 +389,7 @@ public:
m_elevation.clear();
endRemoveRows();
}
}
int rowCount(const QModelIndex &parent = QModelIndex()) const override {
Q_UNUSED(parent)

View File

@ -143,13 +143,16 @@ public:
}
void removeAllVORs() {
beginRemoveRows(QModelIndex(), 0, m_vors.count());
if (m_vors.count() > 0)
{
beginRemoveRows(QModelIndex(), 0, m_vors.count() - 1);
m_vors.clear();
m_selected.clear();
m_radials.clear();
m_vorGUIs.clear();
endRemoveRows();
}
}
QHash<int, QByteArray> roleNames() const {
QHash<int, QByteArray> roles;

View File

@ -350,12 +350,15 @@ public:
}
void removeAll()
{
if (m_items.count() > 0)
{
beginRemoveRows(QModelIndex(), 0, m_items.count());
m_items.clear();
m_selected.clear();
endRemoveRows();
}
}
void setDisplayNames(bool displayNames)
{

View File

@ -144,13 +144,16 @@ public:
}
void removeAllVORs() {
beginRemoveRows(QModelIndex(), 0, m_vors.count());
if (m_vors.count() > 0)
{
beginRemoveRows(QModelIndex(), 0, m_vors.count() - 1);
m_vors.clear();
m_selected.clear();
m_radials.clear();
m_vorGUIs.clear();
endRemoveRows();
}
}
QHash<int, QByteArray> roleNames() const {
QHash<int, QByteArray> roles;