class Ui::RelationDelegate

Constants

MAX_WIDTH

Public Instance Methods

createEditor(parent, option, index) click to toggle source
# File lib/roby/gui/relations_view/relations_config.rb, line 136
def createEditor(parent, option, index)
    color = index.model.data(index, Qt::DisplayRole).to_string
    new_color = Qt::ColorDialog.get_color(Qt::Color.new(color))
    index.model.setData(index, Qt::Variant.new(new_color.name), Qt::DisplayRole)

    nil
end
paint(painter, option, index) click to toggle source
Calls superclass method
# File lib/roby/gui/relations_view/relations_config.rb, line 143
def paint(painter, option, index)
    if index.column == 1 && RelationConfigModel.category_from_index(index) >= 0
        color = index.model.data(index, Qt::DisplayRole).to_string
        rect = option.rect
        rect.adjust(1, 1, -1, -1)
        if rect.width > MAX_WIDTH
            rect.width = MAX_WIDTH
        end
        painter.fill_rect rect, Qt::Brush.new(Qt::Color.new(color))
    else
        super
    end
end