Module: QML::Access

Extended by:
ClassMethods
Includes:
Dispatchable, Reactive::Object, Wrappable
Included in:
ImageProvider::Callback
Defined in:
lib/qml/access.rb

Overview

Access enables classes to be exposed to QML.

Defined Under Namespace

Modules: ClassMethods

Constant Summary collapse

ALLOWED_PATTERN =

allowed name patterns for exposed method names

/^[a-zA-Z_]\w*$/

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ClassMethods

access_wrapper_factory, register_to_qml, register_to_qml_real

Methods included from Reactive::Object

#properties, #property, #signal, #signals

Methods included from Reactive::Object::ClassMethods

#alias_property, #alias_signal, #instance_properties, #instance_property, #instance_signal, #instance_signals, #on, #on_changed, #property, #signal, #variadic_signal

Methods included from Dispatchable

#later

Instance Attribute Details

#access_wrappersObject (readonly)

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.



115
116
117
# File 'lib/qml/access.rb', line 115

def access_wrappers
  @access_wrappers
end

Class Method Details

.register_classesObject

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.



29
30
31
# File 'lib/qml/access.rb', line 29

def self.register_classes
  unregistered_classes.each(&:register_to_qml_real)
end

.unregistered_classesObject

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.



24
25
26
# File 'lib/qml/access.rb', line 24

def self.unregistered_classes
  @unregistered_classes ||= []
end

Instance Method Details

#create_wrapperObject



130
131
132
# File 'lib/qml/access.rb', line 130

def create_wrapper
  self.class.access_wrapper_factory.create(self)
end

#initialize(*args, &block) ⇒ Object



117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/qml/access.rb', line 117

def initialize(*args, &block)
  signal_names = signals + properties.map { |name| :"#{name}_changed" }
  signal_names.each do |name|
    __send__(name).connect do |*args|
      @access_wrappers.each do |obj|
        obj.class.meta_object.invoke_method(obj.pointer, name, args)
      end
    end
  end
  @access_wrappers = []
  super
end