Qt-interest Archive, October 2006
problem on making an QGraphicsPixmapItem object
Message 1 in thread
I wrote my custom class derived from QGraphicsPixmapItem class; including two files (pacman.h & Pacman.cpp); but process of make operation causes the below error message. Please give me help, Thank you!!
-----------------------------------
debug\moc_pacman.cpp:37: error: `staticMetaObject' is not a member of `QGraphic
PixmapItem'
debug\moc_pacman.cpp: In member function `virtual void* Pacman::qt_metacast(con
t char*)':
debug\moc_pacman.cpp:51: error: `qt_metacast' is not a member of `QGraphicsPixm
pItem'
debug\moc_pacman.cpp: In member function `virtual int Pacman::qt_metacall(QMeta
bject::Call, int, void**)':
debug\moc_pacman.cpp:56: error: `qt_metacall' is not a member of `QGraphicsPixm
pItem'
-------------------------
code of Pacman.cpp as below:
#include "pacman.h"
#include <QPainter>
#include <QPainterPath>
Pacman::Pacman()
:xPos(60),yPos(80),QGraphicsPixmapItem()
{
setPixmap(QPixmap(":/images/pacman02.png"));
}
QPainterPath Pacman::shape() const
{
QPainterPath path;
path.addRect(boundingRect());
return path;
}
-------------------------
code of pacman.h as below:
#ifndef PACMAN_H
#define PACMAN_H
#include <QGraphicsItem>
#include <QGraphicsView>
#include <QGraphicsScene>
#include <QGraphicsSceneEvent>
#include <QMouseEvent>
class Pacman:public QGraphicsPixmapItem{
Q_OBJECT
public:
Pacman();
QPainterPath shape() const;
private:
qreal xPos,yPos;
};
#endif
-------------------
At last, thanks to Dimitri and Scott Aron Bloom for the solution of my prior problem.
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Message 2 in thread
On Sunday 01 October 2006 14:16, troll djbdl wrote:
> I wrote my custom class derived from QGraphicsPixmapItem class;
> including two files (pacman.h & Pacman.cpp); but process of make
> operation causes the below error message.
[...]
> code of pacman.h as below:
> #ifndef PACMAN_H
> #define PACMAN_H
> #include <QGraphicsItem>
> #include <QGraphicsView>
> #include <QGraphicsScene>
> #include <QGraphicsSceneEvent>
> #include <QMouseEvent>
> class Pacman:public QGraphicsPixmapItem{
> Q_OBJECT
QGraphicsPixmapItem is not derived from QObject. Therefore this
macro here will fail.
Heiner
--
[ signature omitted ]