Class: RubyQt6::QtCore::Private::MetaObject
- Inherits:
-
Object
- Object
- RubyQt6::QtCore::Private::MetaObject
- Defined in:
- lib/qt6/qtcore/private/metaobject.rb
Instance Attribute Summary collapse
-
#metamethods ⇒ Object
readonly
Returns the value of attribute metamethods.
Class Method Summary collapse
Instance Method Summary collapse
- #add_classinfo(name, value) ⇒ Object (also: #classinfo)
- #add_signal(signature) ⇒ Object (also: #signal)
- #add_slot(signature) ⇒ Object (also: #slot)
- #class_name ⇒ Object
-
#initialize(qlass) ⇒ MetaObject
constructor
A new instance of MetaObject.
- #ruby? ⇒ Boolean
- #super_class ⇒ Object
- #to_qmetaobject ⇒ Object
Constructor Details
#initialize(qlass) ⇒ MetaObject
Returns a new instance of MetaObject.
31 32 33 34 35 36 |
# File 'lib/qt6/qtcore/private/metaobject.rb', line 31 def initialize(qlass) @qlass = qlass = @qlass.name.start_with?("RubyQt6::") ? :libQt6 : :ruby @classinfo = {} = [] end |
Instance Attribute Details
#metamethods ⇒ Object (readonly)
Returns the value of attribute metamethods.
7 8 9 |
# File 'lib/qt6/qtcore/private/metaobject.rb', line 7 def end |
Class Method Details
.find_receiver_metamethod!(receiver, method, signal = nil) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/qt6/qtcore/private/metaobject.rb', line 9 def self.(receiver, method, signal = nil) if signal.nil? signature = "anonymous()" signal = QtCore::Private::MetaMethod.new(signature, :signal, :ruby) end name = QtCore::Private::MetaMethod.normalized_name(method.to_s) compatible_methods = signal.parameters.count.downto(0).map do |n| QtCore::Private::MetaMethod.normalized_signature(name, signal.parameters[0...n]) end mo = receiver.class. until mo.nil? mo..each { |meth| return meth if compatible_methods.include?(meth.signature) } mo..each { |meth| return meth if name == meth.name } if mo.ruby? mo = mo.super_class end qlass = receiver.class.name.split("::").last raise "No compatible metamethod: #{qlass}##{name}" end |
Instance Method Details
#add_classinfo(name, value) ⇒ Object Also known as: classinfo
38 39 40 |
# File 'lib/qt6/qtcore/private/metaobject.rb', line 38 def add_classinfo(name, value) @classinfo[name] = value end |
#add_signal(signature) ⇒ Object Also known as: signal
43 44 45 |
# File 'lib/qt6/qtcore/private/metaobject.rb', line 43 def add_signal(signature) << QtCore::Private::MetaMethod.new(signature, :signal, ) end |
#add_slot(signature) ⇒ Object Also known as: slot
48 49 50 |
# File 'lib/qt6/qtcore/private/metaobject.rb', line 48 def add_slot(signature) << QtCore::Private::MetaMethod.new(signature, :slot, ) end |
#class_name ⇒ Object
53 54 55 |
# File 'lib/qt6/qtcore/private/metaobject.rb', line 53 def class_name @qlass.name end |
#ruby? ⇒ Boolean
62 63 64 |
# File 'lib/qt6/qtcore/private/metaobject.rb', line 62 def ruby? == :ruby end |
#super_class ⇒ Object
57 58 59 60 |
# File 'lib/qt6/qtcore/private/metaobject.rb', line 57 def super_class return nil if @qlass == QtCore::QObject @qlass.superclass. end |
#to_qmetaobject ⇒ Object
66 67 68 69 70 71 72 73 74 75 |
# File 'lib/qt6/qtcore/private/metaobject.rb', line 66 def return @qlass. unless ruby? builder = QtCore::QMetaObjectBuilder.new builder.set_class_name(@qlass.name) builder.set_super_class(@qlass.superclass.) @classinfo.each { |name, value| builder.add_class_info(name, value) } .each { |meth| (builder, meth) } builder. end |