Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt Custom control. Problem with Q_PROPERTY() and QConicalGradient
Forum Update on Monday, May 27th 2025

Qt Custom control. Problem with Q_PROPERTY() and QConicalGradient

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 181 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    oxoocoffee
    wrote on 21 Feb 2019, 22:19 last edited by
    #1

    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>
     
    Q_DECLARE_METATYPE(QConicalGradient)
     
    class QDESIGNER_WIDGET_EXPORT GradMeter : public QWidget {
        Q_OBJECT
        Q_PROPERTY(QConicalGradient powGrandient READ powGradient WRITE setPowGradient)
     
        public:
            explicit GradMeter(QWidget *parent = nullptr);
     
            const QConicalGradient& powGradient() const { return _gradient; }
            void  setPowGradient(const QConicalGradient &gradient) { _gradient = gradient; }
     
        private:
            void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
     
        private:
            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.

    1 Reply Last reply
    0

    1/1

    21 Feb 2019, 22:19

    • Login

    • Login or register to search.
    1 out of 1
    • First post
      1/1
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved