class SemesterComboBoxDelegate

Public Class Methods

new(parent) click to toggle source
Calls superclass method
# File lib/tmis/interface/models/speciality_subject_table_model.rb, line 235
def initialize(parent)
  super
  setup
end

Public Instance Methods

createEditor(parent, option, index) click to toggle source
# File lib/tmis/interface/models/speciality_subject_table_model.rb, line 244
def createEditor(parent, option, index)
  editor = Qt::ComboBox.new(parent)
  @semesters.each{ |x| editor.addItem(x.title.to_s, x.id.to_v) }
  editor
end
setEditorData(editor, index) click to toggle source
# File lib/tmis/interface/models/speciality_subject_table_model.rb, line 250
def setEditorData(editor, index)
  value = index.data
  editor.setCurrentIndex(editor.findData(value))
end
setModelData(editor, model, index) click to toggle source
# File lib/tmis/interface/models/speciality_subject_table_model.rb, line 255
def setModelData(editor, model, index)
  value = editor.itemData(editor.currentIndex)
  model.setData(index, value, Qt::EditRole)
end
setup() click to toggle source
# File lib/tmis/interface/models/speciality_subject_table_model.rb, line 240
def setup
  @semesters = Semester.all.sort_by(&:title)
end
updateEditorGeometry(editor, option, index) click to toggle source
# File lib/tmis/interface/models/speciality_subject_table_model.rb, line 260
def updateEditorGeometry(editor, option, index)
  editor.setGeometry(option.rect)
end