Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'class QWidget' has no member named 'setFrameStyle'

I'm trying to compile a program (found here: http://sourceforge.net/projects/lisem/) by following the instructions said by the author. However, when compiling it in Qt Creator, it gives the 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 can help me on this. Thank you!

BTW, I am using Qt 5.1.1 MinGW 32-bit and Qwt 6.1.0

like image 436
Mark Avatar asked Oct 04 '13 04:10

Mark


1 Answers

This is quite expected since QWidget has no such a member. That is a QFrame member method.

void QFrame::setFrameStyle(int style)

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

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

It should be checked with dynamic/qobject_cast if the returned value is actually a QFrame.

like image 191
lpapp Avatar answered Nov 14 '22 21:11

lpapp