Class: Header

Inherits:
Object show all
Defined in:
lib/qtext/object_table_model.rb

Overview

A header for ObjectTableModel.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Header

args is a hash that can contain the following:

  • :attribute (required) is the name of the attribute on objects in the table’s collection, the values for which will be displayed in this column.

  • :title is the column header. Defaults to attribute.humanize

  • :alignment is one of the Qt::Align constants. Defaults to Qt::AlignLeft | Qt::AlignVCenter.



40
41
42
43
44
45
# File 'lib/qtext/object_table_model.rb', line 40

def initialize( args = {} )
  raise "there must be an attribute" unless args.has_key?( :attribute )
  @attribute = args[:attribute]
  @title = args[:title] || @attribute.to_s.humanize
  @alignment = args[:alignment] || ( Qt::AlignLeft | Qt::AlignVCenter )
end

Instance Attribute Details

#alignmentObject (readonly)

Returns the value of attribute alignment.



33
34
35
# File 'lib/qtext/object_table_model.rb', line 33

def alignment
  @alignment
end

#attributeObject (readonly)

Returns the value of attribute attribute.



33
34
35
# File 'lib/qtext/object_table_model.rb', line 33

def attribute
  @attribute
end

#titleObject (readonly)

Returns the value of attribute title.



33
34
35
# File 'lib/qtext/object_table_model.rb', line 33

def title
  @title
end