在qt學習之路上看到的一段代碼。緊急求助!請問“start was not declared in this scope ”怎么解決?同樣的end也有這樣的問題,如何宣告這個變數呢?
#ifndef SHAPE_H
#define SHAPE_H
#include <QMainWindow>
namespace Ui {
class Shape;
}
class Shape : public QMainWindow
{
Q_OBJECT
public:
explicit Shape(QWidget *parent = 0);
~Shape();
enum Code {Line,Rect};Shape();
void setStart(QPoint s)
{
start= s;
}
void setEnd(QPoint e)
{
end= e;
}
QPoint startPoint()
{
return start;
}
QPoint endPoint()
{
return end;
}
void virtual paint(QPainter & painter) = 0;
private:
Ui::Shape *ui;
};
#endif // SHAPE_H
uj5u.com熱心網友回復:
類里加 QPoint start;uj5u.com熱心網友回復:
private:Ui::Shape *ui;
QPoint start;
QPoint end;
start,end未定義而已
uj5u.com熱心網友回復:
太感謝了!順利解決了轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/102788.html
標籤:Qt
上一篇:在AndroidStudio里面搭建SQL資料庫時出現如下問題
下一篇:Android RecyclerView + drakeet.multitype 復雜布局實作瀑布流出現閃爍,留白的問題
