Important: Please read the Qt Code of Conduct -

Qt Custom control. Problem with Q_PROPERTY() and QConicalGradient

  • Hello,

    I am trying to build a custom Widget/plugin. I have everything set up. I am using qt 5.12.1 with creator 4.8.1

    1. I can build my plugin and generate so file
    2. Copy my so file to /home/rob/qt_plugin/designer/
    3. export QT_PLUGIN_PATH=/home/rob/qt_plugin/
    4. Start Qt Creator from a terminal and open simple empty test application
    5. Drag my control from creator toolbar to the main canvas and run my application.

    So everything is ok so far. The problem is as step 5 when I drag it to a canvas I see an error in the terminal in which I started qt creator. The error is generated when I drop my control. Here is the error:

    The property "powGrandient" of type (unknown) is not supported yet!

    Here is stripped down version of my header that I am using to test this

    // H Source
    #include <QWidget>
    #include <QConicalGradient>
    #include <QtUiPlugin/QDesignerExportWidget>
    class QDESIGNER_WIDGET_EXPORT GradMeter : public QWidget {
        Q_PROPERTY(QConicalGradient powGrandient READ powGradient WRITE setPowGradient)
            explicit GradMeter(QWidget *parent = nullptr);
            const QConicalGradient& powGradient() const { return _gradient; }
            void  setPowGradient(const QConicalGradient &gradient) { _gradient = gradient; }
            void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
            QConicalGradient _gradient;

    Here is my cpp

    GradMeter::GradMeter(QWidget *parent) : QWidget(parent) {
        _gradient = QConicalGradient(0, 0, 180);
        _gradient.setColorAt(0, Qt::red);
        _gradient.setColorAt(0.2, Qt::yellow);
        _gradient.setColorAt(0.8, Qt::green);
    void GradMeter::paintEvent(QPaintEvent *) {
        // Some drawing code here
        QPainter painter(this);

    So from my research, I found out that if I and trying to use my custom class I would have to do little extra coding with QDesignerPropertySheetExtension to describe to Qt creator property editor how my custom class looks like.
    But this is not the case since I am trying to use Qt building class from QConicalGradient from qbrish.h

    Looking at QConicalGradient class see it is derived from QGradient which is missing Q_ENUM(InterpolationMode). All other enums in this class do have QENUM() for it. Is this the problem?

    Anyone can point me how to fix this problem?

    Thank you in advance.

Log in to reply