qvolray

view src/ui_xferview.cc @ 36:70b937008134

demo :)
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 15 Apr 2012 07:19:01 +0300
parents 40df2cdc6323
children
line source
1 #include <QtGui>
2 #include "ui_xferview.h"
3 #include "volray.h"
5 static int prev_x, prev_y;
7 XFerGLView::XFerGLView(QGLWidget *share_widget)
8 : QGLWidget(QGLFormat(QGL::DoubleBuffer), 0, share_widget)
9 {
10 }
12 QSize XFerGLView::minimumSizeHint() const
13 {
14 return QSize(160, 100);
15 }
17 void XFerGLView::initializeGL()
18 {
19 }
21 void XFerGLView::resizeGL(int xsz, int ysz)
22 {
23 glViewport(0, 0, xsz, ysz);
24 }
26 void XFerGLView::paintGL()
27 {
28 volray_draw_xfer();
29 }
31 void XFerGLView::mousePressEvent(QMouseEvent *ev)
32 {
33 prev_x = ev->x();
34 prev_y = ev->y();
35 }
37 void modxfer(int dx, int dy, int max_x, int max_y);
39 void XFerGLView::mouseMoveEvent(QMouseEvent *ev)
40 {
41 int x = ev->x();
42 int y = ev->y();
44 int dx = x - prev_x;
45 int dy = y - prev_y;
47 prev_x = x;
48 prev_y = y;
50 modxfer(dx, dy, width(), height());
51 }