File indexing completed on 2024-04-21 05:31:00

0001 /*
0002     SPDX-FileCopyrightText: 2021 Michail Vourlakos <mvourlakos@gmail.com>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #ifndef SINGLEOPTIONDELEGATE_H
0007 #define SINGLEOPTIONDELEGATE_H
0008 
0009 // local
0010 #include "singletextdelegate.h"
0011 #include "../../../data/genericdata.h"
0012 
0013 // Qt
0014 #include <QMenu>
0015 #include <QPainter>
0016 #include <QStyledItemDelegate>
0017 
0018 class QModelIndex;
0019 class QWidget;
0020 class QVariant;
0021 
0022 namespace Latte {
0023 namespace Settings {
0024 namespace View {
0025 namespace Delegate {
0026 
0027 class SingleOption : public SingleText
0028 {
0029     Q_OBJECT
0030 public:
0031     SingleOption(QObject *parent);
0032 
0033     QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
0034     void setEditorData(QWidget *editor, const QModelIndex &index) const override;
0035     void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override;
0036     void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
0037     bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index) override;
0038 
0039     void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
0040 
0041 private:
0042     void updateButton(QWidget *editor, const QString &text) const;
0043 
0044 };
0045 
0046 }
0047 }
0048 }
0049 }
0050 
0051 #endif