3 class Item < Qt::GraphicsPixmapItem
4 attr_reader :name, :item
7 # name is whatever information the caller needs
8 # to recreate this piece with a different size
10 def initialize(name, pixmap, parent)
16 def paint(p, options, widget)
19 super p, options, widget
29 scene.remove_item self
34 BACKGROUND_ZVALUE = -10
37 def create_item(key, pix, opts = {})
38 name = opts[:name] || key.to_s
39 item = Item.new(name, pix, self)
40 item.pos = opts[:pos] || Qt::PointF.new(0, 0)
41 item.z_value = opts[:z] || 0
42 item.visible = false if opts[:hidden]
46 def destroy_item(item)
47 scene.remove_item item
51 item.z_value = TEMP_ZVALUE