diff --git a/Graphs/gFooBar.h b/Graphs/gFooBar.h index cbf4e680..1115c991 100644 --- a/Graphs/gFooBar.h +++ b/Graphs/gFooBar.h @@ -18,10 +18,10 @@ class gFooBar:public gLayer static const int Margin=15; protected: int m_offset; - QColor m_line_color; QColor m_handle_color; - QColor m_shadow_color; + QColor m_line_color; bool m_shadow; + QColor m_shadow_color; }; #endif // GFOOBAR_H diff --git a/Graphs/gSplitter.cpp b/Graphs/gSplitter.cpp index cac671dc..5a55d46b 100644 --- a/Graphs/gSplitter.cpp +++ b/Graphs/gSplitter.cpp @@ -28,12 +28,12 @@ void gSplitter::mySplitterMoved (int pos, int index) if (z_timer->isActive()) z_timer->stop(); z_pos=pos; z_index=index; - this->setUpdatesEnabled(true); + //this->setUpdatesEnabled(true); if (gGraphWindow *w=qobject_cast(widget(index-1))) { int s=sizes().at(index-1); - w->updateGL(); //w->resizeGL(w->width(),pos); //w->updateGL(); + //w->updateGL(); //w->paintGL(); } if (gGraphWindow *w=qobject_cast(widget(index))) { @@ -45,7 +45,6 @@ void gSplitter::mySplitterMoved (int pos, int index) qDebug() << ++icnt; z_timer->singleShot(50,this,SLOT(doUpdateGraph())); tm.start(); - this->setUpdatesEnabled(false); } void gSplitter::doUpdateGraph() @@ -53,13 +52,25 @@ void gSplitter::doUpdateGraph() if (tm.elapsed()<50) return; + //this->setUpdatesEnabled(true); + if (gGraphWindow *w=qobject_cast(widget(z_index-1))) { + //qDebug() << icnt << "Height" << w->height() << z_index << z_pos << w->Title(); + + int s=sizes().at(z_index-1); + + QSize n(w->width(),s); + QSize o(w->width(),s); + //QResizeEvent e(n,o); + //w->resizeEvent(&e); + //w->resizeGL(w->width(),s); + //w->paintGL(); + } if (gGraphWindow *w=qobject_cast(widget(z_index))) { qDebug() << icnt << "Height" << w->height() << z_index << z_pos << w->Title(); int s=sizes().at(z_index); - this->setUpdatesEnabled(true); w->resizeGL(w->width(),s); w->paintGL(); } diff --git a/Graphs/graphwindow.cpp b/Graphs/graphwindow.cpp index 280d7b5c..f6133d59 100644 --- a/Graphs/graphwindow.cpp +++ b/Graphs/graphwindow.cpp @@ -313,7 +313,8 @@ void gGraphWindow::mouseMoveEvent(QMouseEvent * event) int i=splitter->indexOf(this); if (icount()-2) { splitter->insertWidget(i+1,this); - + splitter->setStretchFactor(this,1); + splitter->layout(); } } else if (event->y()<0) { @@ -321,6 +322,8 @@ void gGraphWindow::mouseMoveEvent(QMouseEvent * event) int i=splitter->indexOf(this); if (i>0) { splitter->insertWidget(i-1,this); + splitter->setStretchFactor(this,1); + splitter->layout(); } } } diff --git a/Graphs/graphwindow.h b/Graphs/graphwindow.h index b69d3eb6..5f66e781 100644 --- a/Graphs/graphwindow.h +++ b/Graphs/graphwindow.h @@ -7,6 +7,7 @@ #ifndef GRAPHWINDOW_H #define GRAPHWINDOW_H +#include #include #include #include @@ -130,14 +131,14 @@ public: void SetGradientBackground(bool b) { m_gradient_background=b; } bool GradientBackground() { return m_gradient_background; } bool isEmpty(); - void SetSplitter(QSplitter *s) { splitter=s; } + void SetSplitter(QVBoxLayout *s) { splitter=s; } bool isDraggingGraph() { return m_dragGraph; } void setScry(int h) { m_scrY=h; } protected: void updateSelectionTime(qint64 span); //virtual void resizeEvent(QResizeEvent *); void initializeGL(); - QSplitter *splitter; + QVBoxLayout *splitter; QListlink_zoom; bool m_block_zoom; diff --git a/daily.cpp b/daily.cpp index be8939db..565d1e3e 100644 --- a/daily.cpp +++ b/daily.cpp @@ -26,7 +26,7 @@ #include "Graphs/gBarChart.h" #include "Graphs/gSegmentChart.h" -const int min_height=100; +const int min_height=150; const int default_height=150; MyScrollArea::MyScrollArea(Daily * parent) @@ -53,38 +53,40 @@ Daily::Daily(QWidget *parent,QGLWidget * shared, MainWindow *mw) //scrollArea=new MyScrollArea(this); - splitter=new gSplitter(Qt::Vertical,ui->scrollArea); - splitter->setStyleSheet("QSplitter::handle { background-color: 'light grey'; }"); - splitter->setHandleWidth(3); + splitter=ui->graphSizer; + //gSplitter(Qt::Vertical,ui->scrollArea); + //splitter->setStyleSheet("QSplitter::handle { background-color: 'light grey'; }"); + //splitter->setHandleWidth(3); #ifdef Q_WS_MAC - splitter->setOpaqueResize(false); + //splitter->setOpaqueResize(false); #endif ui->scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); ui->scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - ui->scrollArea->setWidget(splitter); + //ui->scrollArea->setWidget(splitter); //this->connect(ui->scrollArea, //ui->graphSizer->addWidget(splitter); ui->scrollArea->setAutoFillBackground(false); - splitter->setAutoFillBackground(false); + //splitter->setAutoFillBackground(false); ui->scrollArea->setWidgetResizable(true); //splitter->setMinimumHeight(1600); //splitter->setMinimumWidth(600); - SF=new gGraphWindow(splitter,tr("Event Flags"),shared); - FRW=new gGraphWindow(splitter,tr("Flow Rate"),SF); - PRD=new gGraphWindow(splitter,tr("Pressure"),SF); - LEAK=new gGraphWindow(splitter,tr("Leaks"),SF); - MP=new gGraphWindow(splitter,tr("Mask Pressure"),SF); - SNORE=new gGraphWindow(splitter,tr("Snore"),SF); - FLG=new gGraphWindow(splitter,tr("Flow Limitation"),SF); - MV=new gGraphWindow(splitter,tr("Minute Ventilation"),SF); - TV=new gGraphWindow(splitter,tr("Tidal Volume"),SF); - RR=new gGraphWindow(splitter,tr("Respiratory Rate"),SF); - PTB=new gGraphWindow(splitter,tr("Patient Trig Breaths"),SF); - //OF=new gGraphWindow(splitter,tr("Oxi-Flags"),SF); - PULSE=new gGraphWindow(splitter,tr("Pulse"),SF); - SPO2=new gGraphWindow(splitter,tr("SPO2"),SF); + QWidget * parental=ui->scrollArea; + SF=new gGraphWindow(parental,tr("Event Flags"),shared); + FRW=new gGraphWindow(parental,tr("Flow Rate"),SF); + PRD=new gGraphWindow(parental,tr("Pressure"),SF); + LEAK=new gGraphWindow(parental,tr("Leaks"),SF); + MP=new gGraphWindow(parental,tr("Mask Pressure"),SF); + SNORE=new gGraphWindow(parental,tr("Snore"),SF); + FLG=new gGraphWindow(parental,tr("Flow Limitation"),SF); + MV=new gGraphWindow(parental,tr("Minute Ventilation"),SF); + TV=new gGraphWindow(parental,tr("Tidal Volume"),SF); + RR=new gGraphWindow(parental,tr("Respiratory Rate"),SF); + PTB=new gGraphWindow(parental,tr("Patient Trig Breaths"),SF); + //OF=new gGraphWindow(parental,tr("Oxi-Flags"),SF); + PULSE=new gGraphWindow(parental,tr("Pulse"),SF); + SPO2=new gGraphWindow(parental,tr("SPO2"),SF); TAP=new gGraphWindow(NULL,"",(QGLWidget* )NULL); TAP_EAP=new gGraphWindow(NULL,"",(QGLWidget* )NULL); @@ -261,7 +263,7 @@ Daily::Daily(QWidget *parent,QGLWidget * shared, MainWindow *mw) G_AHI->SetGradientBackground(false); G_AHI->hide(); - NoData=new QLabel(tr("No data"),splitter); + NoData=new QLabel(tr("No data"),parental); NoData->setAlignment(Qt::AlignCenter); QFont font("FreeSans",20); //NoData->font(); //font.setBold(true); @@ -269,8 +271,8 @@ Daily::Daily(QWidget *parent,QGLWidget * shared, MainWindow *mw) NoData->hide(); splitter->addWidget(NoData); - int i=splitter->indexOf(NoData); - splitter->setStretchFactor(i,1); + //int i=splitter->indexOf(NoData); + splitter->setStretchFactor(NoData,1); gGraphWindow * graphs[]={SF,FRW,MP,MV,TV,PTB,RR,PRD,LEAK,FLG,SNORE}; int ss=sizeof(graphs)/sizeof(gGraphWindow *); @@ -278,7 +280,7 @@ Daily::Daily(QWidget *parent,QGLWidget * shared, MainWindow *mw) for (int i=0;iindexOf(graphs[i]); - //splitter->setStretchFactor(j,1); + splitter->setStretchFactor(graphs[i],1); for (int j=0;jLinkZoom(graphs[j]); @@ -308,11 +310,11 @@ Daily::Daily(QWidget *parent,QGLWidget * shared, MainWindow *mw) //splitter->refresh(); - splitter->setChildrenCollapsible(false); // We set this per widget.. + //splitter->setChildrenCollapsible(false); // We set this per widget.. //splitter->setCollapsible(splitter->indexOf(SF),false); //splitter->setStretchFactor(splitter->indexOf(SF),0); - splitter_sizes=splitter->sizes(); + //splitter_sizes=splitter->sizes(); splitter->layout(); splitter->update(); @@ -344,7 +346,7 @@ Daily::~Daily() if (previous_date.isValid()) Unload(previous_date); - delete splitter; +// delete splitter; delete ui; } void Daily::AddGraph(gGraphWindow *w) @@ -489,7 +491,7 @@ void Daily::on_calendar_selectionChanged() } void Daily::ResetGraphLayout() { - splitter->setSizes(splitter_sizes); + //splitter->setSizes(splitter_sizes); } void Daily::ShowHideGraphs() @@ -510,7 +512,7 @@ void Daily::ShowHideGraphs() } } } - splitter->setMinimumHeight(vis*default_height); + //splitter->setMinimumHeight(vis*default_height); //splitter->setMaximumHeight(vis*default_height); splitter->layout(); splitter->update(); @@ -544,7 +546,7 @@ void Daily::Load(QDate date) UpdateEventsTree(ui->treeWidget,cpap); if (!cpap && !oxi) { - splitter->setMinimumHeight(0); + //splitter->setMinimumHeight(0); NoData->setText(tr("No data for ")+date.toString(Qt::SystemLocaleLongDate)); NoData->show(); for (int i=0;ihide(); } //splitter->setMinimumHeight(0); - splitter->setMinimumHeight(vis*default_height); + //splitter->setMinimumHeight(vis*default_height); //if (vis>4) { //splitter->setMaximumHeight(vis*default_height); //} //else { diff --git a/daily.h b/daily.h index ef439029..f4683cef 100644 --- a/daily.h +++ b/daily.h @@ -101,7 +101,7 @@ private: Profile *profile; QDate previous_date; MyScrollArea *scrollArea; - gSplitter *splitter; + QVBoxLayout *splitter; QLabel *NoData; QWidget *spacer; QMenu *show_graph_menu; diff --git a/oximetry.cpp b/oximetry.cpp index 3543e9b0..c2f70136 100644 --- a/oximetry.cpp +++ b/oximetry.cpp @@ -41,10 +41,11 @@ Oximetry::Oximetry(QWidget *parent,QGLWidget * shared) : session=new Session(mach,0); day->AddSession(session); - gSplitter=new QSplitter(Qt::Vertical,ui->scrollArea); - gSplitter->setStyleSheet("QSplitter::handle { background-color: 'dark grey'; }"); - gSplitter->setHandleWidth(2); - ui->graphLayout->addWidget(gSplitter); + splitter=ui->graphLayout; + //splitter=new QSplitter(Qt::Vertical,ui->scrollArea); + //gSplitter->setStyleSheet("QSplitter::handle { background-color: 'dark grey'; }"); + //gSplitter->setHandleWidth(2); + //ui->graphLayout->addWidget(splitter); // Create the Event Lists to store / import data ev_plethy=new EventList(OXI_Plethysomogram,EVL_Event,1,0,0,0,1000.0/50.0); @@ -56,16 +57,17 @@ Oximetry::Oximetry(QWidget *parent,QGLWidget * shared) : ev_spo2=new EventList(OXI_SPO2,EVL_Event,1); session->eventlist[OXI_SPO2].push_back(ev_spo2); + QWidget * parental=ui->scrollArea; plethy=new gLineChart(OXI_Plethysomogram,Qt::black,false,true); - AddGraph(PLETHY=new gGraphWindow(gSplitter,tr("Plethysomogram"),shared)); + AddGraph(PLETHY=new gGraphWindow(parental,tr("Plethysomogram"),shared)); plethy->SetDay(day); pulse=new gLineChart(OXI_Pulse,Qt::red,true); - AddGraph(PULSE=new gGraphWindow(gSplitter,tr("Pulse Rate"),shared)); + AddGraph(PULSE=new gGraphWindow(parental,tr("Pulse Rate"),shared)); pulse->SetDay(day); spo2=new gLineChart(OXI_SPO2,Qt::blue,true); - AddGraph(SPO2=new gGraphWindow(gSplitter,tr("SPO2"),shared)); + AddGraph(SPO2=new gGraphWindow(parental,tr("SPO2"),shared)); spo2->SetDay(day); for (int i=0;iAddLayer(new gXAxis()); //Graphs[i]->AddLayer(new gFooBar()); - gSplitter->addWidget(Graphs[i]); + splitter->addWidget(Graphs[i]); } PLETHY->AddLayer(plethy); PLETHY->AddLayer(new gFooBar()); @@ -86,7 +88,7 @@ Oximetry::Oximetry(QWidget *parent,QGLWidget * shared) : for (int i=0;isetMinimumHeight(150); - Graphs[i]->SetSplitter(gSplitter); + Graphs[i]->SetSplitter(splitter); } on_RefreshPortsButton_clicked(); diff --git a/oximetry.h b/oximetry.h index 53f53acb..adce8272 100644 --- a/oximetry.h +++ b/oximetry.h @@ -49,7 +49,7 @@ private: Ui::Oximetry *ui; Profile *profile; - QSplitter *gSplitter; + QVBoxLayout *splitter; gLineChart *pulse,*spo2,*plethy; gGraphWindow *PULSE,*SPO2,*PLETHY;