Add a scroll bar for TraceAnalyzer
A scroll bar was added to the TraceAnalyzer to prepare for the upcoming changes of collapsing/folding ranks to increase readability when many ranks are displayed. The scroll bar is hidden up to a number of 25 rows in the TracePlot.
This commit is contained in:
@@ -172,11 +172,13 @@ void TracePlot::setUpContextMenu()
|
||||
contextMenu->addActions({showQueryEditor, insertComment, exportToPdf});
|
||||
}
|
||||
|
||||
void TracePlot::init(TraceNavigator *navigator)
|
||||
void TracePlot::init(TraceNavigator *navigator, QScrollBar *scrollBar)
|
||||
{
|
||||
Q_ASSERT(isInitialized == false);
|
||||
isInitialized = true;
|
||||
|
||||
this->scrollBar = scrollBar;
|
||||
|
||||
this->navigator = navigator;
|
||||
connectNavigatorQ_SIGNALS();
|
||||
setUpDrawingProperties();
|
||||
@@ -254,13 +256,34 @@ void TracePlot::setUpZoom()
|
||||
zoomZone->setVisible(false);
|
||||
}
|
||||
|
||||
void TracePlot::verticalScrollbarChanged(int value)
|
||||
{
|
||||
int numberOfBanks = drawingProperties.numberOfBanks;
|
||||
|
||||
// The maximum number of displayed rows determined by the pageStep of the scroll bar.
|
||||
const int maxDisplayedRows = scrollBar->pageStep();
|
||||
|
||||
if (numberOfBanks + 5 + 2 <= maxDisplayedRows)
|
||||
{
|
||||
setAxisScale(yLeft, -5, numberOfBanks + 2, 1.0);
|
||||
}
|
||||
else
|
||||
{
|
||||
setAxisScale(yLeft, numberOfBanks - maxDisplayedRows + 2 - value, numberOfBanks + 2 - value, 1.0);
|
||||
}
|
||||
|
||||
replot();
|
||||
}
|
||||
|
||||
void TracePlot::setUpAxis()
|
||||
{
|
||||
int numberOfBanks = navigator->GeneralTraceInfo().numberOfBanks;
|
||||
// Set up y axis.
|
||||
verticalScrollbarChanged(scrollBar->value());
|
||||
|
||||
setAxisScale(yLeft, -5, numberOfBanks + 2, 1.0);
|
||||
setAxisScaleDraw(yLeft, new CustomLabelScaleDraw(
|
||||
drawingProperties.getLabels()));
|
||||
CustomLabelScaleDraw *customLabelScaleDraw = new CustomLabelScaleDraw(drawingProperties.getLabels());
|
||||
customLabelScaleDraw->setMinimumExtent(135.0);
|
||||
|
||||
setAxisScaleDraw(yLeft, customLabelScaleDraw);
|
||||
|
||||
setAxisTitle(xBottom, "Time in ns");
|
||||
setAxisScaleDraw(xBottom, new EngineeringScaleDraw);
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
#include <vector>
|
||||
#include <qwt_plot_marker.h>
|
||||
#include <QAction>
|
||||
#include <QScrollBar>
|
||||
#include <qwt_plot_zoneitem.h>
|
||||
#include "traceplotitem.h"
|
||||
#include "tracenavigator.h"
|
||||
@@ -66,7 +67,7 @@ class TracePlot : public QwtPlot
|
||||
|
||||
public:
|
||||
TracePlot(QWidget *parent = NULL);
|
||||
void init(TraceNavigator *navigator);
|
||||
void init(TraceNavigator *navigator, QScrollBar *scrollBar);
|
||||
Timespan GetCurrentTimespan();
|
||||
traceTime ZoomLevel() const
|
||||
{
|
||||
@@ -80,6 +81,7 @@ public Q_SLOTS:
|
||||
void currentTraceTimeChanged();
|
||||
void selectedTransactionsChanged();
|
||||
void commentsChanged();
|
||||
void verticalScrollbarChanged(int value);
|
||||
|
||||
|
||||
Q_SIGNALS:
|
||||
@@ -113,6 +115,7 @@ private:
|
||||
std::vector<std::shared_ptr<Transaction>> transactions;
|
||||
QueryEditor *queryEditor;
|
||||
QMenu *contextMenu;
|
||||
QScrollBar *scrollBar;
|
||||
|
||||
void setUpTracePlotItem();
|
||||
void setUpDrawingProperties();
|
||||
|
||||
@@ -66,8 +66,11 @@ TraceFileTab::TraceFileTab(QWidget *parent, const QString &path) :
|
||||
|
||||
initNavigatorAndItsDependentWidgets(path);
|
||||
setUpFileWatcher(path);
|
||||
setUpTraceplotScrollbar();
|
||||
|
||||
ui->fileDescriptionEdit->setPlainText(
|
||||
navigator->GeneralTraceInfo().description);
|
||||
|
||||
tracefileChanged();
|
||||
}
|
||||
|
||||
@@ -82,11 +85,24 @@ void TraceFileTab::commitChangesToDB()
|
||||
navigator->commitChangesToDB();
|
||||
}
|
||||
|
||||
void TraceFileTab::setUpTraceplotScrollbar()
|
||||
{
|
||||
unsigned int numberOfBanks = navigator->GeneralTraceInfo().numberOfBanks;
|
||||
unsigned int pageStep = ui->traceplotScrollbar->pageStep();
|
||||
ui->traceplotScrollbar->setMaximum(numberOfBanks + 7 - pageStep);
|
||||
|
||||
if (ui->traceplotScrollbar->maximum() <= 0)
|
||||
ui->traceplotScrollbar->hide();
|
||||
|
||||
QObject::connect(ui->traceplotScrollbar, SIGNAL(valueChanged(int)),
|
||||
ui->traceplot, SLOT(verticalScrollbarChanged(int)));
|
||||
}
|
||||
|
||||
void TraceFileTab::initNavigatorAndItsDependentWidgets(QString path)
|
||||
{
|
||||
navigator = new TraceNavigator(path, this);
|
||||
|
||||
ui->traceplot->init(navigator);
|
||||
ui->traceplot->init(navigator, ui->traceplotScrollbar);
|
||||
|
||||
ui->traceScroller->init(navigator, ui->traceplot);
|
||||
connect(this, SIGNAL(colorGroupingChanged(ColorGrouping)),
|
||||
|
||||
@@ -58,6 +58,7 @@ public:
|
||||
~TraceFileTab();
|
||||
|
||||
void setUpFileWatcher(QString filename);
|
||||
void setUpTraceplotScrollbar();
|
||||
void initNavigatorAndItsDependentWidgets(QString path);
|
||||
QString getPathToTraceFile()
|
||||
{
|
||||
|
||||
@@ -41,27 +41,58 @@
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<widget class="TracePlot" name="traceplot">
|
||||
<widget class="QWidget" name="traceplotContainer" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>3</horstretch>
|
||||
<verstretch>4</verstretch>
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>250</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="TracePlot" name="traceplot">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QScrollBar" name="traceplotScrollbar">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="pageStep">
|
||||
<number>25</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="invertedAppearance">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="invertedControls">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="TraceScroller" name="traceScroller">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>4</horstretch>
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>1</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
|
||||
Reference in New Issue
Block a user