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. Shiboken - Signals don't work
Forum Updated to NodeBB v4.3 + New Features

Shiboken - Signals don't work

Scheduled Pinned Locked Moved Solved Language Bindings
2 Posts 1 Posters 708 Views
  • 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.
  • V Offline
    V Offline
    vberlier
    wrote on last edited by
    #1

    I'm creating a thin c++ wrapper around QtAV and generating bindings for the wrapper with Shiboken.

    // VideoPlayer header file
    Q_SIGNALS:
        void positionChanged(qint64 position);
    
    // VideoPlayer constructor
    m_player = new QtAV::AVPlayer(this);
    connect(m_player, SIGNAL(positionChanged(qint64)), this,
                SIGNAL(positionChanged(qint64)));
    

    My problem is that Shiboken doesn't seem to know about signals, the positionChanged attribute appears to be a plain function and as a result I get this error message:

    Traceback (most recent call last):
      File "sandbox.py", line 48, in <module>
        window = MainWindow()
      File "sandbox.py", line 19, in __init__
        self.player.positionChanged.connect(self._onPositionChanged)
    AttributeError: 'builtin_function_or_method' object has no attribute 'connect'
    
    1 Reply Last reply
    0
    • V Offline
      V Offline
      vberlier
      wrote on last edited by
      #2

      Turns out Shiboken shouldn't do anything for signals and let PySide setup the signals using the MOC data. Shiboken generates bindings for signals as if they were plain methods and shadows the actual signals. I ended up wrapping the signals with an ifdef:

      #ifndef BINDINGS_H
      Q_SIGNALS:
          void positionChanged(qint64 position);
      #endif
      
      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