The doubt has come for Qt, but it is C ++.
If I have a class structure like this: (I only define eventFilter
)
class DelegadoBase : public QStyledItemDelegate
{
Q_OBJECT
public:
explicit DelegadoBase(QObject* parent=nullptr);
bool eventFilter(QObject *obj, QEvent* event);
};
And this derived class:
class DelegadoEditorNumeros : public DelegadoBase
{
public:
explicit DelegadoEditorNumeros(QObject* parent=nullptr);
QWidget * createEditor(QWidget * parent, const QStyleOptionViewItem&option, const QModelIndex&index) const;
void setEditorData(QWidget * editor, const QModelIndex&index)const;
void setModelData(QWidget * editor, QAbstractItemModel * model, const QModelIndex&index) const;
void paint( QPainter *painter,const QStyleOptionViewItem &option, const QModelIndex &index ) const;
QSize sizeHint( const QStyleOptionViewItem &option, const QModelIndex &index ) const;
QString displayText(const QVariant & value, const QLocale & locale) const;
private:
QRegExp* rx;
};
In the paint()
method of the derived class, when I call the base class method, it is assumed that I should call the method paint()
of DelegadoBase
, and that it calls the method paint()
of QStyledItemDelegate
, but not being defined in DelegadoBase
I get the doubt of how it would be right.
It would be something like this:
void DelegadoEditorNumeros::paint( QPainter *painter,const QStyleOptionViewItem &option, const QModelIndex &index ) const
{
if (condicion)
{
haz las cosas asi
else
{
DelegadoBase::paint(painter, option, index);//así
//QStyledItemDelegate::paint(painter, option, index);o así
}