sign: Open StreamStats as a Tabbed widget

PortStats and StreamStats Windows are presented as a tabbed widget.
Multiple StreamStats windows are titled to include an id to hint at the
sequence in which they were opened
This commit is contained in:
Srivats P 2016-11-27 12:39:37 +05:30
parent 4f8ee757b3
commit 3d7a459b5f
4 changed files with 24 additions and 4 deletions

View File

@ -234,14 +234,18 @@ void PortStatsWindow::on_tbGetStreamStats_clicked()
model->portListFromIndex(selectedColumns(), portList);
if (portList.size()) {
QDockWidget *dock = new QDockWidget(tr("Stream Statistics"),
mainWindow);
QDockWidget *dock = new QDockWidget(mainWindow);
streamStatsModel = new StreamStatsModel(dock);
dock->setWidget(new StreamStatsWindow(streamStatsModel, dock));
dock->setWindowTitle(dock->widget()->windowTitle());
dock->setObjectName("streamStatsDock");
dock->setFloating(true);
dock->setAttribute(Qt::WA_DeleteOnClose);
QDockWidget *statsDock = mainWindow->findChild<QDockWidget*>(
"statsDock");
mainWindow->addDockWidget(Qt::BottomDockWidgetArea, dock);
mainWindow->tabifyDockWidget(statsDock, dock);
dock->show();
dock->raise();
}
// Get stream stats for selected ports, portgroup by portgroup

View File

@ -22,14 +22,29 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
#include <QAbstractItemModel>
#include <QHeaderView>
static int id;
static int count;
StreamStatsWindow::StreamStatsWindow(QAbstractItemModel *model, QWidget *parent)
: QWidget(parent)
{
setupUi(this);
if (id)
setWindowTitle(windowTitle() + QString("(%1)").arg(id));
id++;
count++;
streamStats->setModel(model);
streamStats->verticalHeader()->setHighlightSections(false);
streamStats->verticalHeader()->setDefaultSectionSize(
streamStats->verticalHeader()->minimumSectionSize());
}
StreamStatsWindow::~StreamStatsWindow()
{
count--;
if (count == 0)
id = 0;
}

View File

@ -29,6 +29,7 @@ class StreamStatsWindow: public QWidget, private Ui::StreamStatsWindow
Q_OBJECT
public:
StreamStatsWindow(QAbstractItemModel *model, QWidget *parent = 0);
~StreamStatsWindow();
};
#endif

View File

@ -10,7 +10,7 @@
</rect>
</property>
<property name="windowTitle" >
<string>Form</string>
<string>Stream Statistics</string>
</property>
<layout class="QHBoxLayout" >
<item>