forked from osmocom/wireshark
IO Graphs: Don't show unchecked graphs in legend
Change-Id: I0a9c4d967ee03a0a8dfc93f87dbe38e4e3a0404c Reviewed-on: https://code.wireshark.org/review/10128 Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
This commit is contained in:
parent
75f4ff727d
commit
950f1dde9e
|
@ -684,7 +684,7 @@ void IOGraphDialog::updateLegend()
|
||||||
for (int i = 0; i < ui->graphTreeWidget->topLevelItemCount(); i++) {
|
for (int i = 0; i < ui->graphTreeWidget->topLevelItemCount(); i++) {
|
||||||
QTreeWidgetItem *ti = ui->graphTreeWidget->topLevelItem(i);
|
QTreeWidgetItem *ti = ui->graphTreeWidget->topLevelItem(i);
|
||||||
IOGraph *iog = NULL;
|
IOGraph *iog = NULL;
|
||||||
if (ti) {
|
if (ti && ti->checkState(name_col_) == Qt::Checked) {
|
||||||
iog = ti->data(name_col_, Qt::UserRole).value<IOGraph *>();
|
iog = ti->data(name_col_, Qt::UserRole).value<IOGraph *>();
|
||||||
vu_label_set.insert(iog->valueUnitLabel());
|
vu_label_set.insert(iog->valueUnitLabel());
|
||||||
}
|
}
|
||||||
|
@ -707,7 +707,11 @@ void IOGraphDialog::updateLegend()
|
||||||
IOGraph *iog = NULL;
|
IOGraph *iog = NULL;
|
||||||
if (ti) {
|
if (ti) {
|
||||||
iog = ti->data(name_col_, Qt::UserRole).value<IOGraph *>();
|
iog = ti->data(name_col_, Qt::UserRole).value<IOGraph *>();
|
||||||
iog->addToLegend();
|
if (ti->checkState(name_col_) == Qt::Checked) {
|
||||||
|
iog->addToLegend();
|
||||||
|
} else {
|
||||||
|
iog->removeFromLegend();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
iop->legend->setVisible(true);
|
iop->legend->setVisible(true);
|
||||||
|
@ -1745,6 +1749,17 @@ bool IOGraph::addToLegend()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IOGraph::removeFromLegend()
|
||||||
|
{
|
||||||
|
if (graph_) {
|
||||||
|
return graph_->removeFromLegend();
|
||||||
|
}
|
||||||
|
if (bars_) {
|
||||||
|
return bars_->removeFromLegend();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
double IOGraph::startOffset()
|
double IOGraph::startOffset()
|
||||||
{
|
{
|
||||||
if (graph_ && graph_->keyAxis()->tickLabelType() == QCPAxis::ltDateTime && graph_->data()->size() > 0) {
|
if (graph_ && graph_->keyAxis()->tickLabelType() == QCPAxis::ltDateTime && graph_->data()->size() > 0) {
|
||||||
|
|
|
@ -78,6 +78,7 @@ public:
|
||||||
unsigned int movingAveragePeriod() { return moving_avg_period_; }
|
unsigned int movingAveragePeriod() { return moving_avg_period_; }
|
||||||
void setInterval(int interval);
|
void setInterval(int interval);
|
||||||
bool addToLegend();
|
bool addToLegend();
|
||||||
|
bool removeFromLegend();
|
||||||
QCPGraph *graph() { return graph_; }
|
QCPGraph *graph() { return graph_; }
|
||||||
QCPBars *bars() { return bars_; }
|
QCPBars *bars() { return bars_; }
|
||||||
double startOffset();
|
double startOffset();
|
||||||
|
|
Loading…
Reference in New Issue