class Syskit::GUI::RubyItem

A QStandardItem to display and edit primitive ruby types in a tree view

Public Class Methods

new() click to toggle source
Calls superclass method
# File lib/syskit/gui/ruby_item.rb, line 9
def initialize
    super(nil, :nil?)
    setEditable false
end

Public Instance Methods

getter(&block) click to toggle source

Defines a block to be called to fetch data from the model

# File lib/syskit/gui/ruby_item.rb, line 30
def getter(&block)
    @getter = block
end
setData(data,role = Qt::UserRole+1) click to toggle source
Calls superclass method
# File lib/syskit/gui/ruby_item.rb, line 14
def setData(data,role = Qt::UserRole+1)
    return super if role != Qt::EditRole || data.isNull
    val = from_variant data, @getter.call
    return false if val.nil?
    return false unless val != @getter.call
    @setter.call val
    modified!
end
setter(&block) click to toggle source

Defines a block to be called to update the model when the item is edited

# File lib/syskit/gui/ruby_item.rb, line 24
def setter(&block)
    @setter = block
    setEditable true
end