File indexing completed on 2024-05-19 05:42:25
0001 // ct_lvtqtw_packageviewdelegate.h -*-C++-*- 0002 0003 /* 0004 // Copyright 2023 Codethink Ltd <codethink@codethink.co.uk> 0005 // SPDX-License-Identifier: Apache-2.0 0006 // 0007 // Licensed under the Apache License, Version 2.0 (the "License"); 0008 // you may not use this file except in compliance with the License. 0009 // You may obtain a copy of the License at 0010 // 0011 // http://www.apache.org/licenses/LICENSE-2.0 0012 // 0013 // Unless required by applicable law or agreed to in writing, software 0014 // distributed under the License is distributed on an "AS IS" BASIS, 0015 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 0016 // See the License for the specific language governing permissions and 0017 // limitations under the License. 0018 */ 0019 0020 #ifndef INCLUDED_LVTQTW_PACKAGEVIEWDELEGATE 0021 #define INCLUDED_LVTQTW_PACKAGEVIEWDELEGATE 0022 0023 #include <lvtqtd_export.h> 0024 0025 #include <QStyledItemDelegate> 0026 #include <memory> 0027 0028 class QPainter; 0029 class QStyleOptionViewItem; 0030 class QModelIndex; 0031 0032 namespace Codethink::lvtqtd { 0033 0034 class LVTQTD_EXPORT PackageViewDelegate : public QStyledItemDelegate 0035 // Adds a Delete button on the right side of the 0036 // cell, and calls the removeRow(idx) on the model 0037 { 0038 Q_OBJECT 0039 0040 public: 0041 // CREATORS 0042 PackageViewDelegate(QObject *parent = nullptr); 0043 // Constructor 0044 0045 ~PackageViewDelegate() noexcept override; 0046 // Destructor 0047 0048 void paint(QPainter *painter, const QStyleOptionViewItem& option, const QModelIndex& index) const override; 0049 void initStyleOption(QStyleOptionViewItem *option, const QModelIndex& index) const override; 0050 0051 private: 0052 struct Private; 0053 std::unique_ptr<Private> d; 0054 }; 0055 0056 } // namespace Codethink::lvtqtd 0057 0058 #endif