Class: Ui::LayoutMethodModel

Inherits:
Qt::AbstractListModel
  • Object
show all
Defined in:
lib/roby/gui/relations_view/relations_config.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.



161
162
163
164
# File 'lib/roby/gui/relations_view/relations_config.rb', line 161

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

Instance Attribute Details

#comboObject (readonly)

Returns the value of attribute combo.



160
161
162
# File 'lib/roby/gui/relations_view/relations_config.rb', line 160

def combo
  @combo
end

#displayObject (readonly)

Returns the value of attribute display.



160
161
162
# File 'lib/roby/gui/relations_view/relations_config.rb', line 160

def display
  @display
end

Instance Method Details

#data(index, role) ⇒ Object



170
171
172
173
# File 'lib/roby/gui/relations_view/relations_config.rb', line 170

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

#flags(index) ⇒ Object



177
178
179
# File 'lib/roby/gui/relations_view/relations_config.rb', line 177

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

#layout_method(index) ⇒ Object



174
175
# File 'lib/roby/gui/relations_view/relations_config.rb', line 174

def layout_method(index)
end

#rowCount(parent) ⇒ Object



166
167
168
169
# File 'lib/roby/gui/relations_view/relations_config.rb', line 166

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

#selectedObject



181
182
183
184
185
186
187
188
# File 'lib/roby/gui/relations_view/relations_config.rb', line 181

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