mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-05 10:40:42 +00:00
Replaced ScrollArea with custom that issues Redraw on Mac
This commit is contained in:
parent
bda318bf73
commit
1655fae05e
@ -1,13 +1,13 @@
|
|||||||
/********************************************************************
|
/*
|
||||||
gFooBar Implementation
|
gFooBar Implementation
|
||||||
Copyright (c)2011 Mark Watkins <jedimark@users.sourceforge.net>
|
Copyright (c)2011 Mark Watkins <jedimark@users.sourceforge.net>
|
||||||
License: GPL
|
License: GPL
|
||||||
*********************************************************************/
|
*/
|
||||||
|
|
||||||
#include "gFooBar.h"
|
#include "gFooBar.h"
|
||||||
|
|
||||||
gFooBar::gFooBar(int offset,QColor handle_color,QColor line_color,bool shadow,QColor shadow_color)
|
gFooBar::gFooBar(int offset,QColor handle_color,QColor line_color,bool shadow,QColor shadow_color)
|
||||||
:gLayer(EmptyChannel),m_offset(offset),m_shadow(shadow),m_handle_color(handle_color),m_line_color(line_color),m_shadow_color(shadow_color)
|
:gLayer(EmptyChannel),m_offset(offset),m_handle_color(handle_color),m_line_color(line_color),m_shadow(shadow),m_shadow_color(shadow_color)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
gFooBar::~gFooBar()
|
gFooBar::~gFooBar()
|
||||||
|
@ -83,10 +83,13 @@ void gLineChart::Plot(gGraphWindow & w,float scrx,float scry)
|
|||||||
EventDataType ymult=EventDataType(height)/yy; // time to pixel conversion multiplier
|
EventDataType ymult=EventDataType(height)/yy; // time to pixel conversion multiplier
|
||||||
|
|
||||||
// Return on screwy min/max conditions
|
// Return on screwy min/max conditions
|
||||||
if ((xx<0) || (yy<0))
|
if (xx<0)
|
||||||
return;
|
|
||||||
if ((yy==0) && (miny==0))
|
|
||||||
return;
|
return;
|
||||||
|
if (yy<=0) {
|
||||||
|
if (miny==0)
|
||||||
|
return;
|
||||||
|
int i=5;
|
||||||
|
}
|
||||||
|
|
||||||
EventDataType lastpx,lastpy;
|
EventDataType lastpx,lastpy;
|
||||||
EventDataType px,py;
|
EventDataType px,py;
|
||||||
@ -161,6 +164,9 @@ void gLineChart::Plot(gGraphWindow & w,float scrx,float scry)
|
|||||||
if (maxx<x0) continue;
|
if (maxx<x0) continue;
|
||||||
if (xL<minx) continue;
|
if (xL<minx) continue;
|
||||||
|
|
||||||
|
if (siz==2) {
|
||||||
|
int i=0;
|
||||||
|
}
|
||||||
if (x0>xL) {
|
if (x0>xL) {
|
||||||
if (siz==2) { // this happens on CPAP
|
if (siz==2) { // this happens on CPAP
|
||||||
quint32 t=el.getTime()[0];
|
quint32 t=el.getTime()[0];
|
||||||
|
@ -32,8 +32,15 @@ void gYAxis::Plot(gGraphWindow &w,float scrx,float scry)
|
|||||||
double maxy=w.max_y;
|
double maxy=w.max_y;
|
||||||
|
|
||||||
double dy=maxy-miny;
|
double dy=maxy-miny;
|
||||||
if (dy<=0)
|
if (dy<=0) {
|
||||||
return;
|
if (miny==0)
|
||||||
|
return;
|
||||||
|
else {
|
||||||
|
miny+=1;
|
||||||
|
maxy-=1;
|
||||||
|
dy=2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int m;
|
int m;
|
||||||
if (maxy>500) {
|
if (maxy>500) {
|
||||||
|
@ -932,7 +932,7 @@ EventDataType gGraphWindow::MinY()
|
|||||||
for (QList<gLayer *>::iterator l=layers.begin();l!=layers.end();l++) {
|
for (QList<gLayer *>::iterator l=layers.begin();l!=layers.end();l++) {
|
||||||
if ((*l)->isEmpty()) continue;
|
if ((*l)->isEmpty()) continue;
|
||||||
tmp=(*l)->Miny();
|
tmp=(*l)->Miny();
|
||||||
if (tmp==(*l)->Maxy()) continue;
|
if (tmp==0 && tmp==(*l)->Maxy()) continue;
|
||||||
if (first) {
|
if (first) {
|
||||||
val=tmp;
|
val=tmp;
|
||||||
first=false;
|
first=false;
|
||||||
@ -949,7 +949,7 @@ EventDataType gGraphWindow::MaxY()
|
|||||||
for (QList<gLayer *>::iterator l=layers.begin();l!=layers.end();l++) {
|
for (QList<gLayer *>::iterator l=layers.begin();l!=layers.end();l++) {
|
||||||
if ((*l)->isEmpty()) continue;
|
if ((*l)->isEmpty()) continue;
|
||||||
tmp=(*l)->Maxy();
|
tmp=(*l)->Maxy();
|
||||||
if (tmp==(*l)->Miny()) continue;
|
if (tmp==0 && tmp==(*l)->Miny()) continue;
|
||||||
if (first) {
|
if (first) {
|
||||||
val=tmp;
|
val=tmp;
|
||||||
first=false;
|
first=false;
|
||||||
|
43
daily.cpp
43
daily.cpp
@ -29,7 +29,8 @@
|
|||||||
const int min_height=150;
|
const int min_height=150;
|
||||||
const int default_height=150;
|
const int default_height=150;
|
||||||
|
|
||||||
MyScrollArea::MyScrollArea(Daily * parent)
|
MyScrollArea::MyScrollArea(QWidget *parent, Daily * daily)
|
||||||
|
:QScrollArea(parent),m_daily(daily)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
MyScrollArea::~MyScrollArea()
|
MyScrollArea::~MyScrollArea()
|
||||||
@ -37,6 +38,10 @@ MyScrollArea::~MyScrollArea()
|
|||||||
}
|
}
|
||||||
void MyScrollArea::scrollContentsBy(int dx, int dy)
|
void MyScrollArea::scrollContentsBy(int dx, int dy)
|
||||||
{
|
{
|
||||||
|
QScrollArea::scrollContentsBy(dx,dy);
|
||||||
|
#ifdef Q_WS_MAC
|
||||||
|
m_daily->RedrawGraphs();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
Daily::Daily(QWidget *parent,QGLWidget * shared, MainWindow *mw)
|
Daily::Daily(QWidget *parent,QGLWidget * shared, MainWindow *mw)
|
||||||
@ -51,18 +56,25 @@ Daily::Daily(QWidget *parent,QGLWidget * shared, MainWindow *mw)
|
|||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//scrollArea=new MyScrollArea(this);
|
|
||||||
|
|
||||||
|
scrollArea=new MyScrollArea(ui->graphMainArea,this);
|
||||||
|
ui->graphLayout->addWidget(scrollArea,1);
|
||||||
|
|
||||||
|
scrollArea->setWidgetResizable(true);
|
||||||
|
//QVBoxLayout *lay=new QVBoxLayout(scrollArea);
|
||||||
|
//scrollArea->setWidget(lay);
|
||||||
|
GraphLayout=new QWidget(scrollArea);
|
||||||
|
scrollArea->setWidget(GraphLayout);
|
||||||
|
|
||||||
|
//lay->addWidget(GraphLayout,1);
|
||||||
//ui->webView->setStyleSheet("QWebView { background-color: qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5, stop: 0 #FF92BB, stop: 1 white); }");
|
//ui->webView->setStyleSheet("QWebView { background-color: qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5, stop: 0 #FF92BB, stop: 1 white); }");
|
||||||
//ui->treeWidget->setAlternatingRowColors(true);
|
//ui->treeWidget->setAlternatingRowColors(true);
|
||||||
GraphLayout=new QWidget();
|
|
||||||
ui->graphSizer->addWidget(GraphLayout,1);
|
|
||||||
|
|
||||||
ui->graphSizer->setMargin(0);
|
|
||||||
ui->graphSizer->setContentsMargins(0,0,0,0);
|
|
||||||
splitter=new QVBoxLayout(GraphLayout);
|
splitter=new QVBoxLayout(GraphLayout);
|
||||||
|
GraphLayout->setLayout(splitter);
|
||||||
splitter->setMargin(0);
|
splitter->setMargin(0);
|
||||||
splitter->setContentsMargins(0,0,0,0);
|
splitter->setContentsMargins(0,0,0,0);
|
||||||
|
|
||||||
|
//ui->splitter->layout();
|
||||||
//gSplitter(Qt::Vertical,ui->scrollArea);
|
//gSplitter(Qt::Vertical,ui->scrollArea);
|
||||||
//splitter->setStyleSheet("QSplitter::handle { background-color: 'light grey'; }");
|
//splitter->setStyleSheet("QSplitter::handle { background-color: 'light grey'; }");
|
||||||
//splitter->setHandleWidth(3);
|
//splitter->setHandleWidth(3);
|
||||||
@ -70,20 +82,19 @@ Daily::Daily(QWidget *parent,QGLWidget * shared, MainWindow *mw)
|
|||||||
//splitter->setOpaqueResize(false);
|
//splitter->setOpaqueResize(false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ui->scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
||||||
ui->scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
//ui->scrollArea->setWidget(splitter);
|
//ui->scrollArea->setWidget(splitter);
|
||||||
//this->connect(ui->scrollArea,
|
//this->connect(ui->scrollArea,
|
||||||
//ui->graphSizer->addWidget(splitter);
|
//ui->graphSizer->addWidget(splitter);
|
||||||
ui->scrollArea->setAutoFillBackground(false);
|
scrollArea->setAutoFillBackground(false);
|
||||||
//splitter->setAutoFillBackground(false);
|
//splitter->setAutoFillBackground(false);
|
||||||
ui->scrollArea->setWidgetResizable(true);
|
|
||||||
|
|
||||||
|
|
||||||
//splitter->setMinimumHeight(1600);
|
//splitter->setMinimumHeight(1600);
|
||||||
//splitter->setMinimumWidth(600);
|
//splitter->setMinimumWidth(600);
|
||||||
|
|
||||||
QWidget * parental=ui->scrollArea;
|
QWidget * parental=GraphLayout;
|
||||||
SF=new gGraphWindow(parental,tr("Event Flags"),shared);
|
SF=new gGraphWindow(parental,tr("Event Flags"),shared);
|
||||||
FRW=new gGraphWindow(parental,tr("Flow Rate"),SF);
|
FRW=new gGraphWindow(parental,tr("Flow Rate"),SF);
|
||||||
PRD=new gGraphWindow(parental,tr("Pressure"),SF);
|
PRD=new gGraphWindow(parental,tr("Pressure"),SF);
|
||||||
@ -337,7 +348,7 @@ Daily::Daily(QWidget *parent,QGLWidget * shared, MainWindow *mw)
|
|||||||
//OF->LinkZoom(SPO2);
|
//OF->LinkZoom(SPO2);
|
||||||
|
|
||||||
// AddGraph(SPO2);
|
// AddGraph(SPO2);
|
||||||
spacer=new gGraphWindow(ui->scrollArea,"",SF);
|
spacer=new gGraphWindow(scrollArea,"",SF);
|
||||||
spacer->setMinimumHeight(1);
|
spacer->setMinimumHeight(1);
|
||||||
spacer->setMaximumHeight(1);
|
spacer->setMaximumHeight(1);
|
||||||
splitter->addWidget(spacer);
|
splitter->addWidget(spacer);
|
||||||
@ -599,7 +610,7 @@ void Daily::Load(QDate date)
|
|||||||
} else {
|
} else {
|
||||||
NoData->hide();
|
NoData->hide();
|
||||||
int vis=0;
|
int vis=0;
|
||||||
ui->scrollArea->setUpdatesEnabled(false);
|
scrollArea->setUpdatesEnabled(false);
|
||||||
for (int i=0;i<Graphs.size();i++) {
|
for (int i=0;i<Graphs.size();i++) {
|
||||||
Graphs[i]->setUpdatesEnabled(false);
|
Graphs[i]->setUpdatesEnabled(false);
|
||||||
if (Graphs[i]->isEmpty()) {
|
if (Graphs[i]->isEmpty()) {
|
||||||
@ -641,8 +652,8 @@ void Daily::Load(QDate date)
|
|||||||
// splitter->blockSignals(true);
|
// splitter->blockSignals(true);
|
||||||
|
|
||||||
splitter->layout();
|
splitter->layout();
|
||||||
ui->scrollArea->setUpdatesEnabled(true);
|
scrollArea->setUpdatesEnabled(true);
|
||||||
ui->scrollArea->update();
|
scrollArea->update();
|
||||||
//ui->scrollArea->update();
|
//ui->scrollArea->update();
|
||||||
//splitter->layout();
|
//splitter->layout();
|
||||||
|
|
||||||
|
4
daily.h
4
daily.h
@ -30,11 +30,11 @@ class Daily;
|
|||||||
class MyScrollArea:public QScrollArea
|
class MyScrollArea:public QScrollArea
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MyScrollArea(Daily * parent);
|
MyScrollArea(QWidget * parent, Daily * daily);
|
||||||
virtual ~MyScrollArea();
|
virtual ~MyScrollArea();
|
||||||
protected:
|
protected:
|
||||||
virtual void scrollContentsBy(int dx, int dy);
|
virtual void scrollContentsBy(int dx, int dy);
|
||||||
Daily *daily;
|
Daily *m_daily;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
|
48
daily.ui
48
daily.ui
@ -20,20 +20,8 @@
|
|||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<property name="spacing">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="margin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QSplitter" name="splitter_2">
|
<widget class="QSplitter" name="splitter_2">
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
@ -481,35 +469,15 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QScrollArea" name="scrollArea">
|
<widget class="QWidget" name="graphMainArea" native="true">
|
||||||
<property name="widgetResizable">
|
<layout class="QVBoxLayout" name="graphLayout">
|
||||||
<bool>true</bool>
|
<property name="spacing">
|
||||||
</property>
|
<number>0</number>
|
||||||
<widget class="QWidget" name="scrollAreaStuff">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>763</width>
|
|
||||||
<height>620</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_12">
|
<property name="margin">
|
||||||
<property name="spacing">
|
<number>0</number>
|
||||||
<number>0</number>
|
</property>
|
||||||
</property>
|
</layout>
|
||||||
<property name="margin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<layout class="QVBoxLayout" name="graphSizer">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
Loading…
Reference in New Issue
Block a user