'class QWidget' has no member named 'setFrameStyle'
Asked Answered
S

2

5

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

Shamus answered 4/10, 2013 at 4:58 Comment(0)
B
6

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.

Bub answered 4/10, 2013 at 5:13 Comment(0)
C
3

The reason for having a QWidget here is, that there is an option to use a canvas that is derived from a QGLWidget. But as long as you don't assign it from your application your dynamic_cast ( or qobject_cast ) will always succeed.

Cauchy answered 4/10, 2013 at 14:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.