Class: Header
Overview
A header for ObjectTableModel.
Instance Attribute Summary collapse
-
#alignment ⇒ Object
readonly
Returns the value of attribute alignment.
-
#attribute ⇒ Object
readonly
Returns the value of attribute attribute.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ Header
constructor
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.
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.
39 40 41 42 43 44 |
# File 'lib/qtext/object_table_model.rb', line 39 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
#alignment ⇒ Object (readonly)
Returns the value of attribute alignment.
32 33 34 |
# File 'lib/qtext/object_table_model.rb', line 32 def alignment @alignment end |
#attribute ⇒ Object (readonly)
Returns the value of attribute attribute.
32 33 34 |
# File 'lib/qtext/object_table_model.rb', line 32 def attribute @attribute end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
32 33 34 |
# File 'lib/qtext/object_table_model.rb', line 32 def title @title end |