File indexing completed on 2024-05-12 16:44:08

0001 /*
0002     SPDX-FileCopyrightText: 2014-2016 Christian Dávid <christian-david@web.de>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #include "styleditemdelegateforwarder.h"
0007 
0008 StyledItemDelegateForwarder::StyledItemDelegateForwarder(QObject* parent)
0009     : QAbstractItemDelegate(parent)
0010 {
0011 }
0012 
0013 void StyledItemDelegateForwarder::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const
0014 {
0015     getItemDelegate(index)->paint(painter, option, index);
0016 }
0017 
0018 QSize StyledItemDelegateForwarder::sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const
0019 {
0020     QAbstractItemDelegate* delegate = getItemDelegate(index);
0021     Q_CHECK_PTR(delegate);
0022     return delegate->sizeHint(option, index);
0023 }
0024 
0025 QWidget* StyledItemDelegateForwarder::createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const
0026 {
0027     return getItemDelegate(index)->createEditor(parent, option, index);
0028 }
0029 
0030 void StyledItemDelegateForwarder::setEditorData(QWidget* editor, const QModelIndex& index) const
0031 {
0032     getItemDelegate(index)->setEditorData(editor, index);
0033 }
0034 
0035 void StyledItemDelegateForwarder::setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const
0036 {
0037     getItemDelegate(index)->setModelData(editor, model, index);
0038 }
0039 
0040 void StyledItemDelegateForwarder::updateEditorGeometry(QWidget* editor, const QStyleOptionViewItem& option, const QModelIndex& index) const
0041 {
0042     getItemDelegate(index)->updateEditorGeometry(editor, option, index);
0043 }
0044 
0045 void StyledItemDelegateForwarder::connectSignals(QAbstractItemDelegate* delegate, Qt::ConnectionType type) const
0046 {
0047     connect(delegate, &QAbstractItemDelegate::commitData, this, &QAbstractItemDelegate::commitData, type);
0048     connect(delegate, &QAbstractItemDelegate::closeEditor, this, &QAbstractItemDelegate::closeEditor, type);
0049     connect(delegate, &QAbstractItemDelegate::sizeHintChanged, this, &QAbstractItemDelegate::sizeHintChanged, type);
0050 }