<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html><body style='font-size: 10pt; font-family: Verdana,Geneva,sans-serif'>
<p>I've been chipping a way at trying to use a set of Qt widgets I found, in a PyQt application</p>
<p> </p>
<p>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.</p>
<p> </p>
<p>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:</p>
<p>http://stackoverflow.com/questions/1607515/pyqt-custom-widget-in-c</p>
<p> </p>
<p> </p>
<p>For example, this is the header for one of the widgets, how would it need to be converted by sip?</p>
<p><br />#ifndef QLED_H<br />#define QLED_H<br />#include <QColor> <br />#include "widgetwithbackground.h"</p>
<p>/**<br /> * Klasa reprezentuj±ca diodê w dowolnym kolorze jako dwustabilny element wskazuj±cy <br /> */<br /> class Led : public WidgetWithBackground<br /> {<br /> Q_OBJECT <br /> Q_PROPERTY( bool checked READ isChecked WRITE setChecked)<br /> Q_PROPERTY( QColor color READ color WRITE setColor) <br /> <br /> <br /> public: <br /> <br /> Led(QWidget *parent = 0);<br /> virtual ~Led() {};<br /> <br /> /** Zdarzenie obs&sup3;uguj±ce malowanie kontrolki */ <br /> void paintEvent(QPaintEvent * event);<br /> <br /> bool isChecked () const ; <br /> <br /> <br /> QColor color() const; <br /> void setColor(QColor); <br /> <br /> public slots: <br /> <br /> void setChecked(bool); <br /> <br /> signals: <br /> <br /> void checkChanged(bool val); <br /> <br /> protected:<br /> <br /> /** Inicjuje uk&sup3;ad wspó&sup3;rzêdnych paintera */<br /> void initCoordinateSystem(QPainter & painter);<br /> <br /> /**<br /> * Maluje t&sup3;o kontrolki w tym przypadku pierwszy plan czyli odblask ¶wiat&sup3;a kontrolki<br /> * @param painter Przestrzeñ kontrolki <br /> */<br /> void paintBackground(QPainter & painter);<br /> <br /> protected: <br /> <br /> bool m_checked; <br /> QColor m_color;</p>
<p>};</p>
<p><span style="font-family: 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 12px;"> </span></p>
<div> </div>
</body></html>