mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-07 11:40:42 +00:00
Report layout cleanup
This commit is contained in:
parent
2184da591a
commit
f186771c21
@ -1641,49 +1641,57 @@ short gGraph::marginRight() { return m_marginright; } //*m_graphview->printScale
|
|||||||
short gGraph::marginTop() { return m_margintop; } //*m_graphview->printScaleY(); }
|
short gGraph::marginTop() { return m_margintop; } //*m_graphview->printScaleY(); }
|
||||||
short gGraph::marginBottom() { return m_marginbottom; } //*m_graphview->printScaleY(); }
|
short gGraph::marginBottom() { return m_marginbottom; } //*m_graphview->printScaleY(); }
|
||||||
|
|
||||||
QPixmap gGraph::renderPixmap(int w, int h)
|
QPixmap gGraph::renderPixmap(int w, int h, float scale)
|
||||||
{
|
{
|
||||||
|
|
||||||
gGraphView *sg=mainwin->snapshotGraph();
|
gGraphView *sg=mainwin->snapshotGraph();
|
||||||
if (!sg) return QPixmap();
|
if (!sg) return QPixmap();
|
||||||
|
|
||||||
//double scale=sg->printScaleY(); //sqrt(sg->printScaleX()*sg->printScaleX()+sg->printScaleY()*sg->printScaleY());
|
QFont * _defaultfont=defaultfont;
|
||||||
/*
|
QFont * _mediumfont=mediumfont;
|
||||||
|
QFont * _bigfont=bigfont;
|
||||||
|
|
||||||
|
QFont fa=*defaultfont;
|
||||||
|
QFont fb=*mediumfont;
|
||||||
|
QFont fc=*bigfont;
|
||||||
|
|
||||||
|
sg->setPrintScaleX(scale);
|
||||||
|
sg->setPrintScaleY(scale);
|
||||||
|
|
||||||
fa.setPointSize(fa.pointSize()*scale);
|
fa.setPointSize(fa.pointSize()*scale);
|
||||||
fb.setPointSize(fb.pointSize()*scale);
|
fb.setPointSize(fb.pointSize()*scale);
|
||||||
fc.setPointSize(fc.pointSize()*scale);
|
fc.setPointSize(fc.pointSize()*scale);
|
||||||
|
|
||||||
defaultfont=&fa;
|
defaultfont=&fa;
|
||||||
mediumfont=&fb;
|
mediumfont=&fb;
|
||||||
bigfont=&fc; */
|
bigfont=&fc;
|
||||||
|
|
||||||
sg->hideSplitter();
|
sg->hideSplitter();
|
||||||
gGraphView *tgv=m_graphview;
|
gGraphView *tgv=m_graphview;
|
||||||
m_graphview=sg;
|
m_graphview=sg;
|
||||||
//qint64 rmx=rmin_x,rMx=rmax_x;
|
|
||||||
//qint64 mx=min_x, Mx=max_x;
|
sg->setMinimumSize(w,h);
|
||||||
|
sg->setMaximumSize(w,h);
|
||||||
|
sg->setFixedSize(w,h);
|
||||||
|
|
||||||
float tmp=m_height;
|
float tmp=m_height;
|
||||||
m_height=PROFILE["GraphHeight"].toInt();//*sg->printScaleY();
|
m_height=h; //PROFILE["GraphHeight"].toInt();//*sg->printScaleY();
|
||||||
sg->trashGraphs();
|
sg->trashGraphs();
|
||||||
sg->addGraph(this);
|
sg->addGraph(this);
|
||||||
//sg->ResetBounds();
|
//sg->updateScale();
|
||||||
//sg->SetXBounds(mx,Mx);
|
|
||||||
//sg->updateScrollBar();
|
sg->setScaleY(1.0);
|
||||||
sg->updateScale();
|
|
||||||
|
|
||||||
//QImage image=sg->grabFrameBuffer();
|
|
||||||
//QPixmap pm=QPixmap::fromImage(image);
|
|
||||||
QPixmap pm=sg->renderPixmap(w,h,false);
|
QPixmap pm=sg->renderPixmap(w,h,false);
|
||||||
|
|
||||||
sg->trashGraphs();
|
sg->trashGraphs();
|
||||||
m_graphview=tgv;
|
m_graphview=tgv;
|
||||||
|
|
||||||
m_height=tmp;
|
m_height=tmp;
|
||||||
/*
|
|
||||||
defaultfont=_defaultfont;
|
defaultfont=_defaultfont;
|
||||||
mediumfont=_mediumfont;
|
mediumfont=_mediumfont;
|
||||||
bigfont=_bigfont; */
|
bigfont=_bigfont;
|
||||||
|
|
||||||
return pm;
|
return pm;
|
||||||
}
|
}
|
||||||
|
@ -277,7 +277,7 @@ public:
|
|||||||
virtual ~gGraph();
|
virtual ~gGraph();
|
||||||
void deselect();
|
void deselect();
|
||||||
void Trigger(int ms);
|
void Trigger(int ms);
|
||||||
QPixmap renderPixmap(int width, int height);
|
QPixmap renderPixmap(int width, int height, float fontscale=1.0);
|
||||||
|
|
||||||
void setVisible(bool b) { m_visible=b; }
|
void setVisible(bool b) { m_visible=b; }
|
||||||
bool visible() { return m_visible; }
|
bool visible() { return m_visible; }
|
||||||
@ -422,6 +422,7 @@ public:
|
|||||||
float findTop(gGraph * graph);
|
float findTop(gGraph * graph);
|
||||||
|
|
||||||
float scaleY() { return m_scaleY; }
|
float scaleY() { return m_scaleY; }
|
||||||
|
void setScaleY(float sy) { m_scaleY=sy; }
|
||||||
|
|
||||||
void GetXBounds(qint64 & st,qint64 & et);
|
void GetXBounds(qint64 & st,qint64 & et);
|
||||||
void ResetBounds(bool refresh=true); //short group=0);
|
void ResetBounds(bool refresh=true); //short group=0);
|
||||||
|
@ -209,8 +209,8 @@ void MainWindow::Startup()
|
|||||||
PROFILE.LoadMachineData();
|
PROFILE.LoadMachineData();
|
||||||
|
|
||||||
SnapshotGraph=new gGraphView(this); //daily->graphView());
|
SnapshotGraph=new gGraphView(this); //daily->graphView());
|
||||||
SnapshotGraph->setMaximumSize(1024,512);
|
//SnapshotGraph->setMaximumSize(1024,512);
|
||||||
SnapshotGraph->setMinimumSize(1024,512);
|
//SnapshotGraph->setMinimumSize(1024,512);
|
||||||
SnapshotGraph->hide();
|
SnapshotGraph->hide();
|
||||||
|
|
||||||
daily=new Daily(ui->tabWidget,NULL,this);
|
daily=new Daily(ui->tabWidget,NULL,this);
|
||||||
@ -869,50 +869,24 @@ void MainWindow::PrintReport(gGraphView *gv,QString name, QDate date)
|
|||||||
float lki=cpap->count(CPAP_LeakFlag)/cpap->hours();
|
float lki=cpap->count(CPAP_LeakFlag)/cpap->hours();
|
||||||
float exp=cpap->count(CPAP_ExP)/cpap->hours();
|
float exp=cpap->count(CPAP_ExP)/cpap->hours();
|
||||||
|
|
||||||
|
int piesize=1.5*72.0*vscale;
|
||||||
|
float fscale=font_scale;
|
||||||
|
if (!highres)
|
||||||
|
fscale=1;
|
||||||
|
|
||||||
QString stats;
|
QString stats;
|
||||||
painter.setFont(*mediumfont);
|
painter.setFont(*mediumfont);
|
||||||
stats="AHI\t"+QString::number(ahi,'f',2)+"\n";
|
stats="AHI\t"+QString::number(ahi,'f',2)+"\n";
|
||||||
QRectF bounds=painter.boundingRect(QRectF(0,0,res.width(),0),stats,QTextOption(Qt::AlignRight));
|
QRectF bounds=painter.boundingRect(QRectF(0,0,res.width(),0),stats,QTextOption(Qt::AlignRight));
|
||||||
painter.drawText(bounds,stats,QTextOption(Qt::AlignRight));
|
painter.drawText(bounds,stats,QTextOption(Qt::AlignRight));
|
||||||
|
|
||||||
//if (bounds.height()>maxy) maxy=bounds.height();
|
|
||||||
getDaily()->eventBreakdownPie()->showTitle(false);
|
getDaily()->eventBreakdownPie()->showTitle(false);
|
||||||
int piesize=1.5*72.0*vscale;
|
getDaily()->eventBreakdownPie()->setMargins(0,0,0,0);
|
||||||
mainwin->snapshotGraph()->setMinimumSize(piesize,piesize);
|
QPixmap ebp=getDaily()->eventBreakdownPie()->renderPixmap(piesize,piesize,fscale);
|
||||||
mainwin->snapshotGraph()->setMaximumSize(piesize,piesize);
|
|
||||||
|
|
||||||
QFont * _defaultfont=defaultfont;
|
|
||||||
QFont * _mediumfont=mediumfont;
|
|
||||||
QFont * _bigfont=bigfont;
|
|
||||||
|
|
||||||
QFont fa=*defaultfont;
|
|
||||||
QFont fb=*mediumfont;
|
|
||||||
QFont fc=*bigfont;
|
|
||||||
|
|
||||||
if (!no_scaling ) {
|
|
||||||
|
|
||||||
// fa.setPointSizeF((fa.pointSizeF()/graph_xscale)*2);
|
|
||||||
// fb.setPointSizeF((fb.pointSizeF()/graph_xscale)*2);
|
|
||||||
// fc.setPointSizeF((fc.pointSizeF()/graph_xscale)*2);
|
|
||||||
qDebug() << QApplication::desktop()->physicalDpiX();
|
|
||||||
fa.setPointSizeF(fa.pointSizeF()*font_scale);
|
|
||||||
fb.setPointSizeF(fb.pointSizeF()*font_scale);
|
|
||||||
fc.setPointSizeF(fc.pointSizeF()*font_scale);
|
|
||||||
}
|
|
||||||
|
|
||||||
defaultfont=&fa;
|
|
||||||
mediumfont=&fb;
|
|
||||||
bigfont=&fc;
|
|
||||||
|
|
||||||
QPixmap ebp=getDaily()->eventBreakdownPie()->renderPixmap(piesize,piesize);
|
|
||||||
|
|
||||||
defaultfont=_defaultfont;
|
|
||||||
mediumfont=_mediumfont;
|
|
||||||
bigfont=_bigfont;
|
|
||||||
|
|
||||||
painter.drawPixmap(res.width()-piesize,bounds.height(),piesize,piesize,ebp);
|
painter.drawPixmap(res.width()-piesize,bounds.height(),piesize,piesize,ebp);
|
||||||
getDaily()->eventBreakdownPie()->showTitle(true);
|
getDaily()->eventBreakdownPie()->showTitle(true);
|
||||||
|
|
||||||
|
|
||||||
cpapinfo+="\n\n";
|
cpapinfo+="\n\n";
|
||||||
|
|
||||||
painter.setFont(*defaultfont);
|
painter.setFont(*defaultfont);
|
||||||
@ -967,9 +941,6 @@ void MainWindow::PrintReport(gGraphView *gv,QString name, QDate date)
|
|||||||
}
|
}
|
||||||
top+=maxy;
|
top+=maxy;
|
||||||
|
|
||||||
mainwin->snapshotGraph()->setMinimumSize(gw,gh);
|
|
||||||
mainwin->snapshotGraph()->setMaximumSize(gw,gh);
|
|
||||||
|
|
||||||
bool first=true;
|
bool first=true;
|
||||||
QStringList labels;
|
QStringList labels;
|
||||||
QVector<gGraph *> graphs;
|
QVector<gGraph *> graphs;
|
||||||
@ -1062,49 +1033,25 @@ void MainWindow::PrintReport(gGraphView *gv,QString name, QDate date)
|
|||||||
PROFILE["UseAntiAliasing"]=force_antialiasing;
|
PROFILE["UseAntiAliasing"]=force_antialiasing;
|
||||||
int tmb=g->m_marginbottom;
|
int tmb=g->m_marginbottom;
|
||||||
g->m_marginbottom=0;
|
g->m_marginbottom=0;
|
||||||
float fscale=font_scale*graph_xscale;
|
float fscale=1;
|
||||||
|
if (!no_scaling) fscale=font_scale*graph_xscale;
|
||||||
if (!no_scaling ) {
|
|
||||||
SnapshotGraph->setPrintScaleX(fscale);
|
|
||||||
SnapshotGraph->setPrintScaleY(fscale);
|
|
||||||
}
|
|
||||||
QFont * _defaultfont=defaultfont;
|
|
||||||
QFont * _mediumfont=mediumfont;
|
|
||||||
QFont * _bigfont=bigfont;
|
|
||||||
|
|
||||||
QFont fa=*defaultfont;
|
|
||||||
QFont fb=*mediumfont;
|
|
||||||
QFont fc=*bigfont;
|
|
||||||
|
|
||||||
if (!no_scaling ) {
|
|
||||||
fa.setPointSizeF(fa.pointSizeF()*fscale);
|
|
||||||
fb.setPointSizeF(fb.pointSizeF()*fscale);
|
|
||||||
fc.setPointSizeF(fc.pointSizeF()*fscale);
|
|
||||||
}
|
|
||||||
|
|
||||||
defaultfont=&fa;
|
|
||||||
mediumfont=&fb;
|
|
||||||
bigfont=&fc;
|
|
||||||
|
|
||||||
//g->showTitle(false);
|
//g->showTitle(false);
|
||||||
QPixmap pm=g->renderPixmap(gw,gh);
|
QPixmap pm=g->renderPixmap(gw,gh,fscale);
|
||||||
//g->showTitle(true);
|
//g->showTitle(true);
|
||||||
|
|
||||||
defaultfont=_defaultfont;
|
|
||||||
mediumfont=_mediumfont;
|
|
||||||
bigfont=_bigfont;
|
|
||||||
|
|
||||||
g->m_marginbottom=tmb;
|
g->m_marginbottom=tmb;
|
||||||
PROFILE["UseAntiAliasing"]=aa_setting;
|
PROFILE["UseAntiAliasing"]=aa_setting;
|
||||||
|
QPixmap pm2;
|
||||||
if (!no_scaling) {
|
if (!no_scaling) {
|
||||||
QPixmap pm2=pm.scaledToWidth(printer_width);
|
pm2=pm.scaledToWidth(printer_width);
|
||||||
painter.drawPixmap(0,top,pm2.width(),pm2.height(),pm2);
|
|
||||||
top+=pm2.height();
|
|
||||||
} else {
|
} else {
|
||||||
painter.drawPixmap(0,top,pm.width(),pm.height(),pm);
|
pm2=pm;
|
||||||
top+=gh;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
painter.drawPixmap(0,top,pm2.width(),pm2.height(),pm2);
|
||||||
|
top+=pm2.height();
|
||||||
|
|
||||||
gcnt++;
|
gcnt++;
|
||||||
if (qprogress) {
|
if (qprogress) {
|
||||||
qprogress->setValue(i);
|
qprogress->setValue(i);
|
||||||
|
Loading…
Reference in New Issue
Block a user