Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Language Bindings
  4. Provide QObject slots and signals features to another class?
Forum Updated to NodeBB v4.3 + New Features

Provide QObject slots and signals features to another class?

Scheduled Pinned Locked Moved Language Bindings
2 Posts 1 Posters 6.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.
  • T Offline
    T Offline
    ThomasDalla
    wrote on last edited by
    #1

    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
    0
    • T Offline
      T Offline
      ThomasDalla
      wrote on last edited by
      #2

      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
      0

      • Login

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