File indexing completed on 2024-05-12 03:48:26
0001 /* 0002 File : SpreadsheetItemDelegate.h 0003 Project : SciDAVis 0004 -------------------------------------------------------------------- 0005 SPDX-FileCopyrightText: 2007 Tilman Benkert <thzs@gmx.net> 0006 SPDX-FileCopyrightText: 2010-2017 Alexander Semke <alexander.semke@web.de> 0007 SPDX-License-Identifier: GPL-2.0-or-later 0008 */ 0009 0010 #ifndef SPREADSHEETITEMDELEGATE_H 0011 #define SPREADSHEETITEMDELEGATE_H 0012 0013 #include <QItemDelegate> 0014 class QAbstractItemModel; 0015 0016 class SpreadsheetItemDelegate : public QItemDelegate { 0017 Q_OBJECT 0018 0019 public: 0020 explicit SpreadsheetItemDelegate(QObject* parent = nullptr); 0021 0022 void paint(QPainter*, const QStyleOptionViewItem&, const QModelIndex&) const override; 0023 0024 void setEditorData(QWidget*, const QModelIndex&) const override; 0025 void setModelData(QWidget*, QAbstractItemModel*, const QModelIndex&) const override; 0026 0027 private: 0028 QColor m_maskingColor{0xff, 0, 0}; 0029 bool eventFilter(QObject*, QEvent*) override; 0030 0031 Q_SIGNALS: 0032 void returnPressed(); 0033 void editorEntered(); 0034 }; 0035 0036 #endif