mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-05 02:30:44 +00:00
Overview Page Graph Visibility Combo Box
This commit is contained in:
parent
288d6aba3b
commit
30f060c2dc
@ -50,8 +50,8 @@ void gFlagsGroup::SetDay(Day * d)
|
||||
bool e=f->isEmpty();
|
||||
if (!e || f->isAlwaysVisible()) {
|
||||
lvisible.push_back(f);
|
||||
//if (!e)
|
||||
cnt++;
|
||||
if (!e)
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
m_empty=(cnt==0);
|
||||
|
38
overview.cpp
38
overview.cpp
@ -261,6 +261,8 @@ Overview::Overview(QWidget *parent,gGraphView * shared) :
|
||||
|
||||
GraphView->LoadSettings("Overview"); //no trans
|
||||
ui->rangeCombo->setCurrentIndex(6);
|
||||
icon_on=new QIcon(":/icons/session-on.png");
|
||||
icon_off=new QIcon(":/icons/session-off.png");
|
||||
}
|
||||
Overview::~Overview()
|
||||
{
|
||||
@ -268,6 +270,8 @@ Overview::~Overview()
|
||||
disconnect(this,SLOT(dateStart_currentPageChanged(int,int)));
|
||||
disconnect(this,SLOT(dateEnd_currentPageChanged(int,int)));
|
||||
delete ui;
|
||||
delete icon_on;
|
||||
delete icon_off;
|
||||
}
|
||||
gGraph * Overview::createGraph(QString name,QString units, YTickerType yttype)
|
||||
{
|
||||
@ -302,6 +306,22 @@ void Overview::ReloadGraphs()
|
||||
on_rangeCombo_activated(ui->rangeCombo->currentIndex());
|
||||
}
|
||||
|
||||
void Overview::updateGraphCombo()
|
||||
{
|
||||
ui->graphCombo->clear();
|
||||
gGraph *g;
|
||||
for (int i=0;i<GraphView->size();i++) {
|
||||
g=(*GraphView)[i];
|
||||
if (g->isEmpty())
|
||||
continue;
|
||||
if (g->visible()) {
|
||||
ui->graphCombo->addItem(*icon_on,g->title(),true);
|
||||
} else {
|
||||
ui->graphCombo->addItem(*icon_off,g->title(),false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Overview::ResetGraphs()
|
||||
{
|
||||
QDate start=ui->dateStart->date();
|
||||
@ -465,4 +485,22 @@ void Overview::setRange(QDate start, QDate end)
|
||||
ui->dateEnd->blockSignals(false);
|
||||
ui->dateStart->blockSignals(false);
|
||||
this->on_toolButton_clicked();
|
||||
updateGraphCombo();
|
||||
|
||||
}
|
||||
|
||||
void Overview::on_graphCombo_activated(int index)
|
||||
{
|
||||
if (index<0)
|
||||
return;
|
||||
|
||||
bool b=!ui->graphCombo->itemData(index,Qt::UserRole).toBool();
|
||||
ui->graphCombo->setItemData(index,b,Qt::UserRole);
|
||||
if (b) {
|
||||
ui->graphCombo->setItemIcon(index,*icon_on);
|
||||
} else {
|
||||
ui->graphCombo->setItemIcon(index,*icon_off);
|
||||
}
|
||||
(*GraphView)[index]->setVisible(b);
|
||||
GraphView->redraw();
|
||||
}
|
||||
|
@ -64,6 +64,8 @@ public:
|
||||
//! \breif List of SummaryCharts shown on the overview page
|
||||
QVector<SummaryChart *> OverviewCharts;
|
||||
|
||||
void updateGraphCombo();
|
||||
|
||||
public slots:
|
||||
// ! \brief Print button down the bottom, does the same as File->Print
|
||||
//void on_printButton_clicked();
|
||||
@ -96,12 +98,16 @@ private slots:
|
||||
|
||||
void on_rangeCombo_activated(int index);
|
||||
|
||||
void on_graphCombo_activated(int index);
|
||||
|
||||
private:
|
||||
Ui::Overview *ui;
|
||||
gGraphView *GraphView;
|
||||
MyScrollBar *scrollbar;
|
||||
QHBoxLayout *layout;
|
||||
gGraphView * m_shared;
|
||||
QIcon * icon_on;
|
||||
QIcon * icon_off;
|
||||
|
||||
//! \brief Updates the calendar highlighting for the calendar object for this date.
|
||||
void UpdateCalendarDay(QDateEdit * calendar,QDate date);
|
||||
|
11
overview.ui
11
overview.ui
@ -6,7 +6,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>611</width>
|
||||
<width>681</width>
|
||||
<height>392</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -167,6 +167,15 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="graphCombo">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Graphs</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
Loading…
Reference in New Issue
Block a user