Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Forum Updated on Feb 6th

    Provide QObject slots and signals features to another class?

    Language Bindings
    1
    2
    6445
    Loading More Posts
    • 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.
    • T
      ThomasDalla last edited by

      Dear community,

      I am currently expanding a class to change it's connections to use QNetwork.
      So my code starts like this:

      @import PySide
      import anotherLib
      ...

      class myClass(anotherLib.originalClass):
      finished = QtCore.Signal(str)
      error = QtCore.Signal(str)
      def init(self,username,password):
      super(myClass,self).init(username, password)
      self.nam = QtNetwork.QNetworkAccessManager()
      ...
      @QtCore.Slot()
      def aMethod(self):
      ...
      self.finished.emit('great')@

      I got an error: AttributeError: 'PySide.QtCore.Signal' object has no attribute 'emit'
      My signal is defined OUTSIDE of init so I don't understand why I have that error?

      Do I have to add anything else to obtain the Slots/Signal benefits?

      1 Reply Last reply Reply Quote 0
      • T
        ThomasDalla last edited by

        Woops, I found the reason by myself...

        @class myClass(anotherLib.originalClass, QtCore.QObject):
        def init(self,username,password):
        QtCore.QObject.init(self)@

        Adding the QObject parent class and calling it during the init

        1 Reply Last reply Reply Quote 0
        • First post
          Last post