diff options
author | Gerald Combs <gerald@wireshark.org> | 2015-05-29 11:33:16 -0700 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2015-05-30 00:05:38 +0000 |
commit | 4ba148771b8f39c8ecc4d496d3eaf861739fdcee (patch) | |
tree | fdbcffb58068505a2538201828baddc302be40db /ui/qt/byte_view_tab.cpp | |
parent | 6a2bf340014b41697a68183a644e51d72514eb02 (diff) | |
download | wireshark-4ba148771b8f39c8ecc4d496d3eaf861739fdcee.tar.gz |
Qt: Always draw a byte view.
When we clear the ByteViewTab add an placeholder ByteViewText.
Change-Id: I9fbcd7e609c084d5724a30f80aa141b59ab1c0a1
Reviewed-on: https://code.wireshark.org/review/8688
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'ui/qt/byte_view_tab.cpp')
-rw-r--r-- | ui/qt/byte_view_tab.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/ui/qt/byte_view_tab.cpp b/ui/qt/byte_view_tab.cpp index c374db29bd..f57edf9611 100644 --- a/ui/qt/byte_view_tab.cpp +++ b/ui/qt/byte_view_tab.cpp @@ -38,8 +38,12 @@ ByteViewTab::ByteViewTab(QWidget *parent) : } void ByteViewTab::addTab(const char *name, tvbuff_t *tvb, proto_tree *tree, QTreeWidget *protoTree, packet_char_enc encoding) { - ByteViewText *byte_view_text = new ByteViewText(this, tvb, tree, protoTree, encoding); + if (count() == 1) { // Remove empty placeholder. + ByteViewText *cur_text = qobject_cast<ByteViewText *>(currentWidget()); + if (cur_text && cur_text->isEmpty()) delete currentWidget(); + } + ByteViewText *byte_view_text = new ByteViewText(this, tvb, tree, protoTree, encoding); byte_view_text->setAccessibleName(name); byte_view_text->setMonospaceFont(mono_font_); connect(this, SIGNAL(monospaceFontChanged(QFont)), byte_view_text, SLOT(setMonospaceFont(QFont))); @@ -53,6 +57,7 @@ void ByteViewTab::clear() while (currentWidget()) { delete currentWidget(); } + addTab(); show(); } |