Class: GlobalFlagStandardItemModel

Inherits:
Qt::StandardItemModel show all
Defined in:
lib/ruber/qt_sugar.rb

Overview

Qt::StandardItemModel-derived class which allow to set flags for all the items. To do so, simply set the global_flags attribute to the desired flags.

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Methods inherited from Qt::StandardItemModel

#each, #each_row

Constructor Details

- (GlobalFlagStandardItemModel) initialize(parent = nil)

Creates a new GlobalFlagStandardItemModel. The global_flags attribute for the new model will be set to nil. This means that the flags method will behave exactly as the Qt::StandardItemModel#flags method.



760
761
762
763
# File 'lib/ruber/qt_sugar.rb', line 760

def initialize parent = nil
  super
  @global_flags = nil
end

Instance Attribute Details

- (Object) global_flags

The flags which should be returned by every call to flags.



753
754
755
# File 'lib/ruber/qt_sugar.rb', line 753

def global_flags
  @global_flags
end

Instance Method Details

- (Object) flags(idx)

Returns the flags associated with the index idx_. If returns the value contained in the globalflags attribute if it is not nil, otherwise it will call Qt::StandardItemModel#flags and return that value



770
771
772
# File 'lib/ruber/qt_sugar.rb', line 770

def flags idx
  @global_flags || super
end