aboutsummaryrefslogtreecommitdiffstats
path: root/ui/qt
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2022-03-21 15:13:57 -0700
committerGerald Combs <gerald@wireshark.org>2022-03-25 16:51:55 +0000
commitf8d3ebe0e2f3fa8fb28dd130ea9bb62c4250d53c (patch)
treedeb6f8255aed2a831dcf2c35f2255ac22e89b315 /ui/qt
parentbdccea7692103095e5d5eb04a999d3413ef9e7c4 (diff)
Qt: Handle qsizetype.
Qt 5.10 added qsizetype, aka an ssize_t and Qt 6 makes extensive use of it. Add a compatibility typedef and use it where we can. Cast it away where we can't.
Diffstat (limited to 'ui/qt')
-rw-r--r--ui/qt/about_dialog.cpp2
-rw-r--r--ui/qt/bluetooth_device_dialog.cpp3
-rw-r--r--ui/qt/bluetooth_devices_dialog.cpp2
-rw-r--r--ui/qt/capture_file_dialog.cpp2
-rw-r--r--ui/qt/coloring_rules_dialog.cpp8
-rw-r--r--ui/qt/extcap_options_dialog.cpp5
-rw-r--r--ui/qt/filter_dialog.cpp2
-rw-r--r--ui/qt/follow_stream_dialog.cpp2
-rw-r--r--ui/qt/funnel_text_dialog.cpp4
-rw-r--r--ui/qt/iax2_analysis_dialog.cpp2
-rw-r--r--ui/qt/import_text_dialog.cpp2
-rw-r--r--ui/qt/interface_frame.cpp2
-rw-r--r--ui/qt/main_window.cpp4
-rw-r--r--ui/qt/main_window_slots.cpp6
-rw-r--r--ui/qt/models/export_objects_model.cpp4
-rw-r--r--ui/qt/models/fileset_entry_model.h2
-rw-r--r--ui/qt/models/packet_list_model.cpp26
-rw-r--r--ui/qt/profile_dialog.cpp2
-rw-r--r--ui/qt/rpc_service_response_time_dialog.cpp2
-rw-r--r--ui/qt/rtp_analysis_dialog.cpp4
-rw-r--r--ui/qt/service_response_time_dialog.cpp2
-rw-r--r--ui/qt/show_packet_bytes_dialog.cpp10
-rw-r--r--ui/qt/stats_tree_dialog.cpp2
-rw-r--r--ui/qt/tap_parameter_dialog.cpp6
-rw-r--r--ui/qt/utils/qt_ui_utils.h7
-rw-r--r--ui/qt/widgets/byte_view_text.cpp6
-rw-r--r--ui/qt/widgets/display_filter_edit.cpp2
-rw-r--r--ui/qt/widgets/field_filter_edit.cpp2
-rw-r--r--ui/qt/widgets/profile_tree_view.cpp6
-rw-r--r--ui/qt/widgets/qcustomplot.h10
30 files changed, 68 insertions, 71 deletions
diff --git a/ui/qt/about_dialog.cpp b/ui/qt/about_dialog.cpp
index 002e4d4ba0..007f3cb18d 100644
--- a/ui/qt/about_dialog.cpp
+++ b/ui/qt/about_dialog.cpp
@@ -534,7 +534,7 @@ void AboutDialog::handleCopyMenu(QPoint pos)
connect(copyColumnAction, SIGNAL(triggered()), this, SLOT(copyActionTriggered()));
QModelIndexList selectedRows = tree->selectionModel()->selectedRows();
- QAction * copyRowAction = menu->addAction(tr("Copy Row(s)", "", selectedRows.count()));
+ QAction * copyRowAction = menu->addAction(tr("Copy Row(s)", "", static_cast<int>(selectedRows.count())));
copyRowAction->setData(VariantPointer<QTreeView>::asQVariant(tree));
connect(copyRowAction, SIGNAL(triggered()), this, SLOT(copyRowActionTriggered()));
diff --git a/ui/qt/bluetooth_device_dialog.cpp b/ui/qt/bluetooth_device_dialog.cpp
index cddedfd748..147b97ea73 100644
--- a/ui/qt/bluetooth_device_dialog.cpp
+++ b/ui/qt/bluetooth_device_dialog.cpp
@@ -379,7 +379,6 @@ tap_packet_status BluetoothDeviceDialog::tapPacket(void *tapinfo_ptr, packet_inf
bluetooth_device_tap_t *tap_device = static_cast<bluetooth_device_tap_t *>(const_cast<void *>(data));
QString bd_addr;
QString bd_addr_oui;
- QString name;
const gchar *manuf;
QTableWidget *tableWidget;
QTableWidgetItem *item;
@@ -404,7 +403,7 @@ tap_packet_status BluetoothDeviceDialog::tapPacket(void *tapinfo_ptr, packet_inf
int pos;
bd_addr_oui = QString(manuf);
- pos = bd_addr_oui.indexOf('_');
+ pos = static_cast<int>(bd_addr_oui.indexOf('_'));
if (pos < 0) {
manuf = NULL;
} else {
diff --git a/ui/qt/bluetooth_devices_dialog.cpp b/ui/qt/bluetooth_devices_dialog.cpp
index ee3f65d20a..b0fe53e5fe 100644
--- a/ui/qt/bluetooth_devices_dialog.cpp
+++ b/ui/qt/bluetooth_devices_dialog.cpp
@@ -295,7 +295,7 @@ tap_packet_status BluetoothDevicesDialog::tapPacket(void *tapinfo_ptr, packet_in
int pos;
bd_addr_oui = QString(manuf);
- pos = bd_addr_oui.indexOf('_');
+ pos = static_cast<int>(bd_addr_oui.indexOf('_'));
if (pos < 0) {
manuf = NULL;
} else {
diff --git a/ui/qt/capture_file_dialog.cpp b/ui/qt/capture_file_dialog.cpp
index c1ccf61d44..304b64be99 100644
--- a/ui/qt/capture_file_dialog.cpp
+++ b/ui/qt/capture_file_dialog.cpp
@@ -516,7 +516,7 @@ void CaptureFileDialog::fixFilenameExtension()
// Find suffixes such as "pcap" or "pcap.gz" if any
if (!fi.suffix().isEmpty()) {
QStringList current_suffixes(fi.suffix());
- int pos = filename.lastIndexOf('.', -2 - current_suffixes.at(0).size());
+ int pos = static_cast<int>(filename.lastIndexOf('.', -2 - current_suffixes.at(0).size()));
if (pos > 0) {
current_suffixes.prepend(filename.right(filename.size() - (pos + 1)));
}
diff --git a/ui/qt/coloring_rules_dialog.cpp b/ui/qt/coloring_rules_dialog.cpp
index a36193a723..9a7c92d325 100644
--- a/ui/qt/coloring_rules_dialog.cpp
+++ b/ui/qt/coloring_rules_dialog.cpp
@@ -316,7 +316,7 @@ void ColoringRulesDialog::colorRuleSelectionChanged(const QItemSelection&, const
selectedRows.insert(index.row(), index);
}
- int num_selected = selectedRows.count();
+ qsizetype num_selected = selectedRows.count();
if (num_selected == 1) {
setColorButtons(selectedList[0]);
}
@@ -400,7 +400,7 @@ void ColoringRulesDialog::on_newToolButton_clicked()
void ColoringRulesDialog::on_deleteToolButton_clicked()
{
QModelIndexList selectedList = ui->coloringRulesTreeView->selectionModel()->selectedIndexes();
- int num_selected = selectedList.count()/colorRuleModel_.columnCount();
+ qsizetype num_selected = selectedList.count() / colorRuleModel_.columnCount();
if (num_selected > 0) {
//list is not guaranteed to be sorted, so force it
std::sort(selectedList.begin(), selectedList.end());
@@ -408,7 +408,7 @@ void ColoringRulesDialog::on_deleteToolButton_clicked()
//walk the list from the back because deleting a value in
//the middle will leave the selectedList out of sync and
//delete the wrong elements
- for (int i = selectedList.count()-1; i >= 0; i--) {
+ for (int i = static_cast<int>(selectedList.count()) - 1; i >= 0; i--) {
QModelIndex deleteIndex = selectedList[i];
//selectedList includes all cells, use first column as key to remove row
if (deleteIndex.isValid() && (deleteIndex.column() == 0)) {
@@ -443,7 +443,7 @@ void ColoringRulesDialog::on_buttonBox_clicked(QAbstractButton *button)
checkUnknownColorfilters();
}
} else if (button == export_button_) {
- int num_items = ui->coloringRulesTreeView->selectionModel()->selectedIndexes().count()/colorRuleModel_.columnCount();
+ int num_items = static_cast<int>(ui->coloringRulesTreeView->selectionModel()->selectedIndexes().count()) / colorRuleModel_.columnCount();
if (num_items < 1) {
num_items = colorRuleModel_.rowCount();
diff --git a/ui/qt/extcap_options_dialog.cpp b/ui/qt/extcap_options_dialog.cpp
index 1a963d6ed4..aa00e40e9d 100644
--- a/ui/qt/extcap_options_dialog.cpp
+++ b/ui/qt/extcap_options_dialog.cpp
@@ -271,7 +271,7 @@ void ExtcapOptionsDialog::updateWidgets()
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
return;
}
- ui->checkSaveOnStart->setText(tr("Save parameter(s) on capture start", "", extcapArguments.count()));
+ ui->checkSaveOnStart->setText(tr("Save parameter(s) on capture start", "", static_cast<int>(extcapArguments.count())));
QStringList groupKeys;
QString defaultKeyName(tr("Default"));
@@ -479,9 +479,6 @@ void ExtcapOptionsDialog::on_buttonBox_clicked(QAbstractButton *button)
void ExtcapOptionsDialog::resetValues()
{
- ExtcapArgumentList::const_iterator iter;
- QString value;
-
int count = ui->verticalLayout->count();
if (count > 0)
{
diff --git a/ui/qt/filter_dialog.cpp b/ui/qt/filter_dialog.cpp
index 09f49b360f..eff1eae1b7 100644
--- a/ui/qt/filter_dialog.cpp
+++ b/ui/qt/filter_dialog.cpp
@@ -116,7 +116,7 @@ void FilterDialog::updateWidgets()
if (! ui->filterTreeView->selectionModel())
return;
- int num_selected = ui->filterTreeView->selectionModel()->selectedRows().count();
+ qsizetype num_selected = ui->filterTreeView->selectionModel()->selectedRows().count();
ui->copyToolButton->setEnabled(num_selected == 1);
ui->deleteToolButton->setEnabled(num_selected > 0);
diff --git a/ui/qt/follow_stream_dialog.cpp b/ui/qt/follow_stream_dialog.cpp
index 907138430d..1f3bcc759f 100644
--- a/ui/qt/follow_stream_dialog.cpp
+++ b/ui/qt/follow_stream_dialog.cpp
@@ -327,7 +327,7 @@ void FollowStreamDialog::saveAs()
}
QDataStream out(&file);
- out.writeRawData(bytes.constData(), bytes.size());
+ out.writeRawData(bytes.constData(), static_cast<int>(bytes.size()));
}
void FollowStreamDialog::helpButton()
diff --git a/ui/qt/funnel_text_dialog.cpp b/ui/qt/funnel_text_dialog.cpp
index 5a8c3f38e4..527d5a5513 100644
--- a/ui/qt/funnel_text_dialog.cpp
+++ b/ui/qt/funnel_text_dialog.cpp
@@ -160,8 +160,8 @@ void FunnelTextDialog::on_findLineEdit_textChanged(const QString &pattern)
QRegularExpressionMatchIterator iter = re.globalMatch(ui->textEdit->toPlainText());
while (iter.hasNext()) {
QRegularExpressionMatch match = iter.next();
- csr.setPosition(match.capturedStart(), QTextCursor::MoveAnchor);
- csr.setPosition(match.capturedEnd(), QTextCursor::KeepAnchor);
+ csr.setPosition(static_cast<int>(match.capturedStart()), QTextCursor::MoveAnchor);
+ csr.setPosition(static_cast<int>(match.capturedEnd()), QTextCursor::KeepAnchor);
csr.setCharFormat(highlight_fmt);
}
}
diff --git a/ui/qt/iax2_analysis_dialog.cpp b/ui/qt/iax2_analysis_dialog.cpp
index 59c4b311fe..5622a71a26 100644
--- a/ui/qt/iax2_analysis_dialog.cpp
+++ b/ui/qt/iax2_analysis_dialog.cpp
@@ -1107,7 +1107,7 @@ void Iax2AnalysisDialog::saveAudio(Iax2AnalysisDialog::StreamDirection direction
}
}
- int chunk_size = 65536;
+ qsizetype chunk_size = 65536;
/* XXX how do you just copy the file? */
while (chunk_size > 0) {
if (stop_flag)
diff --git a/ui/qt/import_text_dialog.cpp b/ui/qt/import_text_dialog.cpp
index dff793e2c9..428ce66aa3 100644
--- a/ui/qt/import_text_dialog.cpp
+++ b/ui/qt/import_text_dialog.cpp
@@ -642,7 +642,7 @@ bool ImportTextDialog::checkDateTimeFormat(const QString &time_format)
* probably better */
if (time_format == "ISO") {
ret = true;
- } else while ((idx = time_format.indexOf("%", idx)) != -1) {
+ } else while ((idx = static_cast<int>(time_format.indexOf("%", idx))) != -1) {
idx++;
if ((idx == time_format.size()) || !valid_code.contains(time_format[idx])) {
return false;
diff --git a/ui/qt/interface_frame.cpp b/ui/qt/interface_frame.cpp
index 64cab4dacb..c0bb5055cc 100644
--- a/ui/qt/interface_frame.cpp
+++ b/ui/qt/interface_frame.cpp
@@ -97,7 +97,7 @@ InterfaceFrame::InterfaceFrame(QWidget * parent)
proxy_model_.setSourceModel(&source_model_);
info_model_.setSourceModel(&proxy_model_);
- info_model_.setColumn(columns.indexOf(IFTREE_COL_STATS));
+ info_model_.setColumn(static_cast<int>(columns.indexOf(IFTREE_COL_STATS)));
ui->interfaceTree->setModel(&info_model_);
diff --git a/ui/qt/main_window.cpp b/ui/qt/main_window.cpp
index 88c7799eca..82c197c2a2 100644
--- a/ui/qt/main_window.cpp
+++ b/ui/qt/main_window.cpp
@@ -1077,7 +1077,7 @@ void MainWindow::dropEvent(QDropEvent *event)
}
/* merge the files in chronological order */
- if (cf_merge_files_to_tempfile(this, global_capture_opts.temp_dir, &tmpname, local_files.size(),
+ if (cf_merge_files_to_tempfile(this, global_capture_opts.temp_dir, &tmpname, static_cast<int>(local_files.size()),
in_filenames,
wtap_pcapng_file_type_subtype(),
FALSE) == CF_OK) {
@@ -2136,7 +2136,7 @@ void MainWindow::initMainToolbarIcons()
main_ui_->actionViewColorizePacketList->setIcon(StockIcon("x-colorize-packets"));
QList<QKeySequence> zi_seq = main_ui_->actionViewZoomIn->shortcuts();
- zi_seq << QKeySequence(Qt::CTRL + Qt::Key_Equal);
+ zi_seq << QKeySequence(Qt::CTRL | Qt::Key_Equal);
main_ui_->actionViewZoomIn->setIcon(StockIcon("zoom-in"));
main_ui_->actionViewZoomIn->setShortcuts(zi_seq);
main_ui_->actionViewZoomOut->setIcon(StockIcon("zoom-out"));
diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp
index 42ad07f8de..8c211ab9ea 100644
--- a/ui/qt/main_window_slots.cpp
+++ b/ui/qt/main_window_slots.cpp
@@ -1214,7 +1214,7 @@ void MainWindow::setEditCommentsMenu()
}
if (selectedRows().count() > 1) {
main_ui_->menuPacketComment->addSeparator();
- main_ui_->menuPacketComment->addAction(tr("Delete comments from %n packet(s)", nullptr, selectedRows().count()), this, SLOT(actionDeleteCommentsFromPackets()));
+ main_ui_->menuPacketComment->addAction(tr("Delete comments from %n packet(s)", nullptr, static_cast<int>(selectedRows().count())), this, SLOT(actionDeleteCommentsFromPackets()));
}
}
@@ -1306,8 +1306,8 @@ void MainWindow::setMenusForSelectedPacket()
}
}
- main_ui_->actionEditMarkPacket->setText(tr("&Mark/Unmark Packet(s)", "", selectedRows().count()));
- main_ui_->actionEditIgnorePacket->setText(tr("&Ignore/Unignore Packet(s)", "", selectedRows().count()));
+ main_ui_->actionEditMarkPacket->setText(tr("&Mark/Unmark Packet(s)", "", static_cast<int>(selectedRows().count())));
+ main_ui_->actionEditIgnorePacket->setText(tr("&Ignore/Unignore Packet(s)", "", static_cast<int>(selectedRows().count())));
main_ui_->actionCopyListAsText->setEnabled(selectedRows().count() > 0);
main_ui_->actionCopyListAsCSV->setEnabled(selectedRows().count() > 0);
diff --git a/ui/qt/models/export_objects_model.cpp b/ui/qt/models/export_objects_model.cpp
index ed42725b59..c5d4c2a3c6 100644
--- a/ui/qt/models/export_objects_model.cpp
+++ b/ui/qt/models/export_objects_model.cpp
@@ -115,7 +115,7 @@ int ExportObjectModel::rowCount(const QModelIndex &parent) const
return 0;
}
- return objects_.count();
+ return static_cast<int>(objects_.count());
}
int ExportObjectModel::columnCount(const QModelIndex&) const
@@ -128,7 +128,7 @@ void ExportObjectModel::addObjectEntry(export_object_entry_t *entry)
if (entry == NULL)
return;
- int count = objects_.count();
+ int count = static_cast<int>(objects_.count());
beginInsertRows(QModelIndex(), count, count);
objects_.append(VariantPointer<export_object_entry_t>::asQVariant(entry));
endInsertRows();
diff --git a/ui/qt/models/fileset_entry_model.h b/ui/qt/models/fileset_entry_model.h
index 55655e5368..aa812b0cf7 100644
--- a/ui/qt/models/fileset_entry_model.h
+++ b/ui/qt/models/fileset_entry_model.h
@@ -37,7 +37,7 @@ public:
virtual void appendEntry(const fileset_entry *entry);
const fileset_entry *getRowEntry(int row) const { return entries_.value(row, NULL); }
- int entryCount() const { return entries_.count(); }
+ int entryCount() const { return static_cast<int>(entries_.count()); }
// Calls fileset_delete and clears our model data.
void clear();
diff --git a/ui/qt/models/packet_list_model.cpp b/ui/qt/models/packet_list_model.cpp
index 7d16070248..bac314c809 100644
--- a/ui/qt/models/packet_list_model.cpp
+++ b/ui/qt/models/packet_list_model.cpp
@@ -147,18 +147,18 @@ guint PacketListModel::recreateVisibleRows()
if (fdata->passed_dfilter || fdata->ref_time) {
visible_rows_ << record;
- if (number_to_row_.size() <= (int)fdata->num) {
+ if (static_cast<guint32>(number_to_row_.size()) <= fdata->num) {
number_to_row_.resize(fdata->num + 10000);
}
- number_to_row_[fdata->num] = visible_rows_.count();
+ number_to_row_[fdata->num] = static_cast<int>(visible_rows_.count());
}
}
if (!visible_rows_.isEmpty()) {
- beginInsertRows(QModelIndex(), 0, visible_rows_.count() - 1);
+ beginInsertRows(QModelIndex(), 0, static_cast<int>(visible_rows_.count()) - 1);
endInsertRows();
}
idle_dissection_row_ = 0;
- return visible_rows_.count();
+ return static_cast<guint>(visible_rows_.count());
}
void PacketListModel::clear() {
@@ -376,7 +376,7 @@ void PacketListModel::sort(int column, Qt::SortOrder order)
if (number_to_row_.size() <= (int)fdata->num) {
number_to_row_.resize(fdata->num + 10000);
}
- number_to_row_[fdata->num] = visible_rows_.count();
+ number_to_row_[fdata->num] = static_cast<int>(visible_rows_.count());
}
}
emit endResetModel();
@@ -543,7 +543,7 @@ void PacketListModel::emitItemHeightChanged(const QModelIndex &ih_index)
int PacketListModel::rowCount(const QModelIndex &) const
{
- return visible_rows_.count();
+ return static_cast<int>(visible_rows_.count());
}
int PacketListModel::columnCount(const QModelIndex &) const
@@ -658,20 +658,20 @@ QVariant PacketListModel::headerData(int section, Qt::Orientation orientation,
void PacketListModel::flushVisibleRows()
{
- gint pos = visible_rows_.count();
+ int pos = static_cast<int>(visible_rows_.count());
if (new_visible_rows_.count() > 0) {
- emit beginInsertRows(QModelIndex(), pos, pos + new_visible_rows_.count());
+ beginInsertRows(QModelIndex(), pos, pos + static_cast<int>(new_visible_rows_.count()));
foreach (PacketListRecord *record, new_visible_rows_) {
frame_data *fdata = record->frameData();
visible_rows_ << record;
- if (number_to_row_.size() <= (int)fdata->num) {
+ if (static_cast<unsigned int>(number_to_row_.size()) <= fdata->num) {
number_to_row_.resize(fdata->num + 10000);
}
- number_to_row_[fdata->num] = visible_rows_.count();
+ number_to_row_[fdata->num] = static_cast<int>(visible_rows_.count());
}
- emit endInsertRows();
+ endInsertRows();
new_visible_rows_.resize(0);
}
}
@@ -713,7 +713,7 @@ void PacketListModel::dissectIdle(bool reset)
gint PacketListModel::appendPacket(frame_data *fdata)
{
PacketListRecord *record = new PacketListRecord(fdata);
- gint pos = -1;
+ qsizetype pos = -1;
#ifdef DEBUG_PACKET_LIST_MODEL
if (fdata->num % 10000 == 1) {
@@ -733,7 +733,7 @@ gint PacketListModel::appendPacket(frame_data *fdata)
pos = visible_rows_.count() + new_visible_rows_.count() - 1;
}
- return pos;
+ return static_cast<gint>(pos);
}
frame_data *PacketListModel::getRowFdata(QModelIndex idx)
diff --git a/ui/qt/profile_dialog.cpp b/ui/qt/profile_dialog.cpp
index 7d4a60cd84..e33e73ddc0 100644
--- a/ui/qt/profile_dialog.cpp
+++ b/ui/qt/profile_dialog.cpp
@@ -615,7 +615,7 @@ void ProfileDialog::exportProfiles(bool exportAllPersonalProfiles)
QString err;
if (model_->exportProfiles(zipFile, items, &err))
{
- QString msg = tr("%Ln profile(s) exported", "", items.count());
+ QString msg = tr("%Ln profile(s) exported", "", static_cast<int>(items.count()));
if (skipped > 0)
msg.append(tr(", %Ln profile(s) skipped", "", skipped));
QMessageBox::information(this, tr("Exporting profiles"), msg);
diff --git a/ui/qt/rpc_service_response_time_dialog.cpp b/ui/qt/rpc_service_response_time_dialog.cpp
index 4c27f6b3eb..29e5ab31fc 100644
--- a/ui/qt/rpc_service_response_time_dialog.cpp
+++ b/ui/qt/rpc_service_response_time_dialog.cpp
@@ -366,7 +366,7 @@ void RpcServiceResponseTimeDialog::fillVersionCombo()
}
if (versions_.count() > 0) {
// Select the highest-numbered version.
- version_combo_->setCurrentIndex(versions_.count() - 1);
+ version_combo_->setCurrentIndex(static_cast<int>(versions_.count()) - 1);
}
}
diff --git a/ui/qt/rtp_analysis_dialog.cpp b/ui/qt/rtp_analysis_dialog.cpp
index 937b7037d0..71be3ee297 100644
--- a/ui/qt/rtp_analysis_dialog.cpp
+++ b/ui/qt/rtp_analysis_dialog.cpp
@@ -1028,7 +1028,7 @@ void RtpAnalysisDialog::replaceRtpStreams(QVector<rtpstream_id_t *> stream_ids)
std::lock_guard<std::mutex> lock(mutex_);
// Delete existing tabs (from last to first)
if (tabs_.count() > 0) {
- for(int i=tabs_.count(); i>0; i--) {
+ for(int i = static_cast<int>(tabs_.count()); i>0; i--) {
closeTab(i-1);
}
}
@@ -1095,7 +1095,7 @@ void RtpAnalysisDialog::removeRtpStreams(QVector<rtpstream_id_t *> stream_ids)
for (int i = 0; i < tabs.size(); i++) {
tab_info_t *tab = tabs.at(i);
if (rtpstream_id_equal(&tab->stream.id, id, RTPSTREAM_ID_EQUAL_SSRC)) {
- closeTab(tabs_.indexOf(tab));
+ closeTab(static_cast<int>(tabs_.indexOf(tab)));
}
}
}
diff --git a/ui/qt/service_response_time_dialog.cpp b/ui/qt/service_response_time_dialog.cpp
index c332c52867..17435699dd 100644
--- a/ui/qt/service_response_time_dialog.cpp
+++ b/ui/qt/service_response_time_dialog.cpp
@@ -183,7 +183,7 @@ ServiceResponseTimeDialog::ServiceResponseTimeDialog(QWidget &parent, CaptureFil
for (int col = 0; col < NUM_SRT_COLUMNS; col++) {
header_labels.push_back(service_response_time_get_column_name(col));
}
- statsTreeWidget()->setColumnCount(header_labels.count());
+ statsTreeWidget()->setColumnCount(static_cast<int>(header_labels.count()));
statsTreeWidget()->setHeaderLabels(header_labels);
for (int col = 0; col < statsTreeWidget()->columnCount(); col++) {
diff --git a/ui/qt/show_packet_bytes_dialog.cpp b/ui/qt/show_packet_bytes_dialog.cpp
index c29f65d7c7..d2564f169f 100644
--- a/ui/qt/show_packet_bytes_dialog.cpp
+++ b/ui/qt/show_packet_bytes_dialog.cpp
@@ -620,7 +620,7 @@ void ShowPacketBytesDialog::updatePacketBytes(void)
case ShowAsCArray:
{
- int pos = 0, len = field_bytes_.length();
+ int pos = 0, len = static_cast<int>(field_bytes_.length());
QString text("char packet_bytes[] = {\n");
while (pos < len) {
@@ -657,7 +657,7 @@ void ShowPacketBytesDialog::updatePacketBytes(void)
case ShowAsRustArray:
{
- int pos = 0, len = field_bytes_.length();
+ int pos = 0, len = static_cast<int>(field_bytes_.length());
QString text("let packet_bytes: [u8; _] = [\n");
while (pos < len) {
@@ -709,7 +709,7 @@ void ShowPacketBytesDialog::updatePacketBytes(void)
case ShowAsEBCDIC:
{
QByteArray ba(field_bytes_);
- EBCDIC_to_ASCII((guint8*)ba.data(), ba.length());
+ EBCDIC_to_ASCII((guint8*)ba.data(), static_cast<int>(ba.length()));
sanitizeBuffer(ba, false);
ui->tePacketBytes->setLineWrapMode(QTextEdit::WidgetWidth);
ui->tePacketBytes->setPlainText(ba);
@@ -718,7 +718,7 @@ void ShowPacketBytesDialog::updatePacketBytes(void)
case ShowAsHexDump:
{
- int pos = 0, len = field_bytes_.length();
+ int pos = 0, len = static_cast<int>(field_bytes_.length());
// Use 16-bit offset if there are <= 65536 bytes, 32-bit offset if there are more
unsigned int offset_chars = (len - 1 <= 0xFFFF) ? 4 : 8;
QString text;
@@ -798,7 +798,7 @@ void ShowPacketBytesDialog::updatePacketBytes(void)
case ShowAsYAML:
{
const int base64_raw_len = 57; // Encodes to 76 bytes, common in RFCs
- int pos = 0, len = field_bytes_.length();
+ int pos = 0, len = static_cast<int>(field_bytes_.length());
QString text("# Packet Bytes: !!binary |\n");
while (pos < len) {
diff --git a/ui/qt/stats_tree_dialog.cpp b/ui/qt/stats_tree_dialog.cpp
index 3eb64c5bd3..8492e8e57d 100644
--- a/ui/qt/stats_tree_dialog.cpp
+++ b/ui/qt/stats_tree_dialog.cpp
@@ -124,7 +124,7 @@ void StatsTreeDialog::fillTree()
for (int count = 0; count<st_->num_columns; count++) {
header_labels.push_back(stats_tree_get_column_name(count));
}
- statsTreeWidget()->setColumnCount(header_labels.count());
+ statsTreeWidget()->setColumnCount(static_cast<int>(header_labels.count()));
statsTreeWidget()->setHeaderLabels(header_labels);
statsTreeWidget()->setSortingEnabled(false);
diff --git a/ui/qt/tap_parameter_dialog.cpp b/ui/qt/tap_parameter_dialog.cpp
index d7e240787b..0275232fda 100644
--- a/ui/qt/tap_parameter_dialog.cpp
+++ b/ui/qt/tap_parameter_dialog.cpp
@@ -259,11 +259,11 @@ QByteArray TapParameterDialog::getTreeAsString(st_format_type format)
// Iterating over items within this tree.
for (int col=0; col < ui->statsTreeWidget->columnCount(); col++) {
if (col_widths.size() <= col) {
- col_widths.append(ui->statsTreeWidget->headerItem()->text(col).length());
+ col_widths.append(static_cast<int>(ui->statsTreeWidget->headerItem()->text(col).length()));
}
QVariant var = ui->statsTreeWidget->headerItem()->data(col, Qt::DisplayRole);
if (var.userType() == QMetaType::QString) {
- col_widths[col] = qMax(col_widths[col], itemDataToPlain(var).length());
+ col_widths[col] = qMax(col_widths[col], static_cast<int>(itemDataToPlain(var).length()));
}
}
++width_it;
@@ -481,7 +481,7 @@ void TapParameterDialog::addFilterActions()
void TapParameterDialog::addTreeCollapseAllActions()
{
ctx_menu_.addSeparator();
-
+
QAction *collapse = new QAction(tr("Collapse All"), this);
ctx_menu_.addAction(collapse);
connect(collapse, SIGNAL(triggered()), this, SLOT(collapseAllActionTriggered()));
diff --git a/ui/qt/utils/qt_ui_utils.h b/ui/qt/utils/qt_ui_utils.h
index bab40ad08d..044b71d353 100644
--- a/ui/qt/utils/qt_ui_utils.h
+++ b/ui/qt/utils/qt_ui_utils.h
@@ -45,9 +45,10 @@ struct epan_range;
}
#endif /* __cplusplus */
-// Introduced in Qt 5.4
-#ifndef qUtf8Printable
-#define qUtf8Printable(str) str.toUtf8().constData()
+// qsizetype was added in Qt 5.10.0 and is used in the Qt 6 API.
+#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0)
+#include "include/ws_posix_compat.h"
+typedef ssize_t qsizetype;
#endif
/*
diff --git a/ui/qt/widgets/byte_view_text.cpp b/ui/qt/widgets/byte_view_text.cpp
index 8f44b4f2da..bb445605e3 100644
--- a/ui/qt/widgets/byte_view_text.cpp
+++ b/ui/qt/widgets/byte_view_text.cpp
@@ -386,7 +386,7 @@ void ByteViewText::drawLine(QPainter *painter, const int offset, const int row_y
// Build our pixel to byte offset vector the first time through.
bool build_x_pos = x_pos_to_column_.empty() ? true : false;
- int tvb_len = data_.count();
+ int tvb_len = static_cast<int>(data_.count());
int max_tvb_pos = qMin(offset + row_width_, tvb_len) - 1;
QList<QTextLayout::FormatRange> fmt_list;
@@ -407,7 +407,7 @@ void ByteViewText::drawLine(QPainter *painter, const int offset, const int row_y
// Hex
if (show_hex_) {
- int ascii_start = line.length() + DataPrinter::hexChars() + 3;
+ int ascii_start = static_cast<int>(line.length()) + DataPrinter::hexChars() + 3;
// Extra hover space before and after each byte.
int slop = font_width_ / 2;
@@ -676,7 +676,7 @@ void ByteViewText::copyBytes(bool)
// math easier. Should we do smooth scrolling?
void ByteViewText::updateScrollbars()
{
- const int length = data_.count();
+ const int length = static_cast<int>(data_.count());
if (length > 0) {
int all_lines_height = length / row_width_ + ((length % row_width_) ? 1 : 0) - viewport()->height() / line_height_;
diff --git a/ui/qt/widgets/display_filter_edit.cpp b/ui/qt/widgets/display_filter_edit.cpp
index ac45de0def..4511b1483d 100644
--- a/ui/qt/widgets/display_filter_edit.cpp
+++ b/ui/qt/widgets/display_filter_edit.cpp
@@ -515,7 +515,7 @@ void DisplayFilterEdit::buildCompletionList(const QString &field_word)
void *proto_cookie;
QStringList field_list;
- int field_dots = field_word.count('.'); // Some protocol names (_ws.expert) contain periods.
+ int field_dots = static_cast<int>(field_word.count('.')); // Some protocol names (_ws.expert) contain periods.
for (int proto_id = proto_get_first_protocol(&proto_cookie); proto_id != -1; proto_id = proto_get_next_protocol(&proto_cookie)) {
protocol_t *protocol = find_protocol_by_id(proto_id);
if (!proto_is_protocol_enabled(protocol)) continue;
diff --git a/ui/qt/widgets/field_filter_edit.cpp b/ui/qt/widgets/field_filter_edit.cpp
index c7328375fc..59d12cba51 100644
--- a/ui/qt/widgets/field_filter_edit.cpp
+++ b/ui/qt/widgets/field_filter_edit.cpp
@@ -147,7 +147,7 @@ void FieldFilterEdit::buildCompletionList(const QString &field_word)
void *proto_cookie;
QStringList field_list;
- int field_dots = field_word.count('.'); // Some protocol names (_ws.expert) contain periods.
+ int field_dots = static_cast<int>(field_word.count('.')); // Some protocol names (_ws.expert) contain periods.
for (int proto_id = proto_get_first_protocol(&proto_cookie); proto_id != -1; proto_id = proto_get_next_protocol(&proto_cookie)) {
protocol_t *protocol = find_protocol_by_id(proto_id);
if (!proto_is_protocol_enabled(protocol)) continue;
diff --git a/ui/qt/widgets/profile_tree_view.cpp b/ui/qt/widgets/profile_tree_view.cpp
index 8ac415e6b8..67b8ef4aaf 100644
--- a/ui/qt/widgets/profile_tree_view.cpp
+++ b/ui/qt/widgets/profile_tree_view.cpp
@@ -61,9 +61,9 @@ void ProfileTreeView::selectionChanged(const QItemSelection &selected, const QIt
if (model())
{
- int offColumn = model()->columnCount();
- int idxCount = selectedIndexes().count() / offColumn;
- int dselCount = deselected.count() > 0 ? deselected.at(0).indexes().count() / offColumn : 0;
+ qsizetype offColumn = model()->columnCount();
+ qsizetype idxCount = selectedIndexes().count() / offColumn;
+ qsizetype dselCount = deselected.count() > 0 ? deselected.at(0).indexes().count() / offColumn : 0;
/* Ensure, that the last selected row cannot be deselected */
if (idxCount == 0 && dselCount == 1)
diff --git a/ui/qt/widgets/qcustomplot.h b/ui/qt/widgets/qcustomplot.h
index 8d313b21d9..32ef017dd6 100644
--- a/ui/qt/widgets/qcustomplot.h
+++ b/ui/qt/widgets/qcustomplot.h
@@ -954,7 +954,7 @@ public:
friend inline const QCPDataSelection operator-(const QCPDataRange& a, const QCPDataRange& b);
// getters:
- int dataRangeCount() const { return mDataRanges.size(); }
+ int dataRangeCount() const { return static_cast<int>(mDataRanges.size()); }
int dataPointCount() const;
QCPDataRange dataRange(int index=0) const;
QList<QCPDataRange> dataRanges() const { return mDataRanges; }
@@ -1358,8 +1358,8 @@ public:
virtual ~QCPLayoutGrid() Q_DECL_OVERRIDE;
// getters:
- int rowCount() const { return mElements.size(); }
- int columnCount() const { return mElements.size() > 0 ? mElements.first().size() : 0; }
+ int rowCount() const { return static_cast<int>(mElements.size()); }
+ int columnCount() const { return mElements.size() > 0 ? (int) mElements.first().size() : 0; }
QList<double> columnStretchFactors() const { return mColumnStretchFactors; }
QList<double> rowStretchFactors() const { return mRowStretchFactors; }
int columnSpacing() const { return mColumnSpacing; }
@@ -2568,7 +2568,7 @@ public:
QCPDataContainer();
// getters:
- int size() const { return mData.size()-mPreallocSize; }
+ int size() const { return static_cast<int>(mData.size()-mPreallocSize); }
bool isEmpty() const { return size() == 0; }
bool autoSqueeze() const { return mAutoSqueeze; }
@@ -5695,7 +5695,7 @@ public:
// non-virtual methods:
QList<QCPBars*> bars() const { return mBars; }
QCPBars* bars(int index) const;
- int size() const { return mBars.size(); }
+ int size() const { return static_cast<int>(mBars.size()); }
bool isEmpty() const { return mBars.isEmpty(); }
void clear();
bool contains(QCPBars *bars) const { return mBars.contains(bars); }