Custom QGraphicsView



  • Hello, Community!! Can you help me? I want to create paintable QGraphicsView -> creating class CustomGraphicsView -> inherrits of QGraphicsView, but when I change QGraphicsView on Designer -> it's generate error "CustomGraphicsView has not name of type"

    #ifndef CUSTOMWIDGET_H
    #define CUSTOMWIDGET_H

    #include <QWidget>
    #include <QGraphicsView>

    class CustomWidget : public QGraphicsView
    {
    Q_OBJECT
    public:
    explicit CustomWidget(QGraphicsView *parent = 0);
    ~CustomWidget();
    void paintEvent(QPaintEvent *);
    signals:

    public slots:
    };

    #endif // CUSTOMWIDGET_H



  • The simplest way to use your "custom view" widget in designer is to place QGraphicsView instead then "promote" it to your class and specify header file to be used.


  • Lifetime Qt Champion

    Hi,

    It's because your class is called CustomWidget and not CustomGraphicsView


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.