class Vizkit::PropertiesItem

Attributes

task[R]

Public Class Methods

new(task,options = Hash.new) click to toggle source
Calls superclass method Vizkit::VizkitItem.new
# File lib/vizkit/vizkit_items.rb, line 839
def initialize(task,options = Hash.new)
    super()
    @options = Kernel.validate_options options,:item_type => :label,:editable => true
    @task = task
    setEditable false
    if @options[:item_type] == :label
        setText "Properties"
        task.on_property_reachable do |property_name|
            next if child?(property_name)
            prop = task.property(property_name)
            prop.once_on_reachable do
                prop1 = PropertyItem.new(prop,@options)
                prop2 = PropertyItem.new(prop,:item_type => :value,:editable => @options[:editable])
                appendRow [prop1,prop2]
                if expanded?
                    prop1.expand
                    prop2.expand
                end
            end
        end
    end
end

Public Instance Methods

context_menu(pos,parent_widget,items = []) click to toggle source
# File lib/vizkit/vizkit_items.rb, line 862
def context_menu(pos,parent_widget,items = [])
end
data(role = Qt::UserRole+1) click to toggle source
Calls superclass method
# File lib/vizkit/vizkit_items.rb, line 865
def data(role = Qt::UserRole+1)
    # workaround memeroy leak qt-ruby
    # the returned Qt::Variant is never be deleted
    @last_value.dispose if @last_value
    @last_value = if role == Qt::EditRole
                      i = index.sibling(row,0)
                      if i.isValid
                          item = i.model.itemFromIndex i
                          Qt::Variant.from_ruby item
                      else
                          super
                      end
                  else
                      super
                  end
end
expand(propagated = false) click to toggle source
# File lib/vizkit/vizkit_items.rb, line 882
def expand(propagated = false)
    @expanded = true
    each_child do |item|
        item.expand(propagated)
    end
end
write(&block) click to toggle source
# File lib/vizkit/vizkit_items.rb, line 889
def write(&block)
    0.upto(rowCount-1) do |i|
        child(i,0).write(&block)
    end
end