lib/clevic/qt/table_view.rb in clevic-0.13.0.b3 vs lib/clevic/qt/table_view.rb in clevic-0.13.0.b5
- old
+ new
@@ -1,10 +1,7 @@
-require 'rubygems'
-require 'Qt4'
require 'fastercsv'
require 'qtext/action_builder.rb'
-
require 'clevic/model_builder.rb'
require 'clevic/filter_command.rb'
module Clevic
@@ -44,14 +41,16 @@
self.vertical_header.movable = false
self.vertical_header.default_alignment = Qt::AlignTop | Qt::AlignRight
self.sorting_enabled = false
# set fonts
- Qt::Font.new( font.family, font.point_size * 5 / 6 ).tap do |fnt|
- self.font = fnt
- self.horizontal_header.font = fnt
- end
+ # TODO leave this here, but commented so we can see how to do it
+ # properly later.
+ #~ Qt::Font.new( font.family, font.point_size * 5 / 6 ).tap do |fnt|
+ #~ self.font = fnt
+ #~ self.horizontal_header.font = fnt
+ #~ end
self.context_menu_policy = Qt::ActionsContextMenu
end
def connect_view_signals( entity_view )
@@ -203,25 +202,10 @@
error_message = Qt::ErrorMessage.new( self )
error_message.show_message( msg )
error_message.show
end
- # This is to allow entity model UI handlers to tell the view
- # whence to move the cursor when the current editor closes
- # (see closeEditor).
- # TODO not used?
- def override_next_index( model_index )
- self.next_index = model_index
- end
-
- # Call set_current_index with next_index ( from override_next_index )
- # or model_index, in that order. Set next_index to nil afterwards.
- def set_current_unless_override( model_index )
- set_current_index( @next_index || model_index )
- self.next_index = nil
- end
-
# work around situation where an ItemDelegate is open
# when the surrouding tab is changed, but the right events
# don't arrive.
def hideEvent( event )
# can't call super here, for some reason. Qt binding says method not found.
@@ -267,10 +251,10 @@
else
super( model_index, trigger, event )
end
rescue Exception => e
- raise RuntimeError, "#{model.entity_view.class.name}.#{model_index.field.id}: #{e.message}", caller(0)
+ raise RuntimeError, "#{model.entity_view.class.name}.#{model_index.field.id}: #{e.message}", e.backtrace
end
attr_accessor :before_edit_index
attr_reader :next_index
def next_index=( other_index )