class QtWidgetGL

Attributes

height[RW]
load_proc[R]
width[RW]

Public Class Methods

new(parent, width = 400, height = 400) click to toggle source
Calls superclass method
# 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

Public Instance Methods

dispose() click to toggle source
Calls superclass method
# File lib/qt_widget_gl.rb, line 27
def dispose()
  super
end
get_GLUT_button(event) click to toggle source
# File lib/qt_widget_gl.rb, line 47
def get_GLUT_button(event)
  return GLUT::GLUT_RIGHT_BUTTON if( event.button == Qt::RightButton)
  return GLUT::GLUT_MIDDLE_BUTTON if( event.button == Qt::MidButton)
  return GLUT::GLUT_LEFT_BUTTON if( event.button == Qt::LeftButton)
  return nil
end
idle_process(wait_msec = nil, &block) click to toggle source
# 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() click to toggle source
# File lib/qt_widget_gl.rb, line 35
def initializeGL()
  @view = Disp3D::GLView.new(@width, @height)
end
minimumSizeHint() click to toggle source
# File lib/qt_widget_gl.rb, line 39
def minimumSizeHint()
  return Qt::Size.new(@min_width, @min_height)
end
mouseMoveEvent(event) click to toggle source
# 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) click to toggle source
# File lib/qt_widget_gl.rb, line 59
def mousePressEvent(event)
  glut_button = get_GLUT_button(event)
  @view.mouse_press_process(glut_button, event.pos.x, event.pos.y)
end
mouseReleaseEvent(event) click to toggle source
# File lib/qt_widget_gl.rb, line 54
def mouseReleaseEvent(event)
  glut_button = get_GLUT_button(event)
  @view.mouse_release_process(glut_button, event.pos.x, event.pos.y)
end
paintGL() click to toggle source
# File lib/qt_widget_gl.rb, line 71
def paintGL
  @view.gl_display
end
resizeGL(width, height) click to toggle source
# File lib/qt_widget_gl.rb, line 75
def resizeGL(width, height)
  @view.reshape(width, height)
end
set_load_proc(proc) click to toggle source
# File lib/qt_widget_gl.rb, line 31
def set_load_proc(proc)
  @load_proc = proc
end
sizeHint() click to toggle source
# File lib/qt_widget_gl.rb, line 43
def sizeHint()
  return Qt::Size.new(@width, @height)
end
timerEvent(event) click to toggle source
# File lib/qt_widget_gl.rb, line 84
def timerEvent(event)
  if( event.timerId == @idle_process_timer_id)
    @idle_proc.call
  end
end