mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-07 03:30:44 +00:00
Force redraw on tab change
This commit is contained in:
parent
e27dbb3208
commit
c96a80e237
@ -5,33 +5,57 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <SleepLib/profiles.h>
|
#include <QDateTime>
|
||||||
#include "gBarChart.h"
|
#include "gBarChart.h"
|
||||||
|
|
||||||
gBarChart::gBarChart(ChannelID code,QColor col,Qt::Orientation o)
|
gBarChart::gBarChart(ChannelID code,QColor color,Qt::Orientation o)
|
||||||
:Layer(code),m_orientation(o)
|
:Layer(code),m_orientation(o)
|
||||||
{
|
{
|
||||||
color.clear();
|
//Xaxis=new gXAxis();
|
||||||
color.push_back(col);
|
addGLBuf(quads=new GLBuffer(color,20,GL_QUADS));
|
||||||
|
//addGLBuf(lines=new GLBuffer(col,20,GL_LINES));
|
||||||
|
quads->forceAntiAlias(true);
|
||||||
|
//lines->setAntiAlias(true);
|
||||||
|
//lines->setSize(2);
|
||||||
|
|
||||||
Xaxis=new gXAxis();
|
|
||||||
}
|
}
|
||||||
gBarChart::~gBarChart()
|
gBarChart::~gBarChart()
|
||||||
{
|
{
|
||||||
delete Xaxis;
|
//delete Xaxis;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gBarChart::paint(gGraph & w,int left, int top, int width, int height)
|
void gBarChart::paint(gGraph & w,int left, int top, int width, int height)
|
||||||
{
|
{
|
||||||
if (!m_visible) return;
|
if (!m_visible) return;
|
||||||
|
|
||||||
|
qint64 minx=w.min_x, maxx=w.max_x;
|
||||||
|
qint64 xx=maxx - minx;
|
||||||
|
qint32 days=xx/86400000L;
|
||||||
|
|
||||||
|
float barw=float(width)/float(days);
|
||||||
|
|
||||||
|
qint64 t2,ts;
|
||||||
|
int day;
|
||||||
|
for (QMap<QDate,QVector<Day *> >::iterator d=m_profile->daylist.begin();d!=m_profile->daylist.end();d++) {
|
||||||
|
t2=QDateTime(d.key(),QTime(0,0,0)).toTime_t();
|
||||||
|
ts=t2*1000L;
|
||||||
|
if (ts<minx) continue;
|
||||||
|
if (ts>maxx) continue; // break; // out of order if I end up using a hash instead.??
|
||||||
|
day=t2/86400;
|
||||||
|
float pos=float(day)*barw;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// if (!data) return;
|
// if (!data) return;
|
||||||
//if (!data->IsReady()) return;
|
//if (!data->IsReady()) return;
|
||||||
|
|
||||||
//int start_px=left;
|
//int start_px=left;
|
||||||
//int start_py=top;
|
//int start_py=top;
|
||||||
|
|
||||||
//double xx=w.max_x - w.min_x;
|
|
||||||
//double days=int(xx);
|
|
||||||
//days=data->np[0];
|
//days=data->np[0];
|
||||||
|
|
||||||
//days=0;
|
//days=0;
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#ifndef GBARCHART_H
|
#ifndef GBARCHART_H
|
||||||
#define GBARCHART_H
|
#define GBARCHART_H
|
||||||
|
|
||||||
|
#include <SleepLib/profiles.h>
|
||||||
#include "gGraphView.h"
|
#include "gGraphView.h"
|
||||||
#include "gXAxis.h"
|
#include "gXAxis.h"
|
||||||
|
|
||||||
@ -16,6 +17,7 @@ class gBarChart:public Layer
|
|||||||
gBarChart(ChannelID code=EmptyChannel,QColor col=QColor("blue"),Qt::Orientation o=Qt::Horizontal);
|
gBarChart(ChannelID code=EmptyChannel,QColor col=QColor("blue"),Qt::Orientation o=Qt::Horizontal);
|
||||||
virtual ~gBarChart();
|
virtual ~gBarChart();
|
||||||
|
|
||||||
|
void setProfile(Profile *profile);
|
||||||
virtual void paint(gGraph & w,int left, int top, int width, int height);
|
virtual void paint(gGraph & w,int left, int top, int width, int height);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -30,6 +32,8 @@ class gBarChart:public Layer
|
|||||||
|
|
||||||
gXAxis *Xaxis;
|
gXAxis *Xaxis;
|
||||||
QVector<QColor> color;
|
QVector<QColor> color;
|
||||||
|
Profile * m_profile;
|
||||||
|
GLBuffer *quads;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // GBARCHART_H
|
#endif // GBARCHART_H
|
||||||
|
@ -19,7 +19,7 @@ CONFIG += rtti
|
|||||||
#CONFIG += link_pkgconfig
|
#CONFIG += link_pkgconfig
|
||||||
#PKGCONFIG += freetype2
|
#PKGCONFIG += freetype2
|
||||||
|
|
||||||
TARGET = SleepyHeadQT
|
TARGET = SleepyHead
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
|
|
||||||
|
|
||||||
|
@ -1144,6 +1144,7 @@ void Daily::UpdateOXIGraphs(Day *day)
|
|||||||
|
|
||||||
void Daily::RedrawGraphs()
|
void Daily::RedrawGraphs()
|
||||||
{
|
{
|
||||||
|
GraphView->updateGL();
|
||||||
/*for (int i=0;i<Graphs.size();i++) {
|
/*for (int i=0;i<Graphs.size();i++) {
|
||||||
Graphs[i]->updateGL();
|
Graphs[i]->updateGL();
|
||||||
} */
|
} */
|
||||||
|
@ -274,6 +274,7 @@ void MainWindow::on_urlBar_activated(const QString &arg1)
|
|||||||
void MainWindow::on_dailyButton_clicked()
|
void MainWindow::on_dailyButton_clicked()
|
||||||
{
|
{
|
||||||
ui->tabWidget->setCurrentWidget(daily);
|
ui->tabWidget->setCurrentWidget(daily);
|
||||||
|
daily->RedrawGraphs();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_overviewButton_clicked()
|
void MainWindow::on_overviewButton_clicked()
|
||||||
@ -378,5 +379,6 @@ void MainWindow::on_oximetryButton_clicked()
|
|||||||
{
|
{
|
||||||
if (oximetry) {
|
if (oximetry) {
|
||||||
ui->tabWidget->setCurrentWidget(oximetry);
|
ui->tabWidget->setCurrentWidget(oximetry);
|
||||||
|
oximetry->RedrawGraphs();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user