[PyQt] SIP wrapper fo convert C++ widgets into python modules
blipton at lycos.com
blipton at lycos.com
Sun Aug 17 23:40:32 BST 2014
I've been chipping a way at trying to use a set of Qt widgets I found,
in a PyQt application
Despite generating the dll/lib files for the widget plugin, and using it
to generate a .ui file in PyQt Designer, now I'm stuck at the point
where the .ui file doesn't load because the widget's module cannot be
found.
The solution seems to be that each widget's cpp will first need to be
converted into a python module. Unfortunately, haven't found much
information on how to do this in PyQt5. An example on the
RiverBankComputing website is dead:
http://stackoverflow.com/questions/1607515/pyqt-custom-widget-in-c
For example, this is the header for one of the widgets, how would it
need to be converted by sip?
#ifndef QLED_H
#define QLED_H
#include <QColor>
#include "widgetwithbackground.h"
/**
* Klasa reprezentuj±ca diodê w dowolnym kolorze jako dwustabilny
element wskazuj±cy
*/
class Led : public WidgetWithBackground
{
Q_OBJECT
Q_PROPERTY( bool checked READ isChecked WRITE setChecked)
Q_PROPERTY( QColor color READ color WRITE setColor)
public:
Led(QWidget *parent = 0);
virtual ~Led() {};
/** Zdarzenie obs³uguj±ce malowanie kontrolki */
void paintEvent(QPaintEvent * event);
bool isChecked () const ;
QColor color() const;
void setColor(QColor);
public slots:
void setChecked(bool);
signals:
void checkChanged(bool val);
protected:
/** Inicjuje uk³ad wspó³rzêdnych paintera */
void initCoordinateSystem(QPainter & painter);
/**
* Maluje t³o kontrolki w tym przypadku pierwszy plan czyli odblask
¶wiat³a kontrolki
* @param painter Przestrzeñ kontrolki
*/
void paintBackground(QPainter & painter);
protected:
bool m_checked;
QColor m_color;
};
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20140817/25a1503a/attachment-0001.html>
More information about the PyQt
mailing list