File indexing completed on 2024-04-28 15:59:37
0001 /* This file is part of the KDE project 0002 Copyright (C) 2010-2015 Jarosław Staniek <staniek@kde.org> 0003 0004 This library is free software; you can redistribute it and/or 0005 modify it under the terms of the GNU Library General Public 0006 License as published by the Free Software Foundation; either 0007 version 2 of the License, or (at your option) any later version. 0008 0009 This library is distributed in the hope that it will be useful, 0010 but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0012 Library General Public License for more details. 0013 0014 You should have received a copy of the GNU Library General Public License 0015 along with this library; see the file COPYING.LIB. If not, write to 0016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0017 * Boston, MA 02110-1301, USA. 0018 */ 0019 0020 #ifndef KPROPERTY_LINESTYLEEDIT_H 0021 #define KPROPERTY_LINESTYLEEDIT_H 0022 0023 #include "KPropertyWidgetsFactory.h" 0024 #include "KPropertyLineStyleSelector_p.h" 0025 0026 //! Line style combo box (KProperty::LineStyle, equivalent of Qt::PenStyle) 0027 //! @todo enable transparency selection 0028 //! @todo add transparency option 0029 //! @todo reimplement view using KColorCells 0030 class KPROPERTYWIDGETS_EXPORT KPropertyLineStyleComboEditor : public KPropertyLineStyleSelector 0031 { 0032 Q_OBJECT 0033 Q_PROPERTY(QVariant value READ value WRITE setValue USER true) 0034 0035 public: 0036 explicit KPropertyLineStyleComboEditor(QWidget *parent = nullptr); 0037 0038 ~KPropertyLineStyleComboEditor() override; 0039 0040 QVariant value() const; 0041 0042 Q_SIGNALS: 0043 void commitData(QWidget * editor); 0044 0045 public Q_SLOTS: 0046 void setValue(const QVariant &value); 0047 0048 protected Q_SLOTS: 0049 void slotValueChanged(int index); 0050 0051 private: 0052 Q_DISABLE_COPY(KPropertyLineStyleComboEditor) 0053 class Private; 0054 Private * const d; 0055 }; 0056 0057 class KPROPERTYWIDGETS_EXPORT KPropertyLineStyleComboDelegate : public KPropertyEditorCreatorInterface, 0058 public KPropertyValuePainterInterface, 0059 public KPropertyValueDisplayInterface 0060 { 0061 public: 0062 KPropertyLineStyleComboDelegate(); 0063 0064 QWidget *createEditor(int type, QWidget *parent, const QStyleOptionViewItem &option, 0065 const QModelIndex &index) const override; 0066 0067 void paint(QPainter *painter, const QStyleOptionViewItem &option, 0068 const QModelIndex &index) const override; 0069 0070 QString valueToString(const QVariant &value, const QLocale &locale) const override; 0071 }; 0072 0073 #endif