Qt: Updates for 5.15.
Fix the following deprecation issues for Qt 5.15: Use Qt::WindowFlags() instead of 0 in Qt >= 5.6. Pass Qt::SkipEmptyParts instead of QString::SkipEmptyParts to QString::split() in Qt >= 5.15. Use QMultiMap instead of QMap where we were using QMap::uniqeKeys(). Use QCP::Interactions() instead of 0. Use '\n' instead of QTextStream::endl. Use QWheelEvent::angleDelta() instead of QWheelEvent::angle(). Change-Id: Ie2d69d3a396c0821c2c34f506ddad6f8e22f7049 Reviewed-on: https://code.wireshark.org/review/37334 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
parent
3605bdc323
commit
76d92ba7e7
|
@ -112,7 +112,11 @@ QWidget * ExtArgMultiSelect::createEditor(QWidget * parent)
|
|||
|
||||
if (_argument->pref_valptr && *_argument->pref_valptr)
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||
checked = QString(*_argument->pref_valptr).split(",", Qt::SkipEmptyParts);
|
||||
#else
|
||||
checked = QString(*_argument->pref_valptr).split(",", QString::SkipEmptyParts);
|
||||
#endif
|
||||
}
|
||||
|
||||
viewModel = new QStandardItemModel();
|
||||
|
|
|
@ -323,7 +323,7 @@ static void register_menu_cb(const char *name,
|
|||
|
||||
static void deregister_menu_cb(funnel_menu_callback callback)
|
||||
{
|
||||
foreach (int group, funnel_actions_.uniqueKeys()) {
|
||||
foreach (int group, funnel_actions_.keys()) {
|
||||
QList<FunnelAction *>::iterator it = funnel_actions_[group].begin();
|
||||
while (it != funnel_actions_[group].end()) {
|
||||
FunnelAction *funnel_action = *it;
|
||||
|
|
|
@ -49,10 +49,16 @@ public:
|
|||
//
|
||||
// Pass in the parent on macOS and NULL elsewhere so that we have an
|
||||
// independent window that un-maximizes correctly.
|
||||
#ifdef Q_OS_MAC
|
||||
explicit GeometryStateDialog(QWidget *parent, Qt::WindowFlags f = 0) : QDialog(parent, f) {}
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
|
||||
#define DEFAULT_WINDOW_FLAGS Qt::WindowFlags()
|
||||
#else
|
||||
explicit GeometryStateDialog(QWidget *, Qt::WindowFlags f = 0) : QDialog(NULL, f) {}
|
||||
#define DEFAULT_WINDOW_FLAGS 0
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
explicit GeometryStateDialog(QWidget *parent, Qt::WindowFlags f = DEFAULT_WINDOW_FLAGS) : QDialog(parent, f) {}
|
||||
#else
|
||||
explicit GeometryStateDialog(QWidget *, Qt::WindowFlags f = DEFAULT_WINDOW_FLAGS) : QDialog(NULL, f) {}
|
||||
#endif
|
||||
~GeometryStateDialog();
|
||||
|
||||
|
|
|
@ -1345,7 +1345,7 @@ void IOGraphDialog::on_dragRadioButton_toggled(bool checked)
|
|||
void IOGraphDialog::on_zoomRadioButton_toggled(bool checked)
|
||||
{
|
||||
if (checked) mouse_drags_ = false;
|
||||
ui->ioPlot->setInteractions(0);
|
||||
ui->ioPlot->setInteractions(QCP::Interactions());
|
||||
}
|
||||
|
||||
void IOGraphDialog::on_logCheckBox_toggled(bool checked)
|
||||
|
@ -1530,7 +1530,7 @@ void IOGraphDialog::makeCsv(QTextStream &stream) const
|
|||
}
|
||||
}
|
||||
|
||||
stream << endl;
|
||||
stream << '\n';
|
||||
|
||||
for (int interval = 0; interval <= max_interval; interval++) {
|
||||
double interval_start = (double)interval * ((double)ui_interval / 1000.0);
|
||||
|
@ -1542,7 +1542,7 @@ void IOGraphDialog::makeCsv(QTextStream &stream) const
|
|||
}
|
||||
stream << "," << value;
|
||||
}
|
||||
stream << endl;
|
||||
stream << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -259,7 +259,7 @@ void LteRlcGraphDialog::fillGraph()
|
|||
}
|
||||
double ts = seg->rel_secs + seg->rel_usecs / 1000000.0;
|
||||
|
||||
time_stamp_map_.insertMulti(ts, seg);
|
||||
time_stamp_map_.insert(ts, seg);
|
||||
}
|
||||
|
||||
// Now sequence numbers.
|
||||
|
@ -826,7 +826,7 @@ void LteRlcGraphDialog::on_dragRadioButton_toggled(bool checked)
|
|||
void LteRlcGraphDialog::on_zoomRadioButton_toggled(bool checked)
|
||||
{
|
||||
if (checked) mouse_drags_ = false;
|
||||
ui->rlcPlot->setInteractions(0);
|
||||
ui->rlcPlot->setInteractions(QCP::Interactions());
|
||||
}
|
||||
|
||||
void LteRlcGraphDialog::on_resetButton_clicked()
|
||||
|
|
|
@ -55,7 +55,7 @@ private:
|
|||
struct rlc_graph graph_;
|
||||
|
||||
// Data
|
||||
QMap<double, struct rlc_segment *> time_stamp_map_;
|
||||
QMultiMap<double, struct rlc_segment *> time_stamp_map_;
|
||||
QMap<double, struct rlc_segment *> sequence_num_map_;
|
||||
|
||||
QCPGraph *base_graph_; // Clickable packets
|
||||
|
|
|
@ -1562,7 +1562,11 @@ void MainWindow::addStatsPluginsToMenu() {
|
|||
|
||||
parent_menu = main_ui_->menuStatistics;
|
||||
// gtk/main_menubar.c compresses double slashes, hence SkipEmptyParts
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||
QStringList cfg_name_parts = QString(cfg->name).split("/", Qt::SkipEmptyParts);
|
||||
#else
|
||||
QStringList cfg_name_parts = QString(cfg->name).split("/", QString::SkipEmptyParts);
|
||||
#endif
|
||||
if (cfg_name_parts.isEmpty()) continue;
|
||||
|
||||
QString stat_name = cfg_name_parts.takeLast();
|
||||
|
|
|
@ -337,7 +337,7 @@ void ProtocolHierarchyDialog::on_actionCopyAsCsv_triggered()
|
|||
separated_value << v.toString();
|
||||
}
|
||||
}
|
||||
stream << separated_value.join(",") << endl;
|
||||
stream << separated_value.join(",") << '\n';
|
||||
|
||||
if (!first) ++iter;
|
||||
first = false;
|
||||
|
@ -352,13 +352,13 @@ void ProtocolHierarchyDialog::on_actionCopyAsYaml_triggered()
|
|||
QTreeWidgetItemIterator iter(ui->hierStatsTreeWidget);
|
||||
bool first = true;
|
||||
|
||||
stream << "---" << endl;
|
||||
stream << "---" << '\n';
|
||||
while (*iter) {
|
||||
QTreeWidgetItem *item = first ? NULL : (*iter);
|
||||
|
||||
stream << "-" << endl;
|
||||
stream << "-" << '\n';
|
||||
foreach (QVariant v, protoHierRowData(item)) {
|
||||
stream << " - " << v.toString() << endl;
|
||||
stream << " - " << v.toString() << '\n';
|
||||
}
|
||||
if (!first) ++iter;
|
||||
first = false;
|
||||
|
|
|
@ -470,7 +470,7 @@ void RtpStreamDialog::on_actionCopyAsCsv_triggered()
|
|||
rdsl << v.toString();
|
||||
}
|
||||
}
|
||||
stream << rdsl.join(",") << endl;
|
||||
stream << rdsl.join(",") << '\n';
|
||||
}
|
||||
wsApp->clipboard()->setText(stream.readAll());
|
||||
}
|
||||
|
@ -479,11 +479,11 @@ void RtpStreamDialog::on_actionCopyAsYaml_triggered()
|
|||
{
|
||||
QString yaml;
|
||||
QTextStream stream(&yaml, QIODevice::Text);
|
||||
stream << "---" << endl;
|
||||
stream << "---" << '\n';
|
||||
for (int row = -1; row < ui->streamTreeWidget->topLevelItemCount(); row ++) {
|
||||
stream << "-" << endl;
|
||||
stream << "-" << '\n';
|
||||
foreach (QVariant v, streamRowData(row)) {
|
||||
stream << " - " << v.toString() << endl;
|
||||
stream << " - " << v.toString() << '\n';
|
||||
}
|
||||
}
|
||||
wsApp->clipboard()->setText(stream.readAll());
|
||||
|
|
|
@ -156,7 +156,7 @@ void SequenceDiagram::setData(_seq_analysis_info *sainfo)
|
|||
|
||||
new_data.key = cur_key;
|
||||
new_data.value = sai;
|
||||
data_->insertMulti(new_data.key, new_data);
|
||||
data_->insert(new_data.key, new_data);
|
||||
|
||||
key_ticks.append(cur_key);
|
||||
key_labels.append(sai->time_str);
|
||||
|
|
|
@ -33,7 +33,7 @@ public:
|
|||
struct _seq_analysis_item *value;
|
||||
};
|
||||
|
||||
typedef QMap<double, WSCPSeqData> WSCPSeqDataMap;
|
||||
typedef QMultiMap<double, WSCPSeqData> WSCPSeqDataMap;
|
||||
|
||||
class SequenceDiagram : public QCPAbstractPlottable
|
||||
{
|
||||
|
|
|
@ -347,14 +347,18 @@ void SequenceDialog::mouseMoved(QMouseEvent *event)
|
|||
|
||||
void SequenceDialog::mouseWheeled(QWheelEvent *event)
|
||||
{
|
||||
int scroll_delta = event->delta() * -1 / 15;
|
||||
if (event->orientation() == Qt::Vertical) {
|
||||
scroll_delta *= ui->verticalScrollBar->singleStep();
|
||||
ui->verticalScrollBar->setValue(ui->verticalScrollBar->value() + scroll_delta);
|
||||
} else {
|
||||
scroll_delta *= ui->horizontalScrollBar->singleStep();
|
||||
ui->horizontalScrollBar->setValue(ui->horizontalScrollBar->value() + scroll_delta);
|
||||
int scroll_x = event->angleDelta().x() * -1 / 8;
|
||||
scroll_x *= ui->horizontalScrollBar->singleStep();
|
||||
if (scroll_x) {
|
||||
ui->horizontalScrollBar->setValue(ui->horizontalScrollBar->value() + scroll_x);
|
||||
}
|
||||
|
||||
int scroll_y = event->angleDelta().ry() * -1 / 8;
|
||||
scroll_y *= ui->verticalScrollBar->singleStep();
|
||||
if (scroll_y) {
|
||||
ui->verticalScrollBar->setValue(ui->verticalScrollBar->value() + scroll_y);
|
||||
}
|
||||
|
||||
event->accept();
|
||||
}
|
||||
|
||||
|
|
|
@ -429,7 +429,11 @@ void SimpleDialog::show()
|
|||
const MessagePair SimpleDialog::splitMessage(QString &message) const
|
||||
{
|
||||
if (message.startsWith(primary_delimiter_)) {
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||
QStringList parts = message.split(primary_delimiter_, Qt::SkipEmptyParts);
|
||||
#else
|
||||
QStringList parts = message.split(primary_delimiter_, QString::SkipEmptyParts);
|
||||
#endif
|
||||
switch (parts.length()) {
|
||||
case 0:
|
||||
return MessagePair(QString(), QString());
|
||||
|
|
|
@ -588,7 +588,7 @@ void TCPStreamDialog::fillGraph(bool reset_axes, bool set_focus)
|
|||
first = false;
|
||||
}
|
||||
if (insert) {
|
||||
time_stamp_map_.insertMulti(ts - ts_offset_, seg);
|
||||
time_stamp_map_.insert(ts - ts_offset_, seg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1938,7 +1938,7 @@ void TCPStreamDialog::on_zoomRadioButton_toggled(bool checked)
|
|||
{
|
||||
if (checked) {
|
||||
mouse_drags_ = false;
|
||||
ui->streamPlot->setInteractions(0);
|
||||
ui->streamPlot->setInteractions(QCP::Interactions());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ protected:
|
|||
private:
|
||||
Ui::TCPStreamDialog *ui;
|
||||
capture_file *cap_file_;
|
||||
QMap<double, struct segment *> time_stamp_map_;
|
||||
QMultiMap<double, struct segment *> time_stamp_map_;
|
||||
double ts_offset_;
|
||||
bool ts_origin_conn_;
|
||||
QMap<double, struct segment *> sequence_num_map_;
|
||||
|
|
|
@ -316,7 +316,7 @@ void TrafficTableDialog::copyAsCsv()
|
|||
rdsl << v.toString();
|
||||
}
|
||||
}
|
||||
stream << rdsl.join(",") << endl;
|
||||
stream << rdsl.join(",") << '\n';
|
||||
}
|
||||
wsApp->clipboard()->setText(stream.readAll());
|
||||
}
|
||||
|
@ -330,11 +330,11 @@ void TrafficTableDialog::copyAsYaml()
|
|||
|
||||
QString yaml;
|
||||
QTextStream stream(&yaml, QIODevice::Text);
|
||||
stream << "---" << endl;
|
||||
stream << "---" << '\n';
|
||||
for (int row = -1; row < cur_tree->topLevelItemCount(); row ++) {
|
||||
stream << "-" << endl;
|
||||
stream << "-" << '\n';
|
||||
foreach (QVariant v, curTreeRowData(row)) {
|
||||
stream << " - " << v.toString() << endl;
|
||||
stream << " - " << v.toString() << '\n';
|
||||
}
|
||||
}
|
||||
wsApp->clipboard()->setText(stream.readAll());
|
||||
|
|
|
@ -485,7 +485,7 @@ void VoipCallsDialog::copyAsCSV()
|
|||
// XXX should quotes (") in strval be stripped/sanitized?
|
||||
rdsl << QString("\"%1\"").arg(strval);
|
||||
}
|
||||
stream << rdsl.join(",") << endl;
|
||||
stream << rdsl.join(",") << '\n';
|
||||
}
|
||||
wsApp->clipboard()->setText(stream.readAll());
|
||||
}
|
||||
|
@ -494,11 +494,11 @@ void VoipCallsDialog::copyAsYAML()
|
|||
{
|
||||
QString yaml;
|
||||
QTextStream stream(&yaml, QIODevice::Text);
|
||||
stream << "---" << endl;
|
||||
stream << "---" << '\n';
|
||||
for (int row = -1; row < sorted_model_->rowCount(); row++) {
|
||||
stream << "-" << endl;
|
||||
stream << "-" << '\n';
|
||||
foreach (QVariant v, streamRowData(row)) {
|
||||
stream << " - " << v.toString() << endl;
|
||||
stream << " - " << v.toString() << '\n';
|
||||
}
|
||||
}
|
||||
wsApp->clipboard()->setText(stream.readAll());
|
||||
|
|
|
@ -398,12 +398,16 @@ void WirelessTimeline::wheelEvent(QWheelEvent *event)
|
|||
{
|
||||
// "Most mouse types work in steps of 15 degrees, in which case the delta
|
||||
// value is a multiple of 120; i.e., 120 units * 1/8 = 15 degrees"
|
||||
double steps = event->delta() / 120.0;
|
||||
double steps = event->angleDelta().y() / 120.0;
|
||||
if (steps != 0.0) {
|
||||
zoom_level += steps;
|
||||
if (zoom_level < 0) zoom_level = 0;
|
||||
if (zoom_level > TIMELINE_MAX_ZOOM) zoom_level = TIMELINE_MAX_ZOOM;
|
||||
zoom((float)event->pos().x() / width());
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||
zoom(event->position().x() / width());
|
||||
#else
|
||||
zoom(event->posF().x() / width());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -205,7 +205,7 @@ void WirelessFrame::on_helperToolButton_clicked()
|
|||
if (helper_path.isEmpty()) return;
|
||||
|
||||
QString command = QString("\"%1\"").arg(helper_path);
|
||||
QProcess::startDetached(command);
|
||||
QProcess::startDetached(command, QStringList());
|
||||
}
|
||||
|
||||
void WirelessFrame::on_prefsToolButton_clicked()
|
||||
|
|
|
@ -883,7 +883,7 @@ void WiresharkApplication::removeDynamicMenuGroupItem(int group, QAction *sg_act
|
|||
|
||||
void WiresharkApplication::clearDynamicMenuGroupItems()
|
||||
{
|
||||
foreach (int group, dynamic_menu_groups_.uniqueKeys()) {
|
||||
foreach (int group, dynamic_menu_groups_.keys()) {
|
||||
dynamic_menu_groups_[group].clear();
|
||||
}
|
||||
}
|
||||
|
@ -936,14 +936,14 @@ QList<QAction *> WiresharkApplication::removedMenuGroupItems(int group)
|
|||
|
||||
void WiresharkApplication::clearAddedMenuGroupItems()
|
||||
{
|
||||
foreach (int group, added_menu_groups_.uniqueKeys()) {
|
||||
foreach (int group, added_menu_groups_.keys()) {
|
||||
added_menu_groups_[group].clear();
|
||||
}
|
||||
}
|
||||
|
||||
void WiresharkApplication::clearRemovedMenuGroupItems()
|
||||
{
|
||||
foreach (int group, removed_menu_groups_.uniqueKeys()) {
|
||||
foreach (int group, removed_menu_groups_.keys()) {
|
||||
foreach (QAction *action, removed_menu_groups_[group]) {
|
||||
delete action;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue