This file is indexed.

/usr/include/qgis/qgsgradientstopeditor.h is in libqgis-dev 2.18.17+dfsg-1.

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
/***************************************************************************
    qgsgradientstopeditor.h
    -----------------------
    begin                : April 2016
    copyright            : (C) 2016 by Nyall Dawson
    email                : nyall dot dawson at gmail dot com
 ***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef QGSGRADIENTSTOPEDITOR_H
#define QGSGRADIENTSTOPEDITOR_H

#include "qgsvectorcolorrampv2.h"
#include <QWidget>


/** \ingroup gui
 * \class QgsGradientStopEditor
 * An interactive editor for previewing a gradient color ramp and modifying the position of color
 * stops along the gradient.
 * \note Added in version 2.16
 */

class GUI_EXPORT QgsGradientStopEditor : public QWidget
{
    Q_OBJECT

  public:

    /** Constructor for QgsGradientStopEditor.
     * @param parent parent widget
     * @param ramp optional initial gradient ramp
     */
    QgsGradientStopEditor( QWidget* parent = nullptr, QgsVectorGradientColorRampV2* ramp = nullptr );

    /** Sets the current ramp shown in the editor.
     * @param ramp color ramp
     * @see gradientRamp()
     */
    void setGradientRamp( const QgsVectorGradientColorRampV2& ramp );

    /** Returns the current ramp created by the editor.
     * @see setGradientRamp()
     */
    QgsVectorGradientColorRampV2 gradientRamp() const { return mGradient; }

    /** Sets the currently selected stop.
     * @param index index of stop, where 0 corresponds to the first stop
     * @see selectedStop()
     */
    void selectStop( int index );

    /** Returns details about the currently selected stop.
     * @see selectStop()
     */
    QgsGradientStop selectedStop() const;

    virtual QSize sizeHint() const override;
    void paintEvent( QPaintEvent* event ) override;

  public slots:

    /** Sets the color for the current selected stop.
     * @param color new stop color
     * @see setSelectedStopOffset()
     * @see setSelectedStopDetails()
     * @see setColor1()
     * @see setColor2()
     */
    void setSelectedStopColor( const QColor& color );

    /** Sets the offset for the current selected stop. This slot has no effect if either the
     * first or last stop is selected, as they cannot be repositioned.
     * @param offset new stop offset
     * @see setSelectedStopColor()
     * @see setSelectedStopDetails()
     */
    void setSelectedStopOffset( double offset );

    /** Sets the color and offset for the current selected stop.
     * @param color new stop color
     * @param offset new stop offset
     * @see setSelectedStopColor()
     * @see setSelectedStopOffset()
     */
    void setSelectedStopDetails( const QColor& color, double offset );

    /** Deletes the current selected stop. This slot has no effect if either the
     * first or last stop is selected, as they cannot be deleted.
     */
    void deleteSelectedStop();

    /** Sets the color for the first stop.
     * @param color new stop color
     * @see setColor2()
     * @see setSelectedStopColor()
     */
    void setColor1( const QColor& color );

    /** Sets the color for the last stop.
     * @param color new stop color
     * @see setColor1()
     * @see setSelectedStopColor()
     */
    void setColor2( const QColor& color );

  signals:

    //! Emitted when the gradient ramp is changed by a user
    void changed();

    /** Emitted when the current selected stop changes.
     * @param stop details about newly selected stop
     */
    void selectedStopChanged( const QgsGradientStop& stop );

  protected:

    virtual void mouseMoveEvent( QMouseEvent *event ) override;
    virtual void mousePressEvent( QMouseEvent *event ) override;
    virtual void mouseDoubleClickEvent( QMouseEvent * event ) override;
    virtual void keyPressEvent( QKeyEvent * event ) override;

    //Reimplemented to accept dragged colors
    void dragEnterEvent( QDragEnterEvent * e ) override;

    //Reimplemented to accept dropped colors
    void dropEvent( QDropEvent *e ) override;

  private:

    /** Generates a checkboard pattern pixmap for use as a background to transparent colors
     * @returns checkerboard pixmap
     */
    const QPixmap& transparentBackground();

    /** Draws a stop marker on the specified painter.
     * @param painter destination painter
     * @param topMiddle coordinate corresponding to top middle point of desired marker
     * @param color color of marker
     * @param selected set to true to draw the marker in a selected state
     */
    void drawStopMarker( QPainter& painter, QPoint topMiddle, const QColor& color, bool selected = false );

    //! Converts an x-coordinate in the widget's coordinate system to a relative ramp position
    double pointToRelativePosition( int x ) const;

    //! Converts a relative ramp position to a x-coordinate in the widget's coordinate system
    int relativePositionToPoint( double position ) const;

    //! Returns true if the selected stop is movable and deletable
    bool selectedStopIsMovable() const;

    //! Returns the closest stop to a mouse x position, or -1 if no stops within tolerance
    int findClosestStop( int x, int threshold = -1 ) const;

    QgsVectorGradientColorRampV2 mGradient;

    //! We keep a separate, unordered copy of the gradient stops so that the selected stop is not changed.
    QgsGradientStopsList mStops;

    //! Stop number of selected stop, where 0 = first stop
    int mSelectedStop;

    //! Polygon for stop triangle marker outer
    QPolygonF sOuterTriangle;

    //! Polygon for stop triangle marker inner
    QPolygonF sInnerTriangle;

};

#endif // QGSGRADIENTSTOPEDITOR_H