Converting QtCreator UI file containing custom plugins to .py via PyQt5

15 Views Asked by At

I have created a plugin which is a gauge. I used QQuickWidget to create the plugin. This is my plugin definition class and it works perfectly and will be added to QtCreator components:

class QDESIGNER_WIDGET_EXPORT AnalogeGauge : public QQuickWidget
{
    Q_OBJECT
    Q_PROPERTY(double value READ value WRITE setValue NOTIFY valueChanged)
    Q_PROPERTY(double min READ min WRITE setMin NOTIFY minChanged)
    Q_PROPERTY(double max READ max WRITE setMax NOTIFY maxChanged)
public:
    AnalogeGauge(QWidget *parent = nullptr);

    double value() const;
    void setValue(double value);

    double min() const;
    void setMin(double min);

    double max() const;
    void setMax(double max);

signals:
    void valueChanged(QVariant val);
    void minChanged(QVariant val);
    void maxChanged(QVariant val);

private:
    double _value;
    double _min;
    double _max;
};

After designing my ui with this plugin, I want to convert the .ui to .py. But after using pyuic5 to convert and run the python file, I'll face following error:

  File "ui_form.py", line 44, in <module>
    from analogegauge import AnalogeGauge
ModuleNotFoundError: No module named 'analogegauge'

So it seems the plugin is not added. My question is how to fix this error or how can I convert the plugin also to .py? thanks

0

There are 0 best solutions below