Skip to content

Commit

Permalink
ENH: Use newer QOpenGLWidget instead of QOGLWidget
Browse files Browse the repository at this point in the history
  • Loading branch information
LorenzE committed May 21, 2020
1 parent 1b211c5 commit 64e10d1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
5 changes: 5 additions & 0 deletions applications/mne_analyze/mne_analyze/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
#include <QApplication>
#include <QFontDatabase>
#include <QtPlugin>
#include <QSurfaceFormat>

//=============================================================================================================
// USED NAMESPACES
Expand Down Expand Up @@ -88,6 +89,10 @@ int main(int argc, char *argv[])
QCoreApplication::setOrganizationName(CInfo::OrganizationName());
QCoreApplication::setApplicationName(CInfo::AppNameShort());

QSurfaceFormat fmt;
fmt.setSamples(4);
QSurfaceFormat::setDefaultFormat(fmt);

//New main window instance
pAnalyzeCore = new AnalyzeCore();
pAnalyzeCore->showMainWindow();
Expand Down
25 changes: 15 additions & 10 deletions applications/mne_analyze/plugins/rawdataviewer/fiffrawview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
#include <QLabel>

#if !defined(NO_OPENGL)
#include <QGLWidget>
#include <QOpenGLWidget>
#endif

//=============================================================================================================
Expand All @@ -82,14 +82,6 @@ FiffRawView::FiffRawView(QWidget *parent)
{
m_pTableView = new QTableView;

#if !defined(NO_OPENGL)
//Use GPU rendering
QGLFormat currentFormat = QGLFormat(QGL::SampleBuffers);
currentFormat.setSamples(3);
QGLWidget* pGLWidget = new QGLWidget(currentFormat);
m_pTableView->setViewport(pGLWidget);
#endif

//set vertical layout
QVBoxLayout *neLayout = new QVBoxLayout(this);
neLayout->setContentsMargins(0, 0, 0, 0);
Expand Down Expand Up @@ -120,6 +112,10 @@ FiffRawView::~FiffRawView()

void FiffRawView::setDelegate(const QSharedPointer<FiffRawViewDelegate>& pDelegate)
{
if(!pDelegate) {
qWarning() << "[FiffRawView::setDelegate] Passed delegate is NULL.";
return;
}
m_pDelegate = pDelegate;

m_pTableView->setItemDelegate(m_pDelegate.data());
Expand All @@ -142,11 +138,20 @@ QSharedPointer<FiffRawViewModel> FiffRawView::getModel()
//=============================================================================================================

void FiffRawView::setModel(const QSharedPointer<FiffRawViewModel>& pModel)
{
{
if(!pModel) {
qWarning() << "[FiffRawView::setModel] Passed model is NULL.";
return;
}

m_pModel = pModel;

m_pTableView->setModel(m_pModel.data());

#if !defined(NO_OPENGL)
m_pTableView->setViewport(new QOpenGLWidget);
#endif

m_pTableView->setObjectName(QString::fromUtf8("m_pTableView"));
QSizePolicy sizePolicy3(QSizePolicy::Expanding, QSizePolicy::Expanding);
sizePolicy3.setHorizontalStretch(0);
Expand Down

0 comments on commit 64e10d1

Please sign in to comment.