From 8ed00152798954ece1090a71fec969ab69d7b37e Mon Sep 17 00:00:00 2001 From: Mark Watkins Date: Sat, 20 Aug 2011 16:27:06 +1000 Subject: [PATCH 1/7] Attempt to turn on apple GL refresh --- Graphs/graphwindow.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Graphs/graphwindow.cpp b/Graphs/graphwindow.cpp index 9c634b31..bcf9b40b 100644 --- a/Graphs/graphwindow.cpp +++ b/Graphs/graphwindow.cpp @@ -8,6 +8,11 @@ #include #include #include + +#ifdef __APPLE__ +#include +#endif + #include "SleepLib/profiles.h" #include "graphwindow.h" #include "gTitle.h" @@ -808,6 +813,7 @@ void gGraphWindow::initializeGL() } +bool first_draw_event=true; void gGraphWindow::resizeGL(int w, int h) { m_scrX=w; @@ -868,11 +874,16 @@ void gGraphWindow::Render(int w, int h) void gGraphWindow::paintGL() { - if (m_scrX<=0) m_scrX=width(); if (m_scrY<=0) m_scrY=height(); if (m_scrX<=0) return; if (m_scrY<=0) return; +#ifdef __APPLE__ + AGLContext aglContext; + aglContext=aglGetCurrentContext(); + GLint swapInt=1; + aglSetInteger(aglContext, AGL_SWAP_INTERVAL, &swapInt); +#endif //glDisable(GL_DEPTH_TEST); Render(m_scrX,m_scrY); From 19723b3858210c845960e8dab0fd41c33e5a8277 Mon Sep 17 00:00:00 2001 From: Mark Watkins Date: Sat, 20 Aug 2011 16:47:34 +1000 Subject: [PATCH 2/7] Another GL sync test --- Graphs/graphwindow.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Graphs/graphwindow.cpp b/Graphs/graphwindow.cpp index bcf9b40b..13d10683 100644 --- a/Graphs/graphwindow.cpp +++ b/Graphs/graphwindow.cpp @@ -811,6 +811,12 @@ void gGraphWindow::initializeGL() m_scrX=width(); m_scrY=height(); + QGLFormat glFormat(QGL::SampleBuffers); + glFormat.setAlpha(true); + glFormat.setDirectRendering(true); + glFormat.setSwapInterval(1); + setFormat(glFormat); + } bool first_draw_event=true; From c8ad0888ff829474bc58bb9e6d514d22a9bccf7a Mon Sep 17 00:00:00 2001 From: Mark Watkins Date: Sat, 20 Aug 2011 16:55:47 +1000 Subject: [PATCH 3/7] Rolled back the most recent GL sync method --- Graphs/graphwindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Graphs/graphwindow.cpp b/Graphs/graphwindow.cpp index 13d10683..71ff09c7 100644 --- a/Graphs/graphwindow.cpp +++ b/Graphs/graphwindow.cpp @@ -811,11 +811,11 @@ void gGraphWindow::initializeGL() m_scrX=width(); m_scrY=height(); - QGLFormat glFormat(QGL::SampleBuffers); + /*QGLFormat glFormat(QGL::SampleBuffers); glFormat.setAlpha(true); glFormat.setDirectRendering(true); glFormat.setSwapInterval(1); - setFormat(glFormat); + setFormat(glFormat);*/ } From 07daf28418a4f748601f157c682fc64c1ff4b113 Mon Sep 17 00:00:00 2001 From: Mark Watkins Date: Sat, 20 Aug 2011 17:38:50 +1000 Subject: [PATCH 4/7] ScrollArea Palette & AutoFillBackground test --- daily.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/daily.cpp b/daily.cpp index 64a84b5b..96c0e31a 100644 --- a/daily.cpp +++ b/daily.cpp @@ -8,6 +8,7 @@ #include "ui_daily.h" #include +#include #include #include #include @@ -77,12 +78,16 @@ Daily::Daily(QWidget *parent,QGLWidget * shared, MainWindow *mw) scrollArea=new MyScrollArea(ui->graphMainArea,this); + QPalette p; + p.setColor(QPalette::Window,Qt::white); + scrollArea->setPalette(p); + scrollArea->setBackgroundRole(QPalette::Window); ui->graphLayout->addWidget(scrollArea,1); ui->graphLayout->setSpacing(0); ui->graphLayout->setMargin(0); ui->graphLayout->setContentsMargins(0,0,0,0); scrollArea->setWidgetResizable(true); - scrollArea->setAutoFillBackground(false); + scrollArea->setAutoFillBackground(true); GraphLayout=new QWidget(scrollArea); GraphLayout->setAutoFillBackground(false); From 779b76db5062dddd1f90c87983d6625ba89d8055 Mon Sep 17 00:00:00 2001 From: Mark Watkins Date: Sat, 20 Aug 2011 17:41:56 +1000 Subject: [PATCH 5/7] More AutoFillBackground test --- daily.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/daily.cpp b/daily.cpp index 96c0e31a..2c5cfca8 100644 --- a/daily.cpp +++ b/daily.cpp @@ -90,7 +90,9 @@ Daily::Daily(QWidget *parent,QGLWidget * shared, MainWindow *mw) scrollArea->setAutoFillBackground(true); GraphLayout=new QWidget(scrollArea); - GraphLayout->setAutoFillBackground(false); + GraphLayout->setAutoFillBackground(true); + GraphLayout->setPalette(p); + GraphLayout->setBackgroundRole(QPalette::Window); scrollArea->setWidget(GraphLayout); splitter=new QVBoxLayout(GraphLayout); From 1ce315e9224bad4d69b8666e7469119e8b426a42 Mon Sep 17 00:00:00 2001 From: Mark Watkins Date: Sat, 20 Aug 2011 18:20:22 +1000 Subject: [PATCH 6/7] More ScrollArea hacks --- daily.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/daily.cpp b/daily.cpp index 2c5cfca8..095645c3 100644 --- a/daily.cpp +++ b/daily.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include "SleepLib/session.h" #include "Graphs/graphdata_custom.h" @@ -43,15 +44,17 @@ MyScrollArea::~MyScrollArea() void MyScrollArea::scrollContentsBy(int dx, int dy) { QScrollArea::scrollContentsBy(dx,dy); + widget()->repaint(horizontalScrollBar()->value(), verticalScrollBar()->value(), width(), height()); + //m_daily->RedrawGraphs(); //gGraphWindow g; #ifdef Q_WS_MAC - if (timer->isActive()) timer->stop(); + /*if (timer->isActive()) timer->stop(); timer->setSingleShot(true); timer->setInterval(200); connect(timer,SIGNAL(timeout()),SLOT(UpdateGraphs())); timer->start(); - m_time.start(); + m_time.start(); */ //m_daily->RedrawGraphs(); #endif } From 70c348c1e196c10bbd34b1ce73bce9dda7fdbd29 Mon Sep 17 00:00:00 2001 From: Mark Watkins Date: Sat, 20 Aug 2011 18:40:03 +1000 Subject: [PATCH 7/7] MainView Tab widget AutoFillBackground --- mainwindow.ui | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mainwindow.ui b/mainwindow.ui index 0038b4a1..f56702c7 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -73,6 +73,9 @@ 16777215 + + true + QTabWidget::North