summaryrefslogtreecommitdiffstats
path: root/examples/datavisualization/surface/main.cpp
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@theqtcompany.com>2015-12-29 12:27:48 +0200
committerMiikka Heikkinen <miikka.heikkinen@theqtcompany.com>2015-12-30 08:45:14 +0000
commit64f0d4fb353ae2e447483897839d4df8b5b32f54 (patch)
treefeb89a4253b05c20377b980773edc7619bbae0b9 /examples/datavisualization/surface/main.cpp
parent104c12823b1cbccb2a25593b0af319c0a42abbb5 (diff)
Add a method for checking if context was successfully created
Now it is possible to check after graph construction if the graph is actually usable in environments where the OpenGL support might not be sufficient. Task-number: QTRD-3748 Change-Id: Ia68b4e51386859f6d0c7b09cb44e50a74730ca55 Reviewed-by: Titta Heikkala <titta.heikkala@theqtcompany.com>
Diffstat (limited to 'examples/datavisualization/surface/main.cpp')
-rw-r--r--examples/datavisualization/surface/main.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/examples/datavisualization/surface/main.cpp b/examples/datavisualization/surface/main.cpp
index ca5783af..5e7bd50c 100644
--- a/examples/datavisualization/surface/main.cpp
+++ b/examples/datavisualization/surface/main.cpp
@@ -31,6 +31,7 @@
#include <QtWidgets/QGroupBox>
#include <QtWidgets/QComboBox>
#include <QtWidgets/QLabel>
+#include <QtWidgets/QMessageBox>
#include <QtGui/QPainter>
#include <QtGui/QScreen>
@@ -42,6 +43,13 @@ int main(int argc, char **argv)
QWidget *container = QWidget::createWindowContainer(graph);
//! [0]
+ if (!graph->hasContext()) {
+ QMessageBox msgBox;
+ msgBox.setText("Couldn't initialize the OpenGL context.");
+ msgBox.exec();
+ return -1;
+ }
+
QSize screenSize = graph->screen()->size();
container->setMinimumSize(QSize(screenSize.width() / 2, screenSize.height() / 1.6));
container->setMaximumSize(screenSize);