annotate gui/src/Plot2dWidget.cpp @ 13470:f7356554594c

Plot can be moved around with mouse and zoomed with scrollwheel.
author Jacob Dawid <jacob.dawid@googlemail.com>
date Wed, 20 Apr 2011 09:59:04 +0200
parents a20f8763105f
children 4baf5e6bba13
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13469
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
1 #include "Plot2dWidget.h"
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
2 #include <QVBoxLayout>
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
3 #include <QHBoxLayout>
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
4 #include <QPushButton>
13470
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
5 #include <QTimer>
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
6 #include <math.h>
13469
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
7
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
8 Plot2dView::Plot2dView(QWidget *parent)
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
9 : QGLWidget(parent) {
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
10 construct();
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
11 }
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
12
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
13 void Plot2dView::construct() {
13470
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
14 QTimer *animationTimer = new QTimer(this);
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
15 animationTimer->setInterval(20);
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
16 animationTimer->start();
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
17 m_zoom = 1.0;
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
18 m_scrollX = 0.0;
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
19 m_scrollY = 0.0;
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
20 m_leftMouseButtonDown = false;
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
21 connect(animationTimer, SIGNAL(timeout()), this, SLOT(animate()));
13469
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
22 }
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
23
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
24 void Plot2dView::initializeGL() {
13470
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
25 glClearColor(0.0,0.0, 0.0, 0.0);
13469
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
26 glEnable(GL_POINT_SMOOTH);
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
27 // glEnable(GL_LINE_SMOOTH);
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
28 glEnable(GL_POLYGON_SMOOTH);
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
29 glEnable(GL_BLEND);
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
30 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
31 }
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
32
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
33 void Plot2dView::paintGL() {
13470
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
34 glMatrixMode(GL_MODELVIEW_MATRIX);
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
35 glLoadIdentity();
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
36 glScaled(m_zoom, m_zoom, 0.0);
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
37 glTranslated(-0.5 - m_scrollX, -0.5 - m_scrollY, 0.0);
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
38
13469
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
39 glClear(GL_COLOR_BUFFER_BIT);
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
40 glBegin(GL_LINES);
13470
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
41 glColor3d(1.0, 1.0, 1.0);
13469
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
42 glVertex2d(0.1, 0.1);
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
43 glVertex2d(0.9, 0.1);
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
44 glVertex2d(0.1, 0.1);
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
45 glVertex2d(0.1, 0.9);
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
46 glEnd();
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
47
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
48 glBegin(GL_POLYGON);
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
49 glVertex2d(0.092, 0.9);
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
50 glVertex2d(0.108, 0.9);
13470
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
51 glVertex2d(0.1, 0.92);
13469
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
52 glEnd();
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
53 glBegin(GL_POLYGON);
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
54 glVertex2d(0.9, 0.092);
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
55 glVertex2d(0.9, 0.108);
13470
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
56 glVertex2d(0.92, 0.1);
13469
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
57 glEnd();
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
58
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
59 renderText(0.8, 0.05, 0.0, "axis");
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
60 }
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
61
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
62 void Plot2dView::resizeGL(int w, int h) {
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
63 glViewport(0, 0, w, h);
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
64 glMatrixMode(GL_MODELVIEW_MATRIX);
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
65 glLoadIdentity();
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
66
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
67 glMatrixMode(GL_PROJECTION_MATRIX);
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
68 glLoadIdentity();
13470
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
69 glOrtho(-1.0, 1.0, -1.0, 1.0, 0.0, 100.0);
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
70 }
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
71
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
72 void Plot2dView::wheelEvent(QWheelEvent *wheelEvent) {
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
73 m_zoomAcceleration += ((double)wheelEvent->delta()) / 5000;
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
74 wheelEvent->accept();
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
75 updateGL();
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
76 }
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
77
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
78 void Plot2dView::mousePressEvent(QMouseEvent *mouseEvent) {
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
79 if(mouseEvent->button() == Qt::LeftButton) {
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
80 m_leftMouseButtonDown = true;
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
81 m_lastMouseButtonDownX = mouseEvent->x();
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
82 m_lastMouseButtonDownY = mouseEvent->y();
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
83 mouseEvent->accept();
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
84 }
13469
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
85 }
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
86
13470
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
87 void Plot2dView::mouseReleaseEvent(QMouseEvent *mouseEvent) {
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
88 if(mouseEvent->button() == Qt::LeftButton) {
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
89 m_leftMouseButtonDown = false;
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
90 mouseEvent->accept();
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
91 }
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
92 }
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
93
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
94 void Plot2dView::mouseMoveEvent(QMouseEvent *mouseEvent) {
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
95 if(m_leftMouseButtonDown) {
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
96 m_scrollX -= ((double)mouseEvent->x() - m_lastMouseButtonDownX) / 100;
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
97 m_scrollY += ((double)mouseEvent->y() - m_lastMouseButtonDownY) / 100;
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
98 m_lastMouseButtonDownX = (double)mouseEvent->x();
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
99 m_lastMouseButtonDownY = (double)mouseEvent->y();
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
100 }
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
101 updateGL();
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
102 }
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
103
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
104 void Plot2dView::animate() {
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
105 m_zoom += m_zoomAcceleration;
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
106 if(m_zoom < 0)
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
107 m_zoom = 0;
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
108 m_zoomAcceleration *= 0.2;
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
109 if(abs(m_zoomAcceleration) < 0.01)
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
110 m_zoomAcceleration = 0;
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
111 updateGL();
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
112 }
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
113
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
114 Plot2dWidget::Plot2dWidget(QWidget *parent)
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
115 : QWidget(parent) {
13469
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
116 construct();
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
117 }
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
118
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
119 void Plot2dWidget::construct() {
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
120 QVBoxLayout *layout = new QVBoxLayout();
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
121 m_plot2dView = new Plot2dView(this);
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
122 m_plot2dView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
123 layout->addWidget(m_plot2dView);
13470
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
124
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
125 m_tabWidget = new QTabWidget(this);
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
126 m_tabWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
127 layout->addWidget(m_tabWidget);
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
128
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
129 m_dataSourceTab = new QWidget(this);
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
130 m_verticalAxisTab = new QWidget(this);
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
131 m_horizontalAxisTab = new QWidget(this);
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
132 m_tabWidget->addTab(m_dataSourceTab, tr("Data Source"));
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
133 m_tabWidget->addTab(m_verticalAxisTab, tr("Vertical Axis"));
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
134 m_tabWidget->addTab(m_horizontalAxisTab, tr("Horizontal Axis"));
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
135
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
136 // Build data source tab.
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
137 QHBoxLayout *dataSourceTabLayout = new QHBoxLayout();
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
138
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
139 m_dataSourceTypeComboBox = new QComboBox(this);
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
140 m_dataSourceTypeComboBox->addItem(tr("Parameterized"));
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
141 m_dataSourceTypeComboBox->addItem(tr("Sampled"));
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
142 dataSourceTabLayout->addWidget(m_dataSourceTypeComboBox);
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
143 dataSourceTabLayout->addStretch();
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
144 m_dataSourceTab->setLayout(dataSourceTabLayout);
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
145
13469
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
146 layout->setMargin(0);
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
147 setLayout(layout);
13470
f7356554594c Plot can be moved around with mouse and zoomed with scrollwheel.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13469
diff changeset
148
13469
a20f8763105f Added some OpenGL plotting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
149 }