diff options
author | Gerald Combs <gerald@wireshark.org> | 2014-08-06 14:50:48 -0700 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2014-08-08 05:57:01 +0000 |
commit | 4da7570809f7ea303ca15368d2c818fafc1a70f5 (patch) | |
tree | a3864c351c5349af1c22e35a593aa472093d49de /ui/qt/capture_interfaces_dialog.h | |
parent | 40d5c503a7b184c09105d37db33d4ec324416185 (diff) |
Use a QTreeWidget instead of QTableWidget.
Even though Qt's widget naming suggests otherwise, a QTreeWidget is
usually a better choice for tables than QTableWidget. The former gives
you a nice, clean Plain Old Table while the latter gives you something
that looks and acts like a spreadsheet.
In this particular instance using QTreeWidget also gives us the option
of adding sub-items with detailed information. Do so for attached
addresses.
Allow sorting by traffic while we're here. Simplify the column hiding
logic. Make sure the sparkline delegate isn't editable.
Change-Id: Ia36ba2e12c1c0cb86ae5b2154e6afcf6549ae049
Reviewed-on: https://code.wireshark.org/review/3466
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Tested-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'ui/qt/capture_interfaces_dialog.h')
-rw-r--r-- | ui/qt/capture_interfaces_dialog.h | 36 |
1 files changed, 9 insertions, 27 deletions
diff --git a/ui/qt/capture_interfaces_dialog.h b/ui/qt/capture_interfaces_dialog.h index eaa3f7c0b6..4a11e33f28 100644 --- a/ui/qt/capture_interfaces_dialog.h +++ b/ui/qt/capture_interfaces_dialog.h @@ -29,48 +29,30 @@ #include <QDialog> #include <QPushButton> -#include <QTableWidget> typedef struct if_stat_cache_s if_stat_cache_t; #include "interface_tree.h" #include "preferences_dialog.h" -/* - * Symbolic names for column indices. - */ -enum -{ - INTERFACE = 0, - TRAFFIC, - LINK, - PMODE, - SNAPLEN, - BUFFER, - MONITOR, - FILTER, - NUM_COLUMNS -}; - - namespace Ui { class CaptureInterfacesDialog; } #include <QStyledItemDelegate> -class TbInterfacesDelegate : public QStyledItemDelegate +class InterfaceTreeDelegate : public QStyledItemDelegate { Q_OBJECT private: - QTableWidget* table; + QTreeWidget* tree_; public: - TbInterfacesDelegate(QObject *parent = 0); - ~TbInterfacesDelegate(); + InterfaceTreeDelegate(QObject *parent = 0); + ~InterfaceTreeDelegate(); QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const; - void setTable(QTableWidget* tb) { table = tb; }; + void setTree(QTreeWidget* tree) { tree_ = tree; } bool eventFilter(QObject *object, QEvent *event); private slots: @@ -92,7 +74,7 @@ public: ~CaptureInterfacesDialog(); void SetTab(int index); - void UpdateInterfaces(); + void updateInterfaces(); private slots: void on_capturePromModeCheckBox_toggled(bool checked); @@ -109,8 +91,8 @@ private slots: void start_button_clicked(); void on_buttonBox_rejected(); void on_buttonBox_helpRequested(); - void tableItemClicked(QTableWidgetItem * item); - void tableSelected(); + void interfaceClicked(QTreeWidgetItem *item, int column); + void interfaceSelected(); void updateWidgets(); void updateStatistics(void); void allFilterChanged(); @@ -135,7 +117,7 @@ private: QPushButton *stop_bt_; if_stat_cache_t *stat_cache_; QTimer *stat_timer_; - TbInterfacesDelegate combobox_item_delegate_; + InterfaceTreeDelegate interface_item_delegate_; QMap<int, int> deviceMap; void saveOptionsToPreferences(); |