Qt: Fix compilation with Qt 6.4

error: conversion function from 'gchar *' (aka 'char *') to 'QVariant' invokes a deleted function
            return entry->hostname;
                   ^~~~~~~~~~~~~~~
/usr/include/qt6/QtCore/qvariant.h:199:5: note: 'QVariant<char *, false>' has been explicitly marked deleted here
    QVariant(T) = delete;
    ^
This commit is contained in:
João Valverde 2022-10-01 21:45:13 +01:00
parent c4c38defa5
commit afa2579124
4 changed files with 8 additions and 8 deletions

View File

@ -77,13 +77,13 @@ QVariant ExportObjectModel::data(const QModelIndex &index, int role) const
case colPacket:
return QString::number(entry->pkt_num);
case colHostname:
return entry->hostname;
return QString::fromUtf8(entry->hostname);
case colContent:
return entry->content_type;
return QString::fromUtf8(entry->content_type);
case colSize:
return file_size_to_qstring(entry->payload_len);
case colFilename:
return entry->filename;
return QString::fromUtf8(entry->filename);
}
}
else if (role == Qt::UserRole)

View File

@ -50,9 +50,9 @@ QVariant VoipCallsInfoModel::data(const QModelIndex &index, int role) const
case InitialSpeaker:
return address_to_display_qstring(&(call_info->initial_speaker));
case From:
return call_info->from_identity;
return QString::fromUtf8(call_info->from_identity);
case To:
return call_info->to_identity;
return QString::fromUtf8(call_info->to_identity);
case Protocol:
return ((call_info->protocol == VOIP_COMMON) && call_info->protocol_name) ?
call_info->protocol_name : voip_protocol_name[call_info->protocol];
@ -99,7 +99,7 @@ QVariant VoipCallsInfoModel::data(const QModelIndex &index, int role) const
break;
case VOIP_COMMON:
default:
return call_info->call_comment;
return QString::fromUtf8(call_info->call_comment);
}
case ColumnCount:
ws_assert_not_reached();

View File

@ -429,7 +429,7 @@ gboolean FilterExpressionToolBar::filter_expression_add_action(const void *key _
dfb_action->setToolTip(fe->expression);
dfb_action->setProperty(dfe_property_comment_, QString(fe->expression));
}
dfb_action->setData(fe->expression);
dfb_action->setData(QString::fromUtf8(fe->expression));
dfb_action->setProperty(dfe_property_, true);
dfb_action->setProperty(dfe_property_label_, QString(fe->label));
dfb_action->setProperty(dfe_property_expression_, QString(fe->expression));

View File

@ -1670,7 +1670,7 @@ void WiresharkMainWindow::addStatsPluginsToMenu() {
}
stats_tree_action = new QAction(stat_name, this);
stats_tree_action->setData(cfg->abbr);
stats_tree_action->setData(QString::fromUtf8(cfg->abbr));
parent_menu->addAction(stats_tree_action);
connect(stats_tree_action, &QAction::triggered, this, [this]() {
QAction* action = qobject_cast<QAction*>(sender());