33 _text =
new QGraphicsTextItem(
this);
34 _text->setVisible(
false);
49 this->
setData(QPointF(
id, value));
60 QMap<int, QByteArray>::const_iterator iter =
_imagesRef->find(
int(this->
data().x()));
63 if(img.loadFromData(iter.value(),
"JPEG"))
65 QPixmap scaled = QPixmap::fromImage(img).scaledToWidth(128);
66 _img =
new QGraphicsPixmapItem(scaled,
this);
67 _img->setVisible(
false);
73 _text->setPos(this->mapFromScene(4+150,0));
75 _text->setPos(this->mapFromScene(4,0));
78 _text->setPlainText(QString(
"ID = %1\nValue = %2\nWeight = %3").arg(this->
data().x()).arg(this->
data().y()).arg(
_childCount));
82 _text->setPlainText(QString(
"ID = %1\nValue = %2").arg(this->
data().x()).arg(this->
data().y()));
84 _text->setVisible(
true);
87 _img->setPos(this->mapFromScene(4,0));
88 _img->setVisible(
true);
93 _text->setVisible(
false);
95 _img->setVisible(
false);
106 _imagesMapRef(imagesMapRef)
123 ULOGGER_DEBUG(
"dataMap=%d, weightsMap=%d", dataMap.size(), weightsMap.size());
124 if(dataMap.size() > 0)
127 int margin = int((
_items.size()+1)/2) - dataMap.size();
146 QList<QGraphicsItem*>::iterator iter =
_items.begin();
147 for(QMap<int, int>::const_iterator i=dataMap.begin(); i!=dataMap.end(); ++i)
150 ((
PdfPlotItem*)*iter)->setLikelihood(i.key(), i.value(), weightsMap.value(i.key(),-1));
PdfPlotCurve(const QString &name, const QMap< int, QByteArray > *imagesMapRef, QObject *parent=0)
void setLikelihood(int id, float value, int childCount)
void setImagesRef(const QMap< int, QByteArray > *imagesRef)
int removeItem(int index)
QGraphicsPixmapItem * _img
void setData(const QMap< int, int > &dataMap, const QMap< int, int > &weightsMap)
#define UASSERT(condition)
virtual void showDescription(bool shown)
PdfPlotItem(float dataX, float dataY, float width, int childCount=-1)
#define ULOGGER_DEBUG(...)
void _addValue(UPlotItem *data)
const QMap< int, QByteArray > * _imagesMapRef
QList< QGraphicsItem * > _items
virtual void showDescription(bool shown)
QGraphicsTextItem * _text
ULogger class and convenient macros.
void setData(const QPointF &data)
const QPointF & data() const
const QMap< int, QByteArray > * _imagesRef
void dataChanged(const UPlotCurve *)