Class: Ui::LayoutMethodModel

Inherits:
Qt::AbstractListModel
  • Object
show all
Defined in:
lib/roby/log/gui/relations.rb

Constant Summary collapse

METHODS =
["Auto", "dot [rankdir=LR]", "dot [rankdir=TB]", "circo", "neato [overlap=false]", "neato [overlap=false,mode=hier]", "twopi", "fdp"]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(display, combo) ⇒ LayoutMethodModel

Returns a new instance of LayoutMethodModel.



144
145
146
147
# File 'lib/roby/log/gui/relations.rb', line 144

def initialize(display, combo)
    super()
    @display, @combo = display, combo
end

Instance Attribute Details

#comboObject (readonly)

Returns the value of attribute combo.



143
144
145
# File 'lib/roby/log/gui/relations.rb', line 143

def combo
  @combo
end

#displayObject (readonly)

Returns the value of attribute display.



143
144
145
# File 'lib/roby/log/gui/relations.rb', line 143

def display
  @display
end

Instance Method Details

#data(index, role) ⇒ Object



153
154
155
156
# File 'lib/roby/log/gui/relations.rb', line 153

def data(index, role)
    return Qt::Variant.new unless role == Qt::DisplayRole && index.valid?
    Qt::Variant.new(METHODS[index.row])
end

#flags(index) ⇒ Object



160
161
162
# File 'lib/roby/log/gui/relations.rb', line 160

def flags(index)
    Qt::ItemIsSelectable | Qt::ItemIsEnabled
end

#layout_method(index) ⇒ Object



157
158
# File 'lib/roby/log/gui/relations.rb', line 157

def layout_method(index)
end

#rowCount(parent) ⇒ Object



149
150
151
152
# File 'lib/roby/log/gui/relations.rb', line 149

def rowCount(parent)
    return 0 if parent.valid?
    return METHODS.size
end

#selectedObject



164
165
166
167
168
169
# File 'lib/roby/log/gui/relations.rb', line 164

def selected
    index = combo.current_index
    display.layout_method = if index == 0 then nil
          else METHODS[index]
          end
end