Class: QtWidgetGL
- Inherits:
-
Qt::GLWidget
- Object
- Qt::GLWidget
- QtWidgetGL
- Extended by:
- Forwardable
- Defined in:
- lib/qt_widget_gl.rb
Instance Attribute Summary collapse
-
#height ⇒ Object
Returns the value of attribute height.
-
#load_proc ⇒ Object
readonly
Returns the value of attribute load_proc.
-
#width ⇒ Object
Returns the value of attribute width.
Instance Method Summary collapse
- #dispose ⇒ Object
- #get_GLUT_button(event) ⇒ Object
- #idle_process(wait_msec = nil, &block) ⇒ Object
-
#initialize(parent, width = 400, height = 400) ⇒ QtWidgetGL
constructor
A new instance of QtWidgetGL.
- #initializeGL ⇒ Object
- #minimumSizeHint ⇒ Object
- #mouseMoveEvent(event) ⇒ Object
- #mousePressEvent(event) ⇒ Object
- #mouseReleaseEvent(event) ⇒ Object
- #paintGL ⇒ Object
- #resizeGL(width, height) ⇒ Object
- #set_load_proc(proc) ⇒ Object
- #sizeHint ⇒ Object
- #timerEvent(event) ⇒ Object
Constructor Details
#initialize(parent, width = 400, height = 400) ⇒ QtWidgetGL
Returns a new instance of QtWidgetGL.
18 19 20 21 22 23 24 25 |
# File 'lib/qt_widget_gl.rb', line 18 def initialize(parent, width = 400, height = 400) super(parent) @width = width @height = height @min_width = 50 @min_height = 50 end |
Instance Attribute Details
#height ⇒ Object
Returns the value of attribute height.
10 11 12 |
# File 'lib/qt_widget_gl.rb', line 10 def height @height end |
#load_proc ⇒ Object (readonly)
Returns the value of attribute load_proc.
12 13 14 |
# File 'lib/qt_widget_gl.rb', line 12 def load_proc @load_proc end |
#width ⇒ Object
Returns the value of attribute width.
9 10 11 |
# File 'lib/qt_widget_gl.rb', line 9 def width @width end |
Instance Method Details
#dispose ⇒ Object
27 28 29 |
# File 'lib/qt_widget_gl.rb', line 27 def dispose() super end |
#get_GLUT_button(event) ⇒ Object
47 48 49 50 51 52 |
# File 'lib/qt_widget_gl.rb', line 47 def (event) return GLUT::GLUT_RIGHT_BUTTON if( event. == Qt::RightButton) return GLUT::GLUT_MIDDLE_BUTTON if( event. == Qt::MidButton) return GLUT::GLUT_LEFT_BUTTON if( event. == Qt::LeftButton) return nil end |
#idle_process(wait_msec = nil, &block) ⇒ Object
79 80 81 82 |
# File 'lib/qt_widget_gl.rb', line 79 def idle_process(wait_msec = nil, &block) @idle_proc = block @idle_process_timer_id = startTimer(wait_msec) end |
#initializeGL ⇒ Object
35 36 37 |
# File 'lib/qt_widget_gl.rb', line 35 def initializeGL() @view = Disp3D::GLView.new(@width, @height) end |
#minimumSizeHint ⇒ Object
39 40 41 |
# File 'lib/qt_widget_gl.rb', line 39 def minimumSizeHint() return Qt::Size.new(@min_width, @min_height) end |
#mouseMoveEvent(event) ⇒ Object
64 65 66 67 68 69 |
# File 'lib/qt_widget_gl.rb', line 64 def mouseMoveEvent(event) need_update = @view.mouse_move_process(event.pos.x,event.pos.y) if(need_update) updateGL() end end |
#mousePressEvent(event) ⇒ Object
59 60 61 62 |
# File 'lib/qt_widget_gl.rb', line 59 def mousePressEvent(event) = (event) @view.mouse_press_process(, event.pos.x, event.pos.y) end |
#mouseReleaseEvent(event) ⇒ Object
54 55 56 57 |
# File 'lib/qt_widget_gl.rb', line 54 def mouseReleaseEvent(event) = (event) @view.mouse_release_process(, event.pos.x, event.pos.y) end |
#paintGL ⇒ Object
71 72 73 |
# File 'lib/qt_widget_gl.rb', line 71 def paintGL @view.gl_display end |
#resizeGL(width, height) ⇒ Object
75 76 77 |
# File 'lib/qt_widget_gl.rb', line 75 def resizeGL(width, height) @view.reshape(width, height) end |
#set_load_proc(proc) ⇒ Object
31 32 33 |
# File 'lib/qt_widget_gl.rb', line 31 def set_load_proc(proc) @load_proc = proc end |
#sizeHint ⇒ Object
43 44 45 |
# File 'lib/qt_widget_gl.rb', line 43 def sizeHint() return Qt::Size.new(@width, @height) end |
#timerEvent(event) ⇒ Object
84 85 86 87 88 |
# File 'lib/qt_widget_gl.rb', line 84 def timerEvent(event) if( event.timerId == @idle_process_timer_id) @idle_proc.call end end |