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

#initialize(parent = nil) ⇒ GlobalFlagStandardItemModel

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

#global_flagsObject

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

#flags(idx) ⇒ Object

Returns the flags associated with the index idx. If returns the value contained in the global_flags 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