class ImageModel

Public Class Methods

new(image, parent = nil) click to toggle source
Calls superclass method
# File examples/itemviews/pixelator/imagemodel.rb, line 29
def initialize(image, parent = nil)
    super(parent)
    @modelImage = Qt::Image.new(image)
end

Public Instance Methods

columnCount(parent) click to toggle source
# File examples/itemviews/pixelator/imagemodel.rb, line 38
def columnCount(parent)
    return @modelImage.width
end
data(index, role) click to toggle source
# File examples/itemviews/pixelator/imagemodel.rb, line 42
def data(index, role)
    if !index.valid?
        return Qt::Variant.new
    elsif role == Qt::ToolTipRole
        return Qt::Variant.new
    end

    return Qt::Variant.new(qGray(@modelImage.pixel(index.column, index.row)))
end
rowCount(parent) click to toggle source
# File examples/itemviews/pixelator/imagemodel.rb, line 34
def rowCount(parent)
    return @modelImage.height
end