Sha256: d9cdc71f041f73f540f49a7b643fb95107c45dba5f1c9afffedbfc4a10919912
Contents?: true
Size: 1.69 KB
Versions: 3
Compression:
Stored size: 1.69 KB
Contents
require 'Qt4' module Qt class KeyEvent def inspect "<Qt::KeyEvent text=#{text} key=#{key}" end end end module Clevic class ItemDelegate < Qt::ItemDelegate def initialize( parent ) super end # This catches the event that begins the edit process. # Not used at the moment. def editorEvent ( event, model, style_option_view_item, model_index ) puts "editorEvent" puts "event: #{event.inspect}" puts "model: #{model.inspect}" puts "style_option_view_item: #{style_option_view_item.inspect}" puts "model_index: #{model_index.inspect}" super end def createEditor( parent_widget, style_option_view_item, model_index ) puts "model_index.metadata.type: #{model_index.metadata.type.inspect}" if model_index.metadata.type == :date # not going to work here because being triggered by # an alphanumeric keystroke (as opposed to F4) # will result in the calendar widget being opened. #~ Qt::CalendarWidget.new( parent_widget ) super else super end end #~ def setEditorData( editor, model_index ) #~ editor.value = model_index.gui_value #~ end #~ def setModelData( editor, abstract_item_model, model_index ) #~ model_index.gui_value = editor.value #~ emit abstract_item_model.dataChanged( model_index, model_index ) #~ end def updateEditorGeometry( editor, style_option_view_item, model_index ) # figure out where to put the editor widget, taking into # account the sizes of the headers rect = style_option_view_item.rect rect.set_width( [editor.size_hint.width,rect.width].max ) rect.set_height( editor.size_hint.height ) editor.set_geometry( rect ) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
clevic-0.5.1 | lib/clevic/item_delegate.rb |
clevic-0.5.2 | lib/clevic/item_delegate.rb |
clevic-0.6.0 | lib/clevic/item_delegate.rb |