Hello everyone! I have a little problem: after subclassing QGraphicsItem in this way:
#ifndef LAYER_H
#define LAYER_H
#include <QGraphicsItem>
#include <QPointF>
#include <QRectF>
#include <QPolygonF>
#include <QPainter>
#include <QPainterPath>
#include <QWidget>
{
public:
{
}
{
painter
->setRenderHint
(QPainter::HighQualityAntialiasing);
}
int getId();
bool setId(int layerId);
signals:
public slots:
private:
int layerId;
protected:
// void mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent);
};
#endif // LAYER_H
#ifndef LAYER_H
#define LAYER_H
#include <QGraphicsItem>
#include <QPointF>
#include <QRectF>
#include <QPolygonF>
#include <QPainter>
#include <QPainterPath>
#include <QWidget>
class Layer : public QGraphicsItem
{
public:
Layer(int layerId = -1, QString layerName = "", QGraphicsItem *parent = 0);
QRectF boundingRect() const
{
return QRectF(QPoint(0,0), QSizeF(10000.0, 10000.0)); //size can change
}
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
QWidget *widget)
{
painter->setRenderHint(QPainter::HighQualityAntialiasing);
}
int getId();
bool setId(int layerId);
QString getName();
bool setName(QString layerName);
signals:
public slots:
private:
int layerId;
QString layerName;
protected:
// void mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent);
};
#endif // LAYER_H
To copy to clipboard, switch view to plain text mode
The Layer class should work as a container for map tiles 256x256 px each. I got tiles displayed properly in a QGraphicsScene but when I add a Layer into it and then add same map tiles I get a blank screen. Debugging however shows that my parent Label contains correct number of tiles in it.
Thanx in advance!
Bookmarks