Hello all!
I'm having a serious problem with what seems to be all events. Whenever I use them I get an error "pointer to incomplete class type not allowed". This is compiled under Visual Studio 2010. I've gone up the entire event source code and as far as I can tell, everything is actually right. Since I don't really know what this error means It's difficult to track down. Derived classes from QWidget compile, link, and work fine. Trying to use any event kind from inside any file has the same issue, so I highly doubt its a coding error on my side, unless I'm missing an include or something.
Here is a code sample from QSFMLTileSheet.cpp
#include "QSFMLTileSheet.h"
void QSFMLTileSheet
::mousePressEvent(QMouseEvent* evt
) { if ((evt->x() > 0) {
//execute code
}
}
#include "QSFMLTileSheet.h"
void QSFMLTileSheet::mousePressEvent(QMouseEvent* evt) {
if ((evt->x() > 0) {
//execute code
}
}
To copy to clipboard, switch view to plain text mode
Trying to use evt gives the error "pointer to incomplete class type not allowed". Here is the header chain to QWidget.
QSFMLTileSheet.h
#ifndef INC_QSFMLTILESHEET_H
#define INC_QSFMLTILESHEET_H
#include "QSFMLCanvas.h"
#include "TileSheet.h"
namespace Toolkit {
class QSFMLTileSheet : public QSFMLCanvas {
public:
QSFMLTileSheet
(QWidget* Parent
= 0,
const QPoint
& Position
= QPoint(0,
0),
const QSize
& Size
= QSize(0,
0),
unsigned int FrameTime
= 0,
bool StretchResize
= false);
TileSheet* GetTileSheet();
void SetTileSheet(TileSheet* TSheet);
unsigned int GetWidth();
unsigned int GetHeight();
void SetSelectable(bool Enable);
bool GetSelectable();
void SetGridDrawing(bool Enable);
bool GetGridDrawing();
void SetDrawMouseHover(bool Enable);
bool GetDrawMouseHover();
void SetSelectedTileID(unsigned int TileID);
unsigned int GetSelectedTileID();
unsigned int GetTileXCountFromID(unsigned int TileID);
unsigned int GetTileYCountFromID(unsigned int TileID);
unsigned int GetMouseHoverTileID();
protected:
void OnInit();
void OnUpdate();
private:
TileSheet* tsheet;
sf::Sprite tsheetPreview;
bool gridNeedsUpdating;
bool drawTileGrid;
bool selectable;
bool drawMouseHover;
unsigned int selectedTileID;
};
}
#endif
#ifndef INC_QSFMLTILESHEET_H
#define INC_QSFMLTILESHEET_H
#include "QSFMLCanvas.h"
#include "TileSheet.h"
namespace Toolkit {
class QSFMLTileSheet : public QSFMLCanvas {
public:
QSFMLTileSheet(QWidget* Parent = 0, const QPoint& Position = QPoint(0,0), const QSize& Size = QSize(0,0), unsigned int FrameTime = 0, bool StretchResize = false);
TileSheet* GetTileSheet();
void SetTileSheet(TileSheet* TSheet);
unsigned int GetWidth();
unsigned int GetHeight();
void SetSelectable(bool Enable);
bool GetSelectable();
void SetGridDrawing(bool Enable);
bool GetGridDrawing();
void SetDrawMouseHover(bool Enable);
bool GetDrawMouseHover();
void SetSelectedTileID(unsigned int TileID);
unsigned int GetSelectedTileID();
unsigned int GetTileXCountFromID(unsigned int TileID);
unsigned int GetTileYCountFromID(unsigned int TileID);
unsigned int GetMouseHoverTileID();
protected:
void OnInit();
void OnUpdate();
void mousePressEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
private:
TileSheet* tsheet;
sf::Sprite tsheetPreview;
bool gridNeedsUpdating;
bool drawTileGrid;
bool selectable;
bool drawMouseHover;
unsigned int selectedTileID;
};
}
#endif
To copy to clipboard, switch view to plain text mode
QSFMLCanvas.h
#ifndef INC_QSFMLCANVAS_H
#define INC_QSFMLCANVAS_H
#include <SFML/Graphics.hpp>
#include <Qt/qwidget.h>
#include <Qt/qtimer.h>
namespace Toolkit {
class QSFMLCanvas
: public QWidget,
public sf
::RenderWindow { public:
QSFMLCanvas
(QWidget* Parent,
const QPoint
& Position,
const QSize
& Size,
unsigned int FrameTime
= 0,
bool StretchResize
= false);
virtual ~QSFMLCanvas();
protected:
virtual void OnInit();
virtual void OnUpdate();
bool myInitialized;
};
}
#endif
#ifndef INC_QSFMLCANVAS_H
#define INC_QSFMLCANVAS_H
#include <SFML/Graphics.hpp>
#include <Qt/qwidget.h>
#include <Qt/qtimer.h>
namespace Toolkit {
class QSFMLCanvas : public QWidget, public sf::RenderWindow {
public:
QSFMLCanvas(QWidget* Parent, const QPoint& Position, const QSize& Size, unsigned int FrameTime = 0, bool StretchResize = false);
virtual ~QSFMLCanvas();
protected:
virtual void OnInit();
virtual void OnUpdate();
virtual QPaintEngine* paintEngine() const;
virtual void showEvent(QShowEvent*);
virtual void paintEvent(QPaintEvent*);
QTimer myTimer;
bool myInitialized;
};
}
#endif
To copy to clipboard, switch view to plain text mode
I'm not sure where to go from here. I don't mind having to recompile Qt.
Any help is appreciated, Thanks.
Bookmarks