diff options
author | Gerald Combs <gerald@wireshark.org> | 2013-12-13 21:31:01 +0000 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2013-12-13 21:31:01 +0000 |
commit | fde7a4c26346ff7a5afd49cc27ba6cca2cb173a3 (patch) | |
tree | 92719a737f060406419da49cded6662b024871db | |
parent | 9d21f521feb9ae04f0ec64771fba2299a6fd0c74 (diff) |
Simplify column sizing.
svn path=/trunk/; revision=54068
-rw-r--r-- | ui/qt/decode_as_dialog.cpp | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/ui/qt/decode_as_dialog.cpp b/ui/qt/decode_as_dialog.cpp index 19e4d3f47c..4e071282c0 100644 --- a/ui/qt/decode_as_dialog.cpp +++ b/ui/qt/decode_as_dialog.cpp @@ -52,7 +52,6 @@ const char *default_table_ = "TCP port"; const char *default_proto_ = "HTTP"; const char *default_int_selector_ = "0"; // Arbitrary const char *default_str_selector_ = "foo"; // Arbitrary -const int max_name_em_width_ = 10; // Some table names are a tad long. DecodeAsDialog::DecodeAsDialog(QWidget *parent, capture_file *cf, bool create_new) : QDialog(parent), @@ -157,11 +156,11 @@ void DecodeAsDialog::fillTable() dissector_all_tables_foreach_changed(buildChangedList, this); decode_dcerpc_add_show_list(buildDceRpcChangedList, this); - ui->decodeAsTreeWidget->resizeColumnToContents(table_col_); - ui->decodeAsTreeWidget->resizeColumnToContents(selector_col_); - ui->decodeAsTreeWidget->resizeColumnToContents(type_col_); - ui->decodeAsTreeWidget->resizeColumnToContents(default_col_); - ui->decodeAsTreeWidget->resizeColumnToContents(proto_col_); + if (ui->decodeAsTreeWidget->topLevelItemCount() > 0) { + for (int i = 0; i < ui->decodeAsTreeWidget->columnCount(); i++) { + ui->decodeAsTreeWidget->resizeColumnToContents(i); + } + } } void DecodeAsDialog::activateLastItem() @@ -265,10 +264,6 @@ void DecodeAsDialog::on_decodeAsTreeWidget_itemActivated(QTreeWidgetItem *item, this, SLOT(tableNamesCurrentIndexChanged(const QString &))); connect(table_names_combo_box_, SIGNAL(destroyed()), this, SLOT(tableNamesDestroyed())); table_names_combo_box_->setFocus(); - - QFontMetrics fm(font()); - ui->decodeAsTreeWidget->setColumnWidth(table_col_, fm.height() * max_name_em_width_); - ui->decodeAsTreeWidget->setColumnWidth(selector_col_, fm.height() * max_name_em_width_); } void DecodeAsDialog::on_decodeAsTreeWidget_itemSelectionChanged() |