Class: QML::ListModelAccess Private

Inherits:
Object
  • Object
show all
Includes:
Access
Defined in:
lib/qml/data/list_model_access.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Constant Summary

Constants included from Access

Access::ALLOWED_PATTERN

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Access

#to_qml

Methods included from Access::ClassMethods

#meta_object, #register_to_qml, #register_to_qml_impl

Methods included from Reactive

#initialize

Methods included from Reactive::ClassMethods

#properties, #property_infos, #signal_infos, #signals

Instance Attribute Details

#modelObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



16
17
18
# File 'lib/qml/data/list_model_access.rb', line 16

def model
  @model
end

Class Method Details

.create(model) ⇒ QML::JSWrapper

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:



33
34
35
36
37
38
39
40
41
42
# File 'lib/qml/data/list_model_access.rb', line 33

def self.create(model)
  @component ||= QML::Component.new(data: <<-QML)
    import RubyQml 1.0
    ListModelAccess {}
  QML

  @component.create.tap do |access|
    access.unwrap.model = model
  end
end

Instance Method Details

#columnsObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



18
19
20
# File 'lib/qml/data/list_model_access.rb', line 18

def columns
  @model.columns.to_qml
end

#countObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



26
27
28
# File 'lib/qml/data/list_model_access.rb', line 26

def count
  @model.count
end

#data(index, column) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



22
23
24
# File 'lib/qml/data/list_model_access.rb', line 22

def data(index, column)
  @model[index.to_i][column.to_sym].to_qml
end