[PyQt] QString as a method argument using SIP 4.16 and PyQt5

Morren, Earl EMorren at milltronics.net
Fri Feb 6 13:50:41 GMT 2015

Greetings all,

I'm new to this PyQT/SIP game, and I'm trying to call into a custom DLL from Python 3.4. The top-level class in my DLL (UDP_API) has a fairly simple interface:

// Begin udp_api.h
#pragma once

#include "udp_api_global.h"

// "UDP_API" is just a "reference container" class
// The actual API definitions are in the following headers...
#include "command.h"            // class for commanding the backend via the API
#include "cyclic_data.h"          // class for reading status data
#include "events.h"                  // class for setting up notification channels to handle events
#include "device_io.h"
#include "graph_pipeline.h"

class UDP_API_EXPORT UDP_API : public command, public cyclic_data, public events, public device_io, public graph_pipeline
        UDP_API(QString backendAddress);    // This just takes an IP address for the back end (which gets passed on to each referenced class)
        bool LoadProgram(QString path, QString programName);
// End udp_api.h

The associated .sip file looks like so:

// Begin udp_api.sip// Define the SIP wrapper to the udp_api library.
%Module udp_api

class UDP_API {

#include "udp_api.h"
#include "command.h"
#include "cyclic_data.h"
#include "events.h"
#include "device_io.h"
#include "graph_pipeline.h"

    UDP_API(QString backendAddress);
    bool LoadProgram(QString path, QString programName);
// End udp_api.sip

When I run my configure.py and get to the line:
    os.system(" ".join([config.sip_bin, "-c", ".", "-b", build_file, "udp_api.sip"]))
sip fails with the message:
    sip: QString is undefined

I learned from my reading of the PyQt5 documentation that QString is not defined in PyQt/SIP for Python 3. What I'm not understanding is how to modify my .sip file to manage the QString argument types in my class interface. Do I need an alternate interface with something other than QString?

I'm running Python 3.4, Qt 5.3.2, PyQt5 5.3.2, SIP 4.16.5 on Windows 7. Compiler is MinGW 4.8.1.

The answer to this question has got to be simple, but I'm just not seeing it. Thanks in advance for any help.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20150206/78778eaf/attachment.html>

More information about the PyQt mailing list