diff options
author | João Valverde <j@v6e.pt> | 2022-10-04 13:33:37 +0100 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2022-10-04 17:08:31 +0000 |
commit | ec54b1c611792a20b12573a37cc26650412d5f1d (patch) | |
tree | b6b7752b105cd58bf9fae1eddfd54515b46a07df /ui/qt | |
parent | 9acfcd1f9b0d023fedc6d963167a4de9d8f2f8ad (diff) |
Qt: Fix deprecation of QByteArray::count()
Use size() instead, which is exactly the same as count(), and
is not deprecated. Seems to exist in all out supported Qt
versions, as far as I can tell.
warning: ‘qsizetype QByteArray::count() const’ is deprecated: Use size() or length() instead. [-Wdeprecated-declarations]
257 | while ((int) (row_y + line_height_) < widget_height && offset < (int) data_.count()) {
| ~~~~~~~~~~~^~
Diffstat (limited to 'ui/qt')
-rw-r--r-- | ui/qt/widgets/byte_view_text.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/ui/qt/widgets/byte_view_text.cpp b/ui/qt/widgets/byte_view_text.cpp index a7dd25cfa2..bdf9972999 100644 --- a/ui/qt/widgets/byte_view_text.cpp +++ b/ui/qt/widgets/byte_view_text.cpp @@ -254,7 +254,7 @@ void ByteViewText::paintEvent(QPaintEvent *) painter.save(); x_pos_to_column_.clear(); - while ((int) (row_y + line_height_) < widget_height && offset < (int) data_.count()) { + while ((int) (row_y + line_height_) < widget_height && offset < (int) data_.size()) { drawLine(&painter, offset, row_y); offset += row_width_; row_y += line_height_ + leading; @@ -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 = static_cast<int>(data_.count()); + int tvb_len = static_cast<int>(data_.size()); int max_tvb_pos = qMin(offset + row_width_, tvb_len) - 1; QList<QTextLayout::FormatRange> fmt_list; @@ -613,7 +613,7 @@ void ByteViewText::scrollToByte(int byte) int ByteViewText::offsetChars(bool include_pad) { int padding = include_pad ? 2 : 0; - if (! isEmpty() && data_.count() > 0xffff) { + if (! isEmpty() && data_.size() > 0xffff) { return 8 + padding; } return 4 + padding; @@ -676,7 +676,7 @@ void ByteViewText::copyBytes(bool) // math easier. Should we do smooth scrolling? void ByteViewText::updateScrollbars() { - const int length = static_cast<int>(data_.count()); + const int length = static_cast<int>(data_.size()); if (length > 0) { int all_lines_height = length / row_width_ + ((length % row_width_) ? 1 : 0) - viewport()->height() / line_height_; @@ -696,7 +696,7 @@ int ByteViewText::byteOffsetAtPixel(QPoint pos) } byte += col; - if (byte > data_.count()) { + if (byte > data_.size()) { return -1; } return byte; |