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. Custom QGraphicsView
Qt 6.11 is out! See what's new in the release blog

Custom QGraphicsView

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 2.1k Views 1 Watching
  • 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.
  • S Offline
    S Offline
    Sanchir Kartiev
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • A Offline
      A Offline
      alex_malyu
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

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

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0

        • Login

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