GillesDebunne / libQGLViewer

libQGLViewer is an open source C++ library based on Qt that eases the creation of OpenGL 3D viewers.
Other
245 stars 94 forks source link

sharewidget warning #39

Closed tompollok closed 7 years ago

tompollok commented 7 years ago

I get a warning for when i create an object from my derived QGLViewer

The constructor with a QGLFormat is deprecated, use the regular contructor instead.

class DerivedViewer : public QGLViewer { public: DerivedViewer() { //nothing }

}

DerivedViewer* viewer = new DerivedViewer();

QGLViewer::QGLViewer(const QGLFormat &format, QWidget parent, const QGLWidget shareWidget, Qt::WindowFlags flags) : QOpenGLWidget(parent, flags) { Q_UNUSED(format); Q_UNUSED(shareWidget); qWarning("The constructor with a QGLFormat is deprecated, use the regular " "contructor instead."); defaultConstructor(); }

What am i supposed to not get the warning?

GillesDebunne commented 7 years ago

Hi,

This message was added after the switch to QOpenGLWidget in version 2.7.0.

The constructor with no parameters you create should not call this method, it should call

QGLViewer(QWidget *parent = 0, const QGLWidget *shareWidget, Qt::WindowFlags flags)

instead.

Can you make sure there is no version mismatch between your headers and the library. Did you update both, and recompile everything from scratch. That would be my guess here.

GillesDebunne commented 7 years ago

Closing. Please reopen if this is still an issue.

CDitzel commented 7 years ago

Im sorry, I dont get your explanation. Even the accompanying examples prompt the warning that the contructor is deprecated. I subclassed QGLViewe in this fashion

ViewerWidget::ViewerWidget(QString const& path, QWidget* parent) : QGLViewer{ parent } , pathimage_{ path } {}`

and get the warning, what am I supposed to to here?

GillesDebunne commented 7 years ago

You are absolutely right, there is a mismatch between the new QOpenGLWidget constructor and the deprecated ones kept for backward compatibility.

A new 2.7.1 release should fix the problem. Feel free to comment if there is still an issue.