PDA

View Full Version : undeclared method - GUI Styles



Amanda
19th November 2006, 03:23
Hi,

I am getting the following error with the style() method.

error: `drawItemText' has not been declared

Do I need to configure Qt 4 (on win32 platform) with an option to get the GUI style libraries to configure correctly (I believe that may be the problem)?

Thanks,
Amanda

Code excerpts:


class StatusLabel : public QLabel
{ Q_OBJECT
public:
StatusLabel(QWidget *parent=0, const char *name=0);

protected:
virtual void paintEvent(QPaintEvent *);
};


void StatusLabel:: paintEvent(QPaintEvent *)
{
QPixmap buffer(size());
buffer.fill(paletteBackgroundColor());
QPainter p(&buffer);
QRect cr = contentsRect();
style().drawItemText(&p, cr, alignment(), colorGroup(), isEnabled(), pixmap(), text());
bitBlt(this, 0, 0, &buffer);
}

wysota
19th November 2006, 08:41
style() returns a pointer to a style, so the code is surely incorrect because you should use "->" instead of "."

jacek
19th November 2006, 13:43
Also make sure you have #include <QStyle>