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"].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(display, combo) ⇒ LayoutMethodModel

Returns a new instance of LayoutMethodModel.



196
197
198
199
# File 'lib/roby/gui/relations_view/relations_config.rb', line 196

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

Instance Attribute Details

#comboObject (readonly)

Returns the value of attribute combo.



194
195
196
# File 'lib/roby/gui/relations_view/relations_config.rb', line 194

def combo
  @combo
end

#displayObject (readonly)

Returns the value of attribute display.



194
195
196
# File 'lib/roby/gui/relations_view/relations_config.rb', line 194

def display
  @display
end

Instance Method Details

#data(index, role) ⇒ Object



207
208
209
210
211
# File 'lib/roby/gui/relations_view/relations_config.rb', line 207

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

    Qt::Variant.new(METHODS[index.row])
end

#flags(index) ⇒ Object



215
216
217
# File 'lib/roby/gui/relations_view/relations_config.rb', line 215

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

#layout_method(index) ⇒ Object



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

def layout_method(index); end

#rowCount(parent) ⇒ Object



201
202
203
204
205
# File 'lib/roby/gui/relations_view/relations_config.rb', line 201

def rowCount(parent)
    return 0 if parent.valid?

    METHODS.size
end

#selectedObject



219
220
221
222
223
224
225
226
227
# File 'lib/roby/gui/relations_view/relations_config.rb', line 219

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