darksaga
22nd August 2007, 17:09
hi ppl,
I've got the following small prob:
#include <QtGui>
class MyGraphicsItem : public QGraphicsItem
{
public:
MyGraphicsItem(QGraphicsItem *parent = 0) : QGraphicsItem(parent), _width(40), _height(10){}
~MyGraphicsItem(void){qDebug("delBand");}
QRectF boundingRect() const{
return QRectF(0, 0, _width, _height);
}
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0){
painter->setBrush(Qt::darkRed);
painter->setPen(Qt::black);
painter->drawRoundRect(0, 0, _width, _height);
}
private:
int _width;
int _height;
};
using:
setToolTip(QString("testToolTip"));
in the constructor, works perfectly to enable tooltips for the item
but using:
QString toolTip() const {
return QString("testToolTip");
}
does not work
why???:confused:
I've got the following small prob:
#include <QtGui>
class MyGraphicsItem : public QGraphicsItem
{
public:
MyGraphicsItem(QGraphicsItem *parent = 0) : QGraphicsItem(parent), _width(40), _height(10){}
~MyGraphicsItem(void){qDebug("delBand");}
QRectF boundingRect() const{
return QRectF(0, 0, _width, _height);
}
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0){
painter->setBrush(Qt::darkRed);
painter->setPen(Qt::black);
painter->drawRoundRect(0, 0, _width, _height);
}
private:
int _width;
int _height;
};
using:
setToolTip(QString("testToolTip"));
in the constructor, works perfectly to enable tooltips for the item
but using:
QString toolTip() const {
return QString("testToolTip");
}
does not work
why???:confused: