[英]g++ Parse error at “:”
g++
使用以下代碼報告解析錯誤:
class Sy_timeLineDelegateScene : public QGraphicsScene
{
Q_OBJECT
public:
Sy_timeLineDelegateScene( Sy_animPropertyTimeLine* timeline,
Sy_animClock* clock,
QObject* parent = nullptr );
virtual ~Sy_timeLineDelegateScene() {}
protected slots: // Parse error at ":"
typedef QMap< Sy::Frame, Sy_timeLineDelegateKey* > DelegateTimeLine;
...
我的類派生自QObject
,我在錯誤之前聲明了Q_OBJECT
宏,但是如果我注釋掉slots
部分,它編譯得很好。 我已經使用Qt
多年了,從來沒有見過這個,它一定是愚蠢的東西,但我看不出是什么導致了這個問題。
類定義中的“槽”和“信號”部分應僅包含函數; 無論是類型還是成員變量。
您應該在公共,受保護或私有部分中移動typedef
:
class Sy_timeLineDelegateScene : public QGraphicsScene
{
Q_OBJECT
public:
Sy_timeLineDelegateScene( Sy_animPropertyTimeLine* timeline,
Sy_animClock* clock,
QObject* parent = nullptr );
virtual ~Sy_timeLineDelegateScene() {}
typedef QMap< Sy::Frame, Sy_timeLineDelegateKey* > DelegateTimeLine;
protected slots:
...
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.