forked from osmocom/wireshark
Qt: Fix 5.13 deprecated warnings
With Qt 5.13 some methods are deprecated. Fixing those warnings Change-Id: Ia290f06f2b681de1d5b437624de77d8a5c2f5266 Reviewed-on: https://code.wireshark.org/review/33761 Petri-Dish: Roland Knall <rknall@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Roland Knall <rknall@gmail.com>
This commit is contained in:
parent
41d0cf7320
commit
8e80415aaf
|
@ -375,7 +375,7 @@ void BluetoothAttServerAttributesDialog::on_actionSave_as_image_triggered()
|
|||
|
||||
if (fileName.isEmpty()) return;
|
||||
|
||||
image = QPixmap::grabWidget(ui->tableTreeWidget);
|
||||
image = ui->tableTreeWidget->grab();
|
||||
image.save(fileName, "PNG");
|
||||
}
|
||||
|
||||
|
|
|
@ -669,7 +669,7 @@ void BluetoothDeviceDialog::on_actionSave_as_image_triggered()
|
|||
|
||||
if (fileName.isEmpty()) return;
|
||||
|
||||
image = QPixmap::grabWidget(ui->tableWidget);
|
||||
image = ui->tableWidget->grab();
|
||||
image.save(fileName, "PNG");
|
||||
}
|
||||
|
||||
|
|
|
@ -443,7 +443,7 @@ void BluetoothDevicesDialog::on_actionSave_as_image_triggered()
|
|||
|
||||
if (fileName.isEmpty()) return;
|
||||
|
||||
image = QPixmap::grabWidget(ui->tableTreeWidget);
|
||||
image = ui->tableTreeWidget->grab();
|
||||
image.save(fileName, "PNG");
|
||||
}
|
||||
|
||||
|
|
|
@ -871,7 +871,7 @@ void BluetoothHciSummaryDialog::on_actionSave_as_image_triggered()
|
|||
|
||||
if (fileName.isEmpty()) return;
|
||||
|
||||
image = QPixmap::grabWidget(ui->tableTreeWidget);
|
||||
image = ui->tableTreeWidget->grab();
|
||||
image.save(fileName, "PNG");
|
||||
}
|
||||
|
||||
|
|
|
@ -166,7 +166,7 @@ public:
|
|||
palette.setCurrentColorGroup(QPalette::Disabled);
|
||||
setText(column, UTF8_EM_DASH);
|
||||
}
|
||||
setTextColor(column, palette.text().color());
|
||||
setForeground(column, palette.text().color());
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
@ -760,12 +760,19 @@ void PacketList::setRecentColumnWidth(int col)
|
|||
const char *long_str = get_column_width_string(fmt, col);
|
||||
|
||||
QFontMetrics fm = QFontMetrics(wsApp->monospaceFont());
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
|
||||
if (long_str) {
|
||||
col_width = fm.horizontalAdvance(long_str);
|
||||
} else {
|
||||
col_width = fm.horizontalAdvance(MIN_COL_WIDTH_STR);
|
||||
}
|
||||
#else
|
||||
if (long_str) {
|
||||
col_width = fm.width(long_str);
|
||||
} else {
|
||||
col_width = fm.width(MIN_COL_WIDTH_STR);
|
||||
}
|
||||
|
||||
#endif
|
||||
// Custom delegate padding
|
||||
if (itemDelegateForColumn(col)) {
|
||||
col_width += itemDelegateForColumn(col)->sizeHint(viewOptions(), QModelIndex()).width();
|
||||
|
|
|
@ -179,7 +179,6 @@ ResolvedAddressesDialog::ResolvedAddressesDialog(QWidget *parent, CaptureFile *c
|
|||
ui->plainTextEdit->setFont(wsApp->monospaceFont());
|
||||
ui->plainTextEdit->setReadOnly(true);
|
||||
ui->plainTextEdit->setWordWrapMode(QTextOption::NoWrap);
|
||||
ui->plainTextEdit->setTabStopWidth(ui->plainTextEdit->fontMetrics().averageCharWidth() * 8);
|
||||
|
||||
if (capture_file->isValid()) {
|
||||
wtap* wth = capture_file->capFile()->provider.wth;
|
||||
|
|
|
@ -387,7 +387,9 @@ void RtpPlayerDialog::addRtpStream(rtpstream_info_t *rtpstream)
|
|||
ti->setData(stream_data_col_, Qt::UserRole, QVariant::fromValue(audio_stream));
|
||||
|
||||
for (int col = 0; col < ui->streamTreeWidget->columnCount(); col++) {
|
||||
ti->setTextColor(col, audio_stream->color());
|
||||
QBrush fgBrush = ti->foreground(col);
|
||||
fgBrush.setColor(audio_stream->color());
|
||||
ti->setForeground(col, fgBrush);
|
||||
}
|
||||
|
||||
connect(ui->playButton, SIGNAL(clicked(bool)), audio_stream, SLOT(startPlaying()));
|
||||
|
|
|
@ -110,9 +110,15 @@ public:
|
|||
if (calc.problem) {
|
||||
setText(status_col_, UTF8_BULLET);
|
||||
setTextAlignment(status_col_, Qt::AlignCenter);
|
||||
QColor bgColor(ws_css_warn_background);
|
||||
QColor textColor(ws_css_warn_text);
|
||||
for (int i = 0; i < columnCount(); i++) {
|
||||
setBackgroundColor(i, ws_css_warn_background);
|
||||
setTextColor(i, ws_css_warn_text);
|
||||
QBrush bgBrush = background(i);
|
||||
bgBrush.setColor(bgColor);
|
||||
setBackground(i, bgBrush);
|
||||
QBrush fgBrush = foreground(i);
|
||||
fgBrush.setColor(textColor);
|
||||
setForeground(i, fgBrush);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -322,7 +322,13 @@ void SequenceDiagram::draw(QCPPainter *painter)
|
|||
? arrow_start.x() : arrow_end.x();
|
||||
double arrow_width = (arrow_end.x() - arrow_start.x()) * dir_mul;
|
||||
QString arrow_label = cfm.elidedText(sai->frame_label, Qt::ElideRight, arrow_width);
|
||||
QPoint text_pt(comment_start + ((arrow_width - cfm.width(arrow_label)) / 2),
|
||||
int arrow_label_width = 0;
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
|
||||
arrow_label_width = cfm.horizontalAdvance(arrow_label);
|
||||
#else
|
||||
arrow_label_width = cfm.width(arrow_label);
|
||||
#endif
|
||||
QPoint text_pt(comment_start + ((arrow_width - arrow_label_width) / 2),
|
||||
arrow_start.y() - (en_w / 2));
|
||||
|
||||
painter->setFont(comment_axis_->tickLabelFont());
|
||||
|
@ -333,9 +339,13 @@ void SequenceDiagram::draw(QCPPainter *painter)
|
|||
int right_x = dir_mul > 0 ? arrow_end.x() : arrow_start.x();
|
||||
QString port_left = QString::number(dir_mul > 0 ? sai->port_src : sai->port_dst);
|
||||
QString port_right = QString::number(dir_mul > 0 ? sai->port_dst : sai->port_src);
|
||||
|
||||
text_pt = QPoint(left_x - en_w - cfm.width(port_left),
|
||||
arrow_start.y() + (en_w / 2));
|
||||
int port_left_width = 0;
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
|
||||
port_left_width = cfm.horizontalAdvance(port_left);
|
||||
#else
|
||||
port_left_width = cfm.width(port_left);
|
||||
#endif
|
||||
text_pt = QPoint(left_x - en_w - port_left_width, arrow_start.y() + (en_w / 2));
|
||||
painter->drawText(text_pt, port_left);
|
||||
|
||||
text_pt.setX(right_x + en_w);
|
||||
|
|
|
@ -302,7 +302,7 @@ void WelcomePage::updateRecentCaptures() {
|
|||
rfItem->setFlags(ri->accessible ? Qt::ItemIsSelectable | Qt::ItemIsEnabled : Qt::NoItemFlags);
|
||||
rfItem->setFont(rfFont);
|
||||
if (ri->filename == selectedFilename) {
|
||||
recent_files_->setItemSelected(rfItem, true);
|
||||
rfItem->setSelected(true);
|
||||
}
|
||||
rfRow++;
|
||||
}
|
||||
|
|
|
@ -349,9 +349,11 @@ void WiresharkApplication::setMonospaceFont(const char *font_string) {
|
|||
|
||||
int WiresharkApplication::monospaceTextSize(const char *str)
|
||||
{
|
||||
QFontMetrics fm(mono_font_);
|
||||
|
||||
return fm.width(str);
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
|
||||
return QFontMetrics(mono_font_).horizontalAdvance(str);
|
||||
#else
|
||||
return QFontMetrics(mono_font_).width(str);
|
||||
#endif
|
||||
}
|
||||
|
||||
void WiresharkApplication::setConfigurationProfile(const gchar *profile_name, bool write_recent)
|
||||
|
|
Loading…
Reference in New Issue