This file is indexed.

/usr/include/KPropertyWidgets3/KPropertyWidgetsFactory.h is in libkproperty3-dev 3.1.0-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
/* This file is part of the KDE project
   Copyright (C) 2008-2015 Jarosław Staniek <staniek@kde.org>

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
   License as published by the Free Software Foundation; either
   version 2 of the License, or (at your option) any later version.

   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public License
   along with this library; see the file COPYING.LIB.  If not, write to
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
*/

#ifndef KPROPERTYWIDGETS_FACTORY_H
#define KPROPERTYWIDGETS_FACTORY_H

#include "KProperty.h"
#include "KPropertyFactory.h"
#include "KPropertyUtils.h"

#include <QObject>
#include <QVariant>
#include <QHash>
#include <QLabel>
#include <QPainter>
#include <QStyleOptionViewItem>

/*! @brief Options for altering the editor widget creation process

  @see KPropertyEditorCreatorInterface::createEditor().
  @since 3.1
*/
class KPROPERTYWIDGETS_EXPORT KPropertyEditorCreatorOptions {
public:
    KPropertyEditorCreatorOptions();

    KPropertyEditorCreatorOptions(const KPropertyEditorCreatorOptions &other);

    ~KPropertyEditorCreatorOptions();

    /*! In order to have better look of the widget within the property editor view,
        we are usually hiding borders from the widget (see FactoryManager::createEditor())
        and adding 1 pixel 'gray border' on the top. Default value of bordersVisible is @c false. */
    bool bordersVisible() const;

    void setBordersVisible(bool visible);

    //! Assigns @a other to this KPropertyEditorCreatorOptions
    KPropertyEditorCreatorOptions& operator=(const KPropertyEditorCreatorOptions &other);

    //! @return true if these options have exactly the same values options as @a other
    bool operator==(const KPropertyEditorCreatorOptions &other) const;

    //! @return true if these options differs in at least one value from @a other
    bool operator!=(const KPropertyEditorCreatorOptions &other) const { return !operator==(other); }

private:
    class Private;
    Private * const d;
};

//! An interface for editor widget creators.
/*! Options can be set in the options attribute in order to customize
    widget creation process. Do this in the EditorCreatorInterface constructor.
*/
class KPROPERTYWIDGETS_EXPORT KPropertyEditorCreatorInterface
{
public:
    KPropertyEditorCreatorInterface();

    virtual ~KPropertyEditorCreatorInterface();

    virtual QWidget * createEditor(int type, QWidget *parent,
        const QStyleOptionViewItem &option, const QModelIndex &index) const;

    //! Options for editor creating
    //! @since 3.1
    const KPropertyEditorCreatorOptions *options() const;

    //! @overload
    KPropertyEditorCreatorOptions *options();

private:
    Q_DISABLE_COPY(KPropertyEditorCreatorInterface)
    class Private;
    Private * const d;
};

class KPROPERTYWIDGETS_EXPORT KPropertyValuePainterInterface
{
public:
    KPropertyValuePainterInterface();
    virtual ~KPropertyValuePainterInterface();
    virtual void paint( QPainter * painter,
        const QStyleOptionViewItem & option, const QModelIndex & index ) const = 0;

    //! A helper that draws text obtained from index (EditRole data) on painter @a painter.
    //! iface->valueToString() is used to convert value to string.
    //! @since 3.1
    static void paint(const KPropertyValueDisplayInterface *iface, QPainter *painter,
                      const QStyleOptionViewItem &option, const QModelIndex &index);
};

//! Label widget that can be used for displaying text-based read-only items
//! Used in KPropertyLabelCreator.
class KPROPERTYWIDGETS_EXPORT KPropertyLabel : public QLabel
{
    Q_OBJECT
    Q_PROPERTY(QVariant value READ value WRITE setValue USER true)
public:
    KPropertyLabel(QWidget *parent, const KProperty *property,
                   const KPropertyValueDisplayInterface *iface);

    ~KPropertyLabel() override;

    QVariant value() const;

Q_SIGNALS:
    void commitData( QWidget * editor );

public Q_SLOTS:
    void setValue(const QVariant& value);

protected:
    void paintEvent( QPaintEvent * event ) override;

private:
    Q_DISABLE_COPY(KPropertyLabel)
    class Private;
    Private * const d;
};

//! Creator returning editor
template<class Widget>
class KPROPERTYWIDGETS_EXPORT KPropertyEditorCreator : public KPropertyEditorCreatorInterface,
                                        public KPropertyValueDisplayInterface,
                                        public KPropertyValuePainterInterface
{
public:
    KPropertyEditorCreator() : KPropertyEditorCreatorInterface() {}

    ~KPropertyEditorCreator() override {}

    QWidget *createEditor(int type, QWidget *parent, const QStyleOptionViewItem &option,
                          const QModelIndex &index) const override
    {
        Q_UNUSED(type);
        Q_UNUSED(option);
        KProperty *prop = KPropertyUtils::propertyForIndex(index);
        return new Widget(parent, prop, this);
    }

    void paint(QPainter *painter, const QStyleOptionViewItem &option,
               const QModelIndex &index) const override
    {
        KPropertyValuePainterInterface::paint(this, painter, option, index);
    }
};

typedef KPropertyEditorCreator<KPropertyLabel> KPropertyLabelCreator;


class KPROPERTYWIDGETS_EXPORT KPropertyWidgetsFactory : public KPropertyFactory
{
public:
    KPropertyWidgetsFactory();
    ~KPropertyWidgetsFactory() override;

    QHash<int, KPropertyEditorCreatorInterface*> editorCreators() const;
    QHash<int, KPropertyValuePainterInterface*> valuePainters() const;

    //! Adds editor creator @a creator for type @a type.
    //! The creator becomes owned by the factory.
    void addEditor(int type, KPropertyEditorCreatorInterface *creator);

    void addPainter(int type, KPropertyValuePainterInterface *painter);

    static void paintTopGridLine(QWidget *widget);
    static void setTopAndBottomBordersUsingStyleSheet(QWidget *widget,
                                              const QString& extraStyleSheet = QString());

protected:
    void addEditorInternal(int type, KPropertyEditorCreatorInterface *editor, bool own = true);

    //! Adds value painter @a painter for type @a type.
    //! The painter becomes owned by the factory.
    void addPainterInternal(int type, KPropertyValuePainterInterface *painter, bool own = true);

    Q_DISABLE_COPY(KPropertyWidgetsFactory)
    class Private;
    Private * const d;
};

#endif