Class: RubyQt6::QtCore::Private::SignalManager

Inherits:
Object
  • Object
show all
Defined in:
lib/qt6/qtcore/private/signalmanager.rb

Class Method Summary collapse

Class Method Details

.connect(sender, signal, receiver, metamethod) ⇒ Object



7
8
9
10
# File 'lib/qt6/qtcore/private/signalmanager.rb', line 7

def self.connect(sender, signal, receiver, metamethod)
  metamethod = QtCore::Private::MetaObject.find_receiver_metamethod!(receiver, metamethod, signal)
  QtCore::QObject._connect(sender, signal.qsignature, receiver, metamethod.qsignature)
end

.disconnect(sender, signal, receiver, metamethod) ⇒ Object



12
13
14
15
# File 'lib/qt6/qtcore/private/signalmanager.rb', line 12

def self.disconnect(sender, signal, receiver, metamethod)
  metamethod = QtCore::Private::MetaObject.find_receiver_metamethod!(receiver, metamethod, signal)
  QtCore::QObject._disconnect(sender, signal.qsignature, receiver, metamethod.qsignature)
end

.emit(sender, signal, *args) ⇒ Object



17
18
19
20
21
22
23
24
25
26
# File 'lib/qt6/qtcore/private/signalmanager.rb', line 17

def self.emit(sender, signal, *args)
  qmo = sender.class._qmetaobject
  qmetamethod = qmo.method(qmo.index_of_signal(signal.qsignature[1..]))

  raise "Too many arguments" if qmetamethod.parameter_count < args.count
  raise "Not enough arguments" if qmetamethod.parameter_count > args.count
  args = args.map.with_index { |arg, i| QtCore::QVariant.new(arg, qmetamethod.parameter_meta_type(i)) }

  QtCore::QObject._emit(sender, qmetamethod, args)
end