Qt: Fix clazy-incorrect-emit warnings.

QAbstractItemModel::beginResetModel and endResetModel aren't signals, so
don't emit them. dataChanged is, so do.

Fixes clazy-incorrect-emit:
https://github.com/KDE/clazy/blob/master/docs/checks/README-incorrect-emit.md
This commit is contained in:
Gerald Combs 2022-05-12 09:56:40 -07:00 committed by A Wireshark GitLab Utility
parent 909280ce82
commit 76423db8e0
10 changed files with 40 additions and 40 deletions

View File

@ -384,9 +384,9 @@ bool ColumnListModel::dropMimeData(const QMimeData *data,
if (moveTo >= store_.count())
moveTo = static_cast<int>(store_.count()) - 1;
emit beginResetModel();
beginResetModel();
store_.move(moveFrom, moveTo);
emit endResetModel();
endResetModel();
return true;
}
@ -466,7 +466,7 @@ void ColumnListModel::saveColumns()
void ColumnListModel::addEntry()
{
emit beginInsertRows(QModelIndex(), rowCount(), rowCount());
beginInsertRows(QModelIndex(), rowCount(), rowCount());
ListElement elem;
elem.nr = rowCount();
elem.title = tr("New Column");
@ -475,19 +475,19 @@ void ColumnListModel::addEntry()
elem.occurrence = 0;
elem.customFields = QString();
store_ << elem;
emit endInsertRows();
endInsertRows();
}
void ColumnListModel::deleteEntry(int row)
{
emit beginRemoveRows(QModelIndex(), row, row);
beginRemoveRows(QModelIndex(), row, row);
store_.removeAt(row);
emit endRemoveRows();
endRemoveRows();
}
void ColumnListModel::reset()
{
emit beginResetModel();
beginResetModel();
populate();
emit endResetModel();
endResetModel();
}

View File

@ -588,12 +588,12 @@ QString DecodeAsModel::entryString(const gchar *table_name, gconstpointer value)
void DecodeAsModel::fillTable()
{
decode_as_items_.clear();
emit beginResetModel();
beginResetModel();
dissector_all_tables_foreach_changed(buildChangedList, this);
decode_dcerpc_add_show_list(buildDceRpcChangedList, this);
emit endResetModel();
endResetModel();
}
void DecodeAsModel::setDissectorHandle(const QModelIndex &index, dissector_handle_t dissector_handle)

View File

@ -295,7 +295,7 @@ static void gatherHeurTableNames(const char *table_name, heur_dissector_list *li
void DissectorTablesModel::populate()
{
emit beginResetModel();
beginResetModel();
struct tables_root tables;
@ -313,7 +313,7 @@ void DissectorTablesModel::populate()
dissector_all_heur_tables_foreach_table(gatherHeurTableNames, heuristic_table, NULL);
emit endResetModel();
endResetModel();
}

View File

@ -289,7 +289,7 @@ void EnabledProtocolsModel::populate()
void *cookie;
protocol_t *protocol;
emit beginResetModel();
beginResetModel();
// Iterate over all the protocols
for (int i = proto_get_first_protocol(&cookie); i != -1; i = proto_get_next_protocol(&cookie))
@ -304,7 +304,7 @@ void EnabledProtocolsModel::populate()
}
}
emit endResetModel();
endResetModel();
}
void EnabledProtocolsModel::applyChanges(bool writeChanges)
@ -482,7 +482,7 @@ void EnabledProtocolsProxyModel::setItemsEnable(EnabledProtocolsProxyModel::Enab
return;
if (! parent.isValid())
emit beginResetModel();
beginResetModel();
for (int row = 0; row < rowCount(parent); row++)
{
@ -511,5 +511,5 @@ void EnabledProtocolsProxyModel::setItemsEnable(EnabledProtocolsProxyModel::Enab
if (! parent.isValid())
emit endResetModel();
endResetModel();
}

View File

@ -105,13 +105,13 @@ ExpertInfoModel::~ExpertInfoModel()
void ExpertInfoModel::clear()
{
emit beginResetModel();
beginResetModel();
eventCounts_.clear();
delete root_;
root_ = createRootItem();
emit endResetModel();
endResetModel();
}
ExpertPacketItem* ExpertInfoModel::createRootItem()
@ -305,9 +305,9 @@ QVariant ExpertInfoModel::data(const QModelIndex &index, int role) const
//GUI helpers
void ExpertInfoModel::setGroupBySummary(bool group_by_summary)
{
emit beginResetModel();
beginResetModel();
group_by_summary_ = group_by_summary;
emit endResetModel();
endResetModel();
}
int ExpertInfoModel::rowCount(const QModelIndex &parent) const
@ -420,6 +420,6 @@ void ExpertInfoModel::tapDraw(void *eid_ptr)
if (!model)
return;
emit model->beginResetModel();
emit model->endResetModel();
model->beginResetModel();
model->endResetModel();
}

View File

@ -200,9 +200,9 @@ void ExportObjectModel::resetObjects()
{
export_object_gui_reset_cb reset_cb = get_eo_reset_func(eo_);
emit beginResetModel();
beginResetModel();
objects_.clear();
emit endResetModel();
endResetModel();
if (reset_cb)
reset_cb();

View File

@ -356,12 +356,12 @@ bool InterfaceTreeModel::isRemote(int idx)
*/
void InterfaceTreeModel::interfaceListChanged()
{
emit beginResetModel();
beginResetModel();
points.clear();
active.clear();
emit endResetModel();
endResetModel();
}
/*
@ -464,9 +464,9 @@ void InterfaceTreeModel::updateStatistic(unsigned int idx)
if (active[device->name] != isActive)
{
emit beginResetModel();
beginResetModel();
active[device->name] = isActive;
emit endResetModel();
endResetModel();
}
emit dataChanged(index(idx, IFTREE_COL_STATS), index(idx, IFTREE_COL_STATS));

View File

@ -162,13 +162,13 @@ guint PacketListModel::recreateVisibleRows()
}
void PacketListModel::clear() {
emit beginResetModel();
beginResetModel();
qDeleteAll(physical_rows_);
physical_rows_.resize(0);
visible_rows_.resize(0);
new_visible_rows_.resize(0);
number_to_row_.resize(0);
emit endResetModel();
endResetModel();
max_row_height_ = 0;
max_line_count_ = 1;
idle_dissection_row_ = 0;
@ -177,7 +177,7 @@ void PacketListModel::clear() {
void PacketListModel::invalidateAllColumnStrings()
{
PacketListRecord::invalidateAllRecords();
dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1),
emit dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1),
QVector<int>() << Qt::DisplayRole);
}
@ -194,7 +194,7 @@ void PacketListModel::resetColumns()
void PacketListModel::resetColorized()
{
PacketListRecord::resetColorization();
dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1),
emit dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1),
QVector<int>() << Qt::BackgroundRole << Qt::ForegroundRole);
}
@ -222,7 +222,7 @@ void PacketListModel::toggleFrameMark(const QModelIndexList &indeces)
else
cf_mark_frame(cap_file_, fdata);
dataChanged(index.sibling(index.row(), 0), index.sibling(index.row(), sectionMax),
emit dataChanged(index.sibling(index.row(), 0), index.sibling(index.row(), sectionMax),
QVector<int>() << Qt::BackgroundRole << Qt::ForegroundRole);
}
}
@ -264,7 +264,7 @@ void PacketListModel::toggleFrameIgnore(const QModelIndexList &indeces)
else
cf_ignore_frame(cap_file_, fdata);
dataChanged(index.sibling(index.row(), 0), index.sibling(index.row(), sectionMax),
emit dataChanged(index.sibling(index.row(), 0), index.sibling(index.row(), sectionMax),
QVector<int>() << Qt::BackgroundRole << Qt::ForegroundRole << Qt::DisplayRole);
}
}
@ -365,7 +365,7 @@ void PacketListModel::sort(int column, Qt::SortOrder order)
sort_column_is_numeric_ = isNumericColumn(sort_column_);
std::sort(physical_rows_.begin(), physical_rows_.end(), recordLessThan);
emit beginResetModel();
beginResetModel();
visible_rows_.resize(0);
number_to_row_.fill(0);
foreach (PacketListRecord *record, physical_rows_) {
@ -379,7 +379,7 @@ void PacketListModel::sort(int column, Qt::SortOrder order)
number_to_row_[fdata->num] = static_cast<int>(visible_rows_.count());
}
}
emit endResetModel();
endResetModel();
if (!col_title.isEmpty()) {
mainApp->popStatus(MainApplication::BusyStatus);

View File

@ -142,7 +142,7 @@ ProfileModel::ProfileModel(QObject * parent) :
void ProfileModel::loadProfiles()
{
emit beginResetModel();
beginResetModel();
bool refresh = profiles_.count() > 0;
@ -158,7 +158,7 @@ void ProfileModel::loadProfiles()
fl_entry = gxx_list_next(fl_entry);
}
emit endResetModel();
endResetModel();
}
GList * ProfileModel::entry(profile_def *ref) const

View File

@ -159,7 +159,7 @@ void SupportedProtocolsModel::populate()
void *proto_cookie;
void *field_cookie;
emit beginResetModel();
beginResetModel();
SupportedProtocolsItem *protoItem, *fieldItem;
protocol_t *protocol;
@ -182,7 +182,7 @@ void SupportedProtocolsModel::populate()
}
}
emit endResetModel();
endResetModel();
}