[PyQt] Custom C++ types as signal arguments

David Boddie davidb at met.no
Sat Sep 28 14:31:41 BST 2013


On 28 September 2013 14:29:03, Phil Thompson wrote:

> On Tue, 24 Sep 2013 13:24:05 +0000 (UTC), David Boddie <davidb at met.no>
> wrote:

> > My sip wrapper starts with a typedef for the StringList type and
> > %MappedType
> > implementations for std::string and StringList:
> 
> Remove this typedef...
> 
> >   typedef std::vector<std::string> StringList;

[...]

> SIP should probably complain about the typedef as you are effectively
> providing two definitions for StringList.
> 
> Also in the current snapshot at least, you get a sensible exception.

Thanks for the correction - it works! In fact, removing the StringList
type altogether appears to work, which puts me back in the position I
started in, but with working code. The typedef was originally put in as
a workaround for the crash and because I had noticed that the emitStrings
signal was defined in the generated C++ code with "unknown-type":

  /* Define this type's PyQt4 signals. */
  static const pyqt4QtSignal pyqt4_signals_Emitter[] = {
      {"emitQString(QString)", "\1Emitter.emitQString[QString]", 0},
      {"emitStr(std::string,std::string)", "\1Emitter.emitStr[string, string]", 0},
      {"emitStrings(std::vector<std::string>)", "\1Emitter.emitStrings[unknown-type]", 0},
      {0, 0, 0}
  };

I'll try this out again on Monday and see what, if anything, I've been
doing differently.

Thanks again for the help.

David


More information about the PyQt mailing list