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
    explicit CustomWidget(QGraphicsView *parent = 0);
    void paintEvent(QPaintEvent *);

    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


    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.