Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Qt 6
  4. 'emit' in 'pyqtSignal not find
Forum Updated to NodeBB v4.3 + New Features

'emit' in 'pyqtSignal not find

Scheduled Pinned Locked Moved Unsolved Qt 6
8 Posts 3 Posters 2.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • YattaraY Offline
    YattaraY Offline
    Yattara
    wrote on last edited by
    #1

    Cannot find reference 'emit' in 'pyqtSignal | pyqtSignal'

    Hello everyone, can anyone help me understand this problem?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Without the code triggering the message, no.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      YattaraY 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        Without the code triggering the message, no.

        YattaraY Offline
        YattaraY Offline
        Yattara
        wrote on last edited by Yattara
        #3

        @SGaist
        Here is the code

        import sys
        from PyQt6.QtWidgets import *
        from PyQt6.QtCore import pyqtSignal

        class FenetreSimple(QWidget):
        simpleSignal = pyqtSignal()
        signalAvance = pyqtSignal(int, list, str)

        def __init__(self, parent=None):
            super(FenetreSimple, self).__init__(parent)
            self.edition = None
            self.editionCopie = None
            self.fermer = None
            self.disposition = None
            self.execute()
        
        def execute(self):
            self.resize(250, 300)
            self.move(500, 200)
        
            self.edition = QLineEdit()
            self.disposition.addWidget(self.edition)
        
            self.editionCopie = QLineEdit()
            self.disposition.addWidget(self.editionCopie)
        
            self.edition.textChanged.connect(self.exempleSlot)
        
            self.setLayout(self.disposition)
        
        def boutonSlot(self, checked=False):
            self.simpleSignal.emit(2, [1, 2, 3], 'Hello')
        
        def slotAvance(self, *args):
            print("I am a simple slot")
            print(args[0])
            print(args[2])
        
            self.show()
        

        if name == 'main':
        application = QApplication(sys.argv)
        fenetre = FenetreSimple()
        sys.exit(application.exec())

        JonBJ 1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Why are you mixing PySide6 and PyQt6 ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          YattaraY 1 Reply Last reply
          0
          • SGaistS SGaist

            Why are you mixing PySide6 and PyQt6 ?

            YattaraY Offline
            YattaraY Offline
            Yattara
            wrote on last edited by
            #5

            @SGaist
            I uninstalled pyside6, but the problem persists

            1 Reply Last reply
            0
            • YattaraY Yattara

              @SGaist
              Here is the code

              import sys
              from PyQt6.QtWidgets import *
              from PyQt6.QtCore import pyqtSignal

              class FenetreSimple(QWidget):
              simpleSignal = pyqtSignal()
              signalAvance = pyqtSignal(int, list, str)

              def __init__(self, parent=None):
                  super(FenetreSimple, self).__init__(parent)
                  self.edition = None
                  self.editionCopie = None
                  self.fermer = None
                  self.disposition = None
                  self.execute()
              
              def execute(self):
                  self.resize(250, 300)
                  self.move(500, 200)
              
                  self.edition = QLineEdit()
                  self.disposition.addWidget(self.edition)
              
                  self.editionCopie = QLineEdit()
                  self.disposition.addWidget(self.editionCopie)
              
                  self.edition.textChanged.connect(self.exempleSlot)
              
                  self.setLayout(self.disposition)
              
              def boutonSlot(self, checked=False):
                  self.simpleSignal.emit(2, [1, 2, 3], 'Hello')
              
              def slotAvance(self, *args):
                  print("I am a simple slot")
                  print(args[0])
                  print(args[2])
              
                  self.show()
              

              if name == 'main':
              application = QApplication(sys.argv)
              fenetre = FenetreSimple()
              sys.exit(application.exec())

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by JonB
              #6

              @Yattara said in 'emit' in 'pyqtSignal not find:

              simpleSignal = pyqtSignal()
              signalAvance = pyqtSignal(int, list, str)
              self.simpleSignal.emit(2, [1, 2, 3], 'Hello')
              

              Although the error message sounds surprising, try calling the correct signal for the parameters you pass and see if it changes?

              Otherwise please copy and paste the error message and confirm the line number it is on.

              YattaraY 1 Reply Last reply
              1
              • JonBJ JonB

                @Yattara said in 'emit' in 'pyqtSignal not find:

                simpleSignal = pyqtSignal()
                signalAvance = pyqtSignal(int, list, str)
                self.simpleSignal.emit(2, [1, 2, 3], 'Hello')
                

                Although the error message sounds surprising, try calling the correct signal for the parameters you pass and see if it changes?

                Otherwise please copy and paste the error message and confirm the line number it is on.

                YattaraY Offline
                YattaraY Offline
                Yattara
                wrote on last edited by
                #7

                @JonB
                Thank you, I corrected this error, but the problem still persists

                SGaistS 1 Reply Last reply
                0
                • YattaraY Yattara

                  @JonB
                  Thank you, I corrected this error, but the problem still persists

                  SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @Yattara Next time please ensure that your example really allows to reproduce your issue. Here boutonSlot will never be called because it's not called from anywhere. Also, your FenetreSimple widget is never shown.

                  Anyway, here is a small example that works with a complex signal.

                  import sys
                  
                  from PyQt6.QtWidgets import QApplication
                  from PyQt6.QtWidgets import QPushButton
                  from PyQt6.QtWidgets import QHBoxLayout
                  from PyQt6.QtWidgets import QWidget
                  from PyQt6.QtCore import pyqtSignal
                  
                  class Widget(QWidget):
                      complex_signal = pyqtSignal(int, list, str)
                  
                      def __init__(self, parent=None):
                          super().__init__(parent)
                  
                          button = QPushButton("Test me")
                          layout = QHBoxLayout(self)
                          layout.addWidget(button)
                  
                          button.clicked.connect(self.on_clicked)
                          self.complex_signal.connect(self.on_complex_signal)
                  
                      def on_clicked(self, checked=False):
                          self.complex_signal.emit(2, [1, 2, 3], 'Hello')
                  
                      def on_complex_signal(self, *args):
                          for idx, item in enumerate(args):
                              print(idx, item)
                  
                  
                  if __name__ == '__main__':
                      application = QApplication(sys.argv)
                      widget = Widget()
                      widget.show()
                      sys.exit(application.exec())
                  

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  2

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved