Hello, such a problem:

/home/u0807/QtApplication_2/main.cpp:182: ошибка: variable 'QGraphicsView v' has initializer but incomplete type QGraphicsView v(&m); ^ 
 #include <QGraphicsScene> #include <QGraphicsItem> int main(int argc, char *argv[]) { QApplication app(argc, argv); myClass m; QGraphicsView v(&m); v.setWindowFlags(Qt::FramelessWindowHint); v.setWindowFlags(Qt::WindowStaysOnTopHint); v.setRenderHints(QPainter::Antialiasing); v.show(); v.setGeometry(1320, 610, 23, 125); return app.exec(); } 

Tell me please.

    1 answer 1

    Add in the beginning:

     #include <QGraphicsView> 

    Explanation

    In Qt, forward declarations are applied wherever possible. This speeds up compilation, as it reduces the number of #include process.

    This error just occurs when the compiler has only a forward-declaration, and in this place you need a complete definition.