Qt: More new-style signals+slot conversions.

This commit is contained in:
Gerald Combs 2021-10-10 16:05:57 -07:00 committed by Wireshark GitLab Utility
parent e5bcf6b402
commit 11c58e78f7
10 changed files with 40 additions and 39 deletions

View File

@ -59,10 +59,10 @@ BluetoothAttServerAttributesDialog::BluetoothAttServerAttributesDialog(QWidget &
ui->setupUi(this);
loadGeometry(parent.width() * 4 / 5, parent.height() * 2 / 3);
connect(ui->tableTreeWidget, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(tableContextMenu(const QPoint &)));
connect(ui->interfaceComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(interfaceCurrentIndexChanged(int)));
connect(ui->deviceComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(deviceCurrentIndexChanged(int)));
connect(ui->removeDuplicatesCheckBox, SIGNAL(stateChanged(int)), this, SLOT(removeDuplicatesStateChanged(int)));
connect(ui->tableTreeWidget, &QTreeWidget::customContextMenuRequested, this, &BluetoothAttServerAttributesDialog::tableContextMenu);
connect(ui->interfaceComboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &BluetoothAttServerAttributesDialog::interfaceCurrentIndexChanged);
connect(ui->deviceComboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &BluetoothAttServerAttributesDialog::deviceCurrentIndexChanged);
connect(ui->removeDuplicatesCheckBox, &QCheckBox::stateChanged, this, &BluetoothAttServerAttributesDialog::removeDuplicatesStateChanged);
ui->tableTreeWidget->sortByColumn(column_number_handle, Qt::AscendingOrder);

View File

@ -603,7 +603,7 @@ void CaptureFileDialog::addPreview(QVBoxLayout &v_box) {
preview_grid->addWidget(&preview_first_elapsed_, 3, 1);
preview_labels_ << lbl << &preview_first_elapsed_;
connect(this, SIGNAL(currentChanged(const QString &)), this, SLOT(preview(const QString &)));
connect(this, &CaptureFileDialog::currentChanged, this, &CaptureFileDialog::preview);
preview("");
}
@ -692,7 +692,7 @@ QDialogButtonBox *CaptureFileDialog::addHelpButton(topic_action_e help_topic)
if (button_box) {
button_box->addButton(QDialogButtonBox::Help);
connect(button_box, SIGNAL(helpRequested()), this, SLOT(on_buttonBox_helpRequested()));
connect(button_box, &QDialogButtonBox::helpRequested, this, &CaptureFileDialog::on_buttonBox_helpRequested);
}
return button_box;
}
@ -784,8 +784,8 @@ check_savability_t CaptureFileDialog::exportSelectedPackets(QString &file_name,
if (button_box) {
save_bt_ = button_box->button(QDialogButtonBox::Save);
if (save_bt_) {
connect(&packet_range_group_box_, SIGNAL(validityChanged(bool)),
save_bt_, SLOT(setEnabled(bool)));
connect(&packet_range_group_box_, &PacketRangeGroupBox::validityChanged,
save_bt_, &QPushButton::setEnabled);
}
}

View File

@ -87,8 +87,8 @@ DisplayFilterExpressionDialog::DisplayFilterExpressionDialog(QWidget *parent) :
value_label_pfx_ = ui->valueLabel->text();
connect(ui->valueLineEdit, SIGNAL(textEdited(QString)), this, SLOT(updateWidgets()));
connect(ui->rangeLineEdit, SIGNAL(textEdited(QString)), this, SLOT(updateWidgets()));
connect(ui->valueLineEdit, &QLineEdit::textEdited, this, &DisplayFilterExpressionDialog::updateWidgets);
connect(ui->rangeLineEdit, &QLineEdit::textEdited, this, &DisplayFilterExpressionDialog::updateWidgets);
// Trigger updateWidgets
ui->fieldTreeWidget->selectionModel()->clear();

View File

@ -54,9 +54,9 @@ ExportObjectDialog::ExportObjectDialog(QWidget &parent, CaptureFile &cf, registe
eo_ui_->progressBar->setAttribute(Qt::WA_MacSmallSize, true);
#endif
connect(&model_, SIGNAL(rowsInserted(QModelIndex,int,int)),
this, SLOT(modelDataChanged(QModelIndex, int, int)));
connect(&model_, SIGNAL(modelReset()), this, SLOT(modelRowsReset()));
connect(&model_, &ExportObjectModel::rowsInserted,
this, &ExportObjectDialog::modelDataChanged);
connect(&model_, &ExportObjectModel::modelReset, this, &ExportObjectDialog::modelRowsReset);
connect(eo_ui_->filterLine, &QLineEdit::textChanged, &proxyModel_, &ExportObjectProxyModel::setTextFilterString);
connect(eo_ui_->objectTree, &ExportObjectsTreeView::currentIndexChanged, this, &ExportObjectDialog::currentHasChanged);
@ -79,8 +79,8 @@ ExportObjectDialog::ExportObjectDialog(QWidget &parent, CaptureFile &cf, registe
if (save_all_bt_) save_all_bt_->setEnabled(false);
if (close_bt) close_bt->setDefault(true);
connect(&cap_file_, SIGNAL(captureEvent(CaptureEvent)),
this, SLOT(captureEvent(CaptureEvent)));
connect(&cap_file_, &CaptureFile::captureEvent,
this, &ExportObjectDialog::captureEvent);
}
ExportObjectDialog::~ExportObjectDialog()

View File

@ -75,8 +75,8 @@ QWidget * ExtcapArgumentFileSelection::createEditor(QWidget * parent)
buttonSelect->setToolTip(QString().fromUtf8(_argument->tooltip));
}
connect(buttonSelect, SIGNAL(clicked()), (QObject *)this, SLOT(openFileDialog()));
connect(buttonClear, SIGNAL(clicked()), (QObject *)this, SLOT(clearFilename()));
connect(buttonSelect, &QPushButton::clicked, this, &ExtcapArgumentFileSelection::openFileDialog);
connect(buttonClear, &QPushButton::clicked, this, &ExtcapArgumentFileSelection::clearFilename);
editLayout->addWidget(textBox);
editLayout->addWidget(buttonSelect);

View File

@ -332,8 +332,8 @@ LBMStreamDialog::LBMStreamDialog(QWidget * parent, capture_file * cfile) :
{
m_ui->setupUi(this);
m_dialog_info = new LBMStreamDialogInfo();
connect(this, SIGNAL(accepted()), this, SLOT(closeDialog()));
connect(this, SIGNAL(rejected()), this, SLOT(closeDialog()));
connect(this, &LBMStreamDialog::accepted, this, &LBMStreamDialog::closeDialog);
connect(this, &LBMStreamDialog::rejected, this, &LBMStreamDialog::closeDialog);
fillTree();
}

View File

@ -601,12 +601,12 @@ LteMacStatisticsDialog::LteMacStatisticsDialog(QWidget &parent, CaptureFile &cf,
}
// Set handler for when the tree item changes to set the appropriate labels.
connect(statsTreeWidget(), SIGNAL(itemSelectionChanged()),
this, SLOT(updateHeaderLabels()));
connect(statsTreeWidget(), &QTreeWidget::itemSelectionChanged,
this, &LteMacStatisticsDialog::updateHeaderLabels);
// Set handler for when display filter string is changed.
connect(this, SIGNAL(updateFilter(QString)),
this, SLOT(filterUpdated(QString)));
connect(this, &LteMacStatisticsDialog::updateFilter,
this, &LteMacStatisticsDialog::filterUpdated);
}
// Destructor.

View File

@ -229,9 +229,10 @@ MulticastStatisticsDialog::MulticastStatisticsDialog(QWidget &parent, CaptureFil
<< buffer_alarm_threshold_le_ << stream_empty_speed_le_
<< total_empty_speed_le_;
foreach (QWidget *line_edit, line_edits_) {
foreach (QWidget *w, line_edits_) {
QLineEdit *line_edit = qobject_cast<QLineEdit *>(w);
line_edit->setMinimumWidth(one_em * 5);
connect(line_edit, SIGNAL(textEdited(QString)), this, SLOT(updateWidgets()));
connect(line_edit, &QLineEdit::textEdited, this, &MulticastStatisticsDialog::updateWidgets);
}
addFilterActions();
@ -240,8 +241,8 @@ MulticastStatisticsDialog::MulticastStatisticsDialog(QWidget &parent, CaptureFil
setDisplayFilter(filter);
}
connect(this, SIGNAL(updateFilter(QString)),
this, SLOT(updateMulticastParameters()));
connect(this, &MulticastStatisticsDialog::updateFilter,
this, &MulticastStatisticsDialog::updateMulticastParameters);
/* Register the tap listener */
register_tap_listener_mcast_stream(tapinfo_);

View File

@ -87,8 +87,8 @@ void PreferenceEditorFrame::editPreference(preference *pref, pref_module *module
switch (prefs_get_type(pref_)) {
case PREF_UINT:
case PREF_DECODE_AS_UINT:
connect(ui->preferenceLineEdit, SIGNAL(textChanged(QString)),
this, SLOT(uintLineEditTextEdited(QString)));
connect(ui->preferenceLineEdit, &SyntaxLineEdit::textChanged,
this, &PreferenceEditorFrame::uintLineEditTextEdited);
show = true;
break;
case PREF_SAVE_FILENAME:
@ -97,14 +97,14 @@ void PreferenceEditorFrame::editPreference(preference *pref, pref_module *module
browse_button = true;
// Fallthrough
case PREF_STRING:
connect(ui->preferenceLineEdit, SIGNAL(textChanged(QString)),
this, SLOT(stringLineEditTextEdited(QString)));
connect(ui->preferenceLineEdit, &SyntaxLineEdit::textChanged,
this, &PreferenceEditorFrame::stringLineEditTextEdited);
show = true;
break;
case PREF_RANGE:
case PREF_DECODE_AS_RANGE:
connect(ui->preferenceLineEdit, SIGNAL(textChanged(QString)),
this, SLOT(rangeLineEditTextEdited(QString)));
connect(ui->preferenceLineEdit, &SyntaxLineEdit::textChanged,
this, &PreferenceEditorFrame::rangeLineEditTextEdited);
show = true;
break;
default:

View File

@ -106,10 +106,10 @@ ProfileDialog::ProfileDialog(QWidget *parent) :
pd_ui_->cmbProfileTypes->addItems(ProfileSortModel::filterTypes());
connect (pd_ui_->cmbProfileTypes, SIGNAL(currentTextChanged(const QString &)),
this, SLOT(filterChanged(const QString &)));
connect (pd_ui_->lineProfileFilter, SIGNAL(textChanged(const QString &)),
this, SLOT(filterChanged(const QString &)));
connect (pd_ui_->cmbProfileTypes, &QComboBox::currentTextChanged,
this, &ProfileDialog::filterChanged);
connect (pd_ui_->lineProfileFilter, &QLineEdit::textChanged,
this, &ProfileDialog::filterChanged);
currentItemChanged();
@ -760,8 +760,8 @@ void ProfileDialog::resetTreeView()
QItemSelectionModel *selModel = pd_ui_->profileTreeView->selectionModel();
connect(selModel, &QItemSelectionModel::currentChanged,
this, &ProfileDialog::currentItemChanged, Qt::QueuedConnection);
connect(selModel, SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),
this, SLOT(selectionChanged()));
connect(selModel, &QItemSelectionModel::selectionChanged,
this, &ProfileDialog::selectionChanged);
selectionChanged();