Nominate our 2022 Qt Champions!

QGraphicsView hidden constructors

  • I created a new class inheriting from QGraphicsView and since I have to provide the same superclass constructors, I noticed on the docs that there are two of them

    • QGraphicsView::QGraphicsView(QWidget * parent = 0) and
    • QGraphicsView::QGraphicsView(QGraphicsScene * scene, QWidget * parent = 0)

    However, inside QtCreator, two additionals constructors/functions are shown:

    • QGraphicsView::QGraphicsView(QGraphicsViewPrivate &, QWidget * parent = 0) and
    • QGraphicsView::QGraphicsView(const QGraphicsView &)

    I can't find any indication about these two methods anywhere. I can't even find anything explaining what a QGraphicsViewPrivate is.

    Are there some kind of private members?
    I am using extra/qt5-base 5.5.1-9 (qt qt5) with extra/qtcreator 3.6.0-1 on Archlinux with kernel 4.3.3-3-ARCH.

  • Hi!

    • QGraphicsView::QGraphicsView(const QGraphicsView &) is just an ordinary copy constructor. You are not allowed to access it due to the design of QObject, see: No Copy Constructor or Assignment Operator.
    • QGraphicsViewPrivate is not part of the public API and thus you shouldn't use it. If you really wanted to you it you would have to include the corresponding private headers.

  • @Wieland Thank you, I guessed the first was some kind of copy constructor.
    As concerns the second, it was just a curiosity of mine. Thank you :)