"QWidget class" does not have a name with the name "setFrameStyle"

I am trying to compile a program (here: http://sourceforge.net/projects/lisem/ ), following the instructions given by the author. However, compiling it in Qt Creator, it gives an error:

class QWidget has no member named setFrameStyle

for these lines of code in LisUIplot.cpp

47 HPlot = new QwtPlot(title, this);
48 layout_Plot->insertWidget(0, HPlot, 1);
49 HPlot->canvas()->setFrameStyle(QFrame::StyledPanel);

and

142 smallPlot = new QwtPlot(title, this);
143 smallPlot->setMinimumSize(300,300);
144 smallPlot->resize(500,500);
145 verticalLayout_6->insertWidget(0, smallPlot, 1);
146 smallPlot->canvas()->setFrameStyle(QFrame::StyledPanel);

I hope you help me with this. Thanks!

By the way, I am using Qt 5.1.1 MinGW 32-bit and Qwt 6.1.0

+4
source share
2 answers

This is expected as it QWidgetdoes not have such a member. This is a member method QFrame.

void QFrame::setFrameStyle(int style)

Note that the canvas getter will return the following type, and not necessarily QFrame:

QWidget * QwtPlot::canvas();
const QWidget * QwtPlot::canvas() const;

dynamic/qobject_cast, QFrame.

+6

QWidget , , QGLWidget. , dynamic_cast ( qobject_cast) .

+3

All Articles