При сборки проекта получаю ошибки

Пытаюсь подключить 'Delegate' ,для переноса текста в ячейке, если не влезает в ширину столбца. Для этого добавил класс:

#ifndef TABLEVIEWCOLUMNDELEGATE_H
#define TABLEVIEWCOLUMNDELEGATE_H

#include <QStyledItemDelegate>
#include <QLabel>
#include <QPainter>
#include <QApplication>

class TableViewColumnDelegate : public QStyledItemDelegate
{
    Q_OBJECT
public:

    enum datarole { HeaderRole = Qt::UserRole + 100, SubheaderRole};
    explicit TableViewColumnDelegate(QObject *parent = 0);
    void paint (QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const;
    QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
    static QSize iconSize;
    static int padding;

signals:

public slots:
};

#endif // TABLEVIEWCOLUMNDELEGATE_H



 #include "tableviewcolumndelegate.h"

TableViewColumnDelegate::TableViewColumnDelegate(QObject *parent) : QStyledItemDelegate(parent)
{

}


void TableViewColumnDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
    if(!index.isValid())
           return;

       painter->save();
       if (option.state & QStyle::State_Selected)
           painter->fillRect(option.rect, option.palette.highlight());
       QString headerText = index.data(HeaderRole).toString();
       QString subheaderText = index.data(SubheaderRole).toString();
       QFont headerFont = QApplication::font();
       headerFont.setBold(true);
       QFont subheaderFont = QApplication::font();
       QFontMetrics headerFm(headerFont);
       QFontMetrics subheaderFm(subheaderFont);
       QRect headerRect =
               headerFm.boundingRect(option.rect.left() + iconSize.width(), option.rect.top() + padding,
                                     option.rect.width() - iconSize.width(), 0,
                                     Qt::AlignLeft|Qt::AlignTop|Qt::TextWordWrap,
                                     headerText);
       QRect subheaderRect =
               subheaderFm.boundingRect(headerRect.left(), headerRect.bottom()+padding,
                                        option.rect.width() - iconSize.width(), 0,
                                        Qt::AlignLeft|Qt::AlignTop|Qt::TextWordWrap,
                                        subheaderText);
       painter->setPen(Qt::black);
       painter->setFont(headerFont);
       painter->drawText(headerRect, Qt::AlignLeft|Qt::AlignTop|Qt::TextWordWrap, headerText);
       painter->setFont(subheaderFont);
       painter->drawText(subheaderRect, Qt::AlignLeft|Qt::AlignTop|Qt::TextWordWrap, subheaderText);
       painter->restore();
}

QSize TableViewColumnDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
{
    if(!index.isValid())
        return QSize();

    QString headerText = index.data(HeaderRole).toString();
    QString subheaderText = index.data(SubheaderRole).toString();
    QFont headerFont = QApplication::font();
    headerFont.setBold(true);
    QFont subheaderFont = QApplication::font();
    QFontMetrics headerFm(headerFont);
    QFontMetrics subheaderFm(subheaderFont);

    QRect headerRect = headerFm.boundingRect(0, 0,
                                             option.rect.width() - iconSize.width(), 0,
                                             Qt::AlignLeft|Qt::AlignTop|Qt::TextWordWrap,
                                             headerText);
    QRect subheaderRect = subheaderFm.boundingRect(0, 0,
                                                   option.rect.width() - iconSize.width(), 0,
                                                   Qt::AlignLeft|Qt::AlignTop|Qt::TextWordWrap,
                                                   subheaderText);

    QSize size(option.rect.width(), headerRect.height() + subheaderRect.height() +  3*padding);

    if(size.height()<iconSize.height())
        size.setHeight(iconSize.height());

    return size;
}

При сборки получаю ошибки:

   error: undefined reference to `TableViewColumnDelegate::padding'
   error: undefined reference to `TableViewColumnDelegate::iconSize'
   In function `TableViewColumnDelegate::sizeHint(QStyleOptionViewItem const&, QModelIndex const&) const':
error: undefined reference to `TableViewColumnDelegate::iconSize'
error: undefined reference to `TableViewColumnDelegate::padding'

Ответы (0 шт):