Method: Ui::RelationConfigModel#data

Defined in:
lib/roby/log/gui/relations.rb

#data(index, role) ⇒ Object



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/roby/log/gui/relations.rb', line 62

def data(index, role)
    return Qt::Variant.new unless index.valid?

    category = index.internalPointer
    value = if category == -1
		if index.column == COL_NAME && role == Qt::DisplayRole
		    CATEGORIES[index.row]
		end
	    else
		relation = relations[category][index.row]
		if index.column == COL_NAME && role == Qt::CheckStateRole
		    if    display.relation_enabled?(relation) then Qt::Checked.to_i
		    elsif display.layout_relation?(relation)  then Qt::PartiallyChecked.to_i
		    else Qt::Unchecked.to_i
		    end
		elsif index.column == COL_NAME && role == Qt::DisplayRole
		    relation.name.gsub(/.*Structure::/, '')
		elsif index.column == COL_COLOR && role == Qt::DisplayRole
		    display.relation_color(relation)
		end
	    end

    if value then Qt::Variant.new(value)
    else Qt::Variant.new
    end
end