mirror of
				https://github.com/qgis/QGIS.git
				synced 2025-11-03 00:14:12 -05:00 
			
		
		
		
	
		
			
				
	
	
		
			557 lines
		
	
	
		
			14 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			557 lines
		
	
	
		
			14 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
/************************************************************************
 | 
						|
 * This file has been generated automatically from                      *
 | 
						|
 *                                                                      *
 | 
						|
 * src/gui/qgscolorwidgets.h                                            *
 | 
						|
 *                                                                      *
 | 
						|
 * Do not edit manually ! Edit header and run scripts/sipify.pl again   *
 | 
						|
 ************************************************************************/
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
class QgsColorWidget : QWidget
 | 
						|
{
 | 
						|
%Docstring
 | 
						|
 A base class for interactive color widgets. Widgets can either allow setting a single component of
 | 
						|
 a color (e.g., the red or green components), or an entire color. The QgsColorWidget also keeps track of
 | 
						|
 any explicitly set hue for the color, so that this information is not lost when the widget is
 | 
						|
 set to a color with an ambiguous hue (e.g., black or white shades).
 | 
						|
.. versionadded:: 2.5
 | 
						|
%End
 | 
						|
 | 
						|
%TypeHeaderCode
 | 
						|
#include "qgscolorwidgets.h"
 | 
						|
%End
 | 
						|
  public:
 | 
						|
 | 
						|
    enum ColorComponent
 | 
						|
    {
 | 
						|
      Multiple,
 | 
						|
      Red,
 | 
						|
      Green,
 | 
						|
      Blue,
 | 
						|
      Hue,
 | 
						|
      Saturation,
 | 
						|
      Value,
 | 
						|
      Alpha
 | 
						|
    };
 | 
						|
 | 
						|
    QgsColorWidget( QWidget *parent /TransferThis/ = 0, const ColorComponent component = Multiple );
 | 
						|
%Docstring
 | 
						|
 Construct a new color widget.
 | 
						|
 \param parent parent QWidget for the widget
 | 
						|
 \param component color component the widget alters
 | 
						|
%End
 | 
						|
 | 
						|
    QColor color() const;
 | 
						|
%Docstring
 | 
						|
 Returns the current color for the widget
 | 
						|
 :return: current widget color
 | 
						|
.. seealso:: setColor
 | 
						|
 :rtype: QColor
 | 
						|
%End
 | 
						|
 | 
						|
    ColorComponent component() const;
 | 
						|
%Docstring
 | 
						|
 Returns the color component which the widget controls
 | 
						|
 :return: color component for widget
 | 
						|
.. seealso:: setComponent
 | 
						|
 :rtype: ColorComponent
 | 
						|
%End
 | 
						|
 | 
						|
    int componentValue() const;
 | 
						|
%Docstring
 | 
						|
 Returns the current value of the widget's color component
 | 
						|
 :return: value of color component, or -1 if widget has multiple components or an invalid color
 | 
						|
 set
 | 
						|
.. seealso:: setComponentValue
 | 
						|
.. seealso:: component
 | 
						|
 :rtype: int
 | 
						|
%End
 | 
						|
 | 
						|
    static QPixmap createDragIcon( const QColor &color );
 | 
						|
%Docstring
 | 
						|
 Create an icon for dragging colors
 | 
						|
 \param color for icon
 | 
						|
 :rtype: QPixmap
 | 
						|
%End
 | 
						|
 | 
						|
  public slots:
 | 
						|
 | 
						|
    virtual void setColor( const QColor &color, const bool emitSignals = false );
 | 
						|
%Docstring
 | 
						|
 Sets the color for the widget
 | 
						|
 \param color widget color
 | 
						|
 \param emitSignals set to true to emit the colorChanged signal after setting color
 | 
						|
.. seealso:: color
 | 
						|
%End
 | 
						|
 | 
						|
    virtual void setComponent( const ColorComponent component );
 | 
						|
%Docstring
 | 
						|
 Sets the color component which the widget controls
 | 
						|
 \param component color component for widget
 | 
						|
.. seealso:: component
 | 
						|
%End
 | 
						|
 | 
						|
    virtual void setComponentValue( const int value );
 | 
						|
%Docstring
 | 
						|
 Alters the widget's color by setting the value for the widget's color component
 | 
						|
 \param value value for widget's color component. This value is automatically
 | 
						|
 clipped to the range of valid values for the color component.
 | 
						|
.. seealso:: componentValue
 | 
						|
.. seealso:: setComponent
 | 
						|
.. note::
 | 
						|
 | 
						|
   this method has no effect if the widget is set to the QgsColorWidget.Multiple
 | 
						|
 component
 | 
						|
%End
 | 
						|
 | 
						|
  signals:
 | 
						|
 | 
						|
    void colorChanged( const QColor &color );
 | 
						|
%Docstring
 | 
						|
 Emitted when the widget's color changes
 | 
						|
 \param color new widget color
 | 
						|
%End
 | 
						|
 | 
						|
    void hovered();
 | 
						|
%Docstring
 | 
						|
 Emitted when mouse hovers over widget.
 | 
						|
.. versionadded:: 2.14
 | 
						|
%End
 | 
						|
 | 
						|
  protected:
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
    int componentRange() const;
 | 
						|
%Docstring
 | 
						|
 Returns the range of valid values for the color widget's component
 | 
						|
 :return: maximum value allowed for color component, or -1 if widget has multiple components
 | 
						|
 :rtype: int
 | 
						|
%End
 | 
						|
 | 
						|
    int componentRange( const ColorComponent component ) const;
 | 
						|
%Docstring
 | 
						|
 Returns the range of valid values a color component
 | 
						|
 :return: maximum value allowed for color component
 | 
						|
 :rtype: int
 | 
						|
%End
 | 
						|
 | 
						|
    int componentValue( const ColorComponent component ) const;
 | 
						|
%Docstring
 | 
						|
 Returns the value of a component of the widget's current color. This method correctly
 | 
						|
 handles hue values when the color has an ambiguous hue (e.g., black or white shades)
 | 
						|
 \param component color component to return
 | 
						|
 :return: value of color component, or -1 if widget has an invalid color set
 | 
						|
.. seealso:: hue
 | 
						|
 :rtype: int
 | 
						|
%End
 | 
						|
 | 
						|
    int hue() const;
 | 
						|
%Docstring
 | 
						|
 Returns the hue for the widget. This may differ from the hue for the QColor returned by color(),
 | 
						|
 as QColor returns a hue of -1 if the color's hue is ambiguous (e.g., if the saturation is zero).
 | 
						|
 :return: explicitly set hue for widget
 | 
						|
 :rtype: int
 | 
						|
%End
 | 
						|
 | 
						|
    void alterColor( QColor &color, const QgsColorWidget::ColorComponent component, const int newValue ) const;
 | 
						|
%Docstring
 | 
						|
 Alters a color by modifiying the value of a specific color component
 | 
						|
 \param color color to alter
 | 
						|
 \param component color component to alter
 | 
						|
 \param newValue new value of color component. Values are automatically clipped to a
 | 
						|
 valid range for the color component.
 | 
						|
%End
 | 
						|
 | 
						|
    static const QPixmap &transparentBackground();
 | 
						|
%Docstring
 | 
						|
 Generates a checkboard pattern pixmap for use as a background to transparent colors
 | 
						|
 :return: checkerboard pixmap
 | 
						|
 :rtype: QPixmap
 | 
						|
%End
 | 
						|
 | 
						|
    virtual void dragEnterEvent( QDragEnterEvent *e );
 | 
						|
 | 
						|
 | 
						|
    virtual void dropEvent( QDropEvent *e );
 | 
						|
 | 
						|
 | 
						|
    virtual void mouseMoveEvent( QMouseEvent *e );
 | 
						|
 | 
						|
    virtual void mousePressEvent( QMouseEvent *e );
 | 
						|
 | 
						|
    virtual void mouseReleaseEvent( QMouseEvent *e );
 | 
						|
 | 
						|
};
 | 
						|
 | 
						|
 | 
						|
 | 
						|
class QgsColorWidgetAction: QWidgetAction
 | 
						|
{
 | 
						|
%Docstring
 | 
						|
 An action containing a color widget, which can be embedded into a menu.
 | 
						|
.. seealso:: QgsColorWidget
 | 
						|
.. versionadded:: 2.14
 | 
						|
%End
 | 
						|
 | 
						|
%TypeHeaderCode
 | 
						|
#include "qgscolorwidgets.h"
 | 
						|
%End
 | 
						|
  public:
 | 
						|
 | 
						|
    QgsColorWidgetAction( QgsColorWidget *colorWidget, QMenu *menu = 0, QWidget *parent /TransferThis/ = 0 );
 | 
						|
%Docstring
 | 
						|
 Construct a new color widget action.
 | 
						|
 \param colorWidget QgsColorWidget to show in action
 | 
						|
 \param menu parent menu
 | 
						|
 \param parent parent widget
 | 
						|
%End
 | 
						|
 | 
						|
    QgsColorWidget *colorWidget();
 | 
						|
%Docstring
 | 
						|
 Returns the color widget contained in the widget action.
 | 
						|
 :rtype: QgsColorWidget
 | 
						|
%End
 | 
						|
 | 
						|
    void setDismissOnColorSelection( bool dismiss );
 | 
						|
%Docstring
 | 
						|
 Sets whether the parent menu should be dismissed and closed when a color is selected
 | 
						|
 from the action's color widget.
 | 
						|
 \param dismiss set to true (default) to immediately close the menu when a color is selected
 | 
						|
 from the widget. If set to false, the colorChanged signal will be emitted but the menu will
 | 
						|
 stay open.
 | 
						|
.. seealso:: dismissOnColorSelection()
 | 
						|
%End
 | 
						|
 | 
						|
    bool dismissOnColorSelection() const;
 | 
						|
%Docstring
 | 
						|
 Returns whether the parent menu will be dismissed after a color is selected from the
 | 
						|
 action's color widget.
 | 
						|
.. seealso:: setDismissOnColorSelection
 | 
						|
 :rtype: bool
 | 
						|
%End
 | 
						|
 | 
						|
  signals:
 | 
						|
 | 
						|
    void colorChanged( const QColor &color );
 | 
						|
%Docstring
 | 
						|
 Emitted when a color has been selected from the widget
 | 
						|
 \param color selected color
 | 
						|
%End
 | 
						|
 | 
						|
};
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
class QgsColorWheel : QgsColorWidget
 | 
						|
{
 | 
						|
%Docstring
 | 
						|
 A color wheel widget. This widget consists of an outer ring which allows for hue selection, and an
 | 
						|
 inner rotating triangle which allows for saturation and value selection.
 | 
						|
.. versionadded:: 2.5
 | 
						|
%End
 | 
						|
 | 
						|
%TypeHeaderCode
 | 
						|
#include "qgscolorwidgets.h"
 | 
						|
%End
 | 
						|
  public:
 | 
						|
 | 
						|
    QgsColorWheel( QWidget *parent /TransferThis/ = 0 );
 | 
						|
%Docstring
 | 
						|
 Constructs a new color wheel widget.
 | 
						|
 \param parent parent QWidget for the widget
 | 
						|
%End
 | 
						|
 | 
						|
    virtual ~QgsColorWheel();
 | 
						|
 | 
						|
    virtual QSize sizeHint() const;
 | 
						|
    virtual void paintEvent( QPaintEvent *event );
 | 
						|
 | 
						|
 | 
						|
  public slots:
 | 
						|
 | 
						|
    virtual void setColor( const QColor &color, const bool emitSignals = false );
 | 
						|
 | 
						|
  protected:
 | 
						|
 | 
						|
    virtual void resizeEvent( QResizeEvent *event );
 | 
						|
    virtual void mouseMoveEvent( QMouseEvent *event );
 | 
						|
    virtual void mousePressEvent( QMouseEvent *event );
 | 
						|
    virtual void mouseReleaseEvent( QMouseEvent *event );
 | 
						|
 | 
						|
};
 | 
						|
 | 
						|
 | 
						|
 | 
						|
class QgsColorBox : QgsColorWidget
 | 
						|
{
 | 
						|
%Docstring
 | 
						|
 A color box widget. This widget consists of a two dimensional rectangle filled with color
 | 
						|
 variations, where a different color component varies along both the horizontal and vertical
 | 
						|
 axis.
 | 
						|
.. versionadded:: 2.5
 | 
						|
%End
 | 
						|
 | 
						|
%TypeHeaderCode
 | 
						|
#include "qgscolorwidgets.h"
 | 
						|
%End
 | 
						|
  public:
 | 
						|
 | 
						|
    QgsColorBox( QWidget *parent /TransferThis/ = 0, const ColorComponent component = Value );
 | 
						|
%Docstring
 | 
						|
 Construct a new color box widget.
 | 
						|
 \param parent parent QWidget for the widget
 | 
						|
 \param component constant color component for the widget. The color components
 | 
						|
 which vary along the horizontal and vertical axis are automatically assigned
 | 
						|
 based on this constant color component.
 | 
						|
%End
 | 
						|
 | 
						|
    virtual ~QgsColorBox();
 | 
						|
 | 
						|
    virtual QSize sizeHint() const;
 | 
						|
    virtual void paintEvent( QPaintEvent *event );
 | 
						|
 | 
						|
 | 
						|
    virtual void setComponent( const ColorComponent component );
 | 
						|
 | 
						|
  public slots:
 | 
						|
    virtual void setColor( const QColor &color, const bool emitSignals = false );
 | 
						|
 | 
						|
  protected:
 | 
						|
 | 
						|
    virtual void resizeEvent( QResizeEvent *event );
 | 
						|
    virtual void mouseMoveEvent( QMouseEvent *event );
 | 
						|
    virtual void mousePressEvent( QMouseEvent *event );
 | 
						|
 | 
						|
};
 | 
						|
 | 
						|
 | 
						|
 | 
						|
class QgsColorRampWidget : QgsColorWidget
 | 
						|
{
 | 
						|
%Docstring
 | 
						|
 A color ramp widget. This widget consists of an interactive box filled with a color which varies along
 | 
						|
 its length by a single color component (e.g., varying saturation from 0 to 100%).
 | 
						|
.. versionadded:: 2.5
 | 
						|
%End
 | 
						|
 | 
						|
%TypeHeaderCode
 | 
						|
#include "qgscolorwidgets.h"
 | 
						|
%End
 | 
						|
  public:
 | 
						|
 | 
						|
    enum Orientation
 | 
						|
    {
 | 
						|
      Horizontal,
 | 
						|
      Vertical
 | 
						|
    };
 | 
						|
 | 
						|
    QgsColorRampWidget( QWidget *parent /TransferThis/ = 0,
 | 
						|
                        const ColorComponent component = QgsColorWidget::Red,
 | 
						|
                        const Orientation orientation = QgsColorRampWidget::Horizontal );
 | 
						|
%Docstring
 | 
						|
 Construct a new color ramp widget.
 | 
						|
 \param parent parent QWidget for the widget
 | 
						|
 \param component color component which varies along the ramp
 | 
						|
 \param orientation orientation for widget
 | 
						|
%End
 | 
						|
 | 
						|
    virtual QSize sizeHint() const;
 | 
						|
    virtual void paintEvent( QPaintEvent *event );
 | 
						|
 | 
						|
 | 
						|
    void setOrientation( const Orientation orientation );
 | 
						|
%Docstring
 | 
						|
 Sets the orientation for the color ramp
 | 
						|
 \param orientation new orientation for the ramp
 | 
						|
.. seealso:: orientation
 | 
						|
%End
 | 
						|
 | 
						|
    Orientation orientation() const;
 | 
						|
%Docstring
 | 
						|
 Fetches the orientation for the color ramp
 | 
						|
 :return: orientation for the ramp
 | 
						|
.. seealso:: setOrientation
 | 
						|
 :rtype: Orientation
 | 
						|
%End
 | 
						|
 | 
						|
    void setInteriorMargin( const int margin );
 | 
						|
%Docstring
 | 
						|
 Sets the margin between the edge of the widget and the ramp
 | 
						|
 \param margin margin around the ramp
 | 
						|
.. seealso:: interiorMargin
 | 
						|
%End
 | 
						|
 | 
						|
    int interiorMargin() const;
 | 
						|
%Docstring
 | 
						|
 Fetches the margin between the edge of the widget and the ramp
 | 
						|
 :return: margin around the ramp
 | 
						|
.. seealso:: setInteriorMargin
 | 
						|
 :rtype: int
 | 
						|
%End
 | 
						|
 | 
						|
    void setShowFrame( const bool showFrame );
 | 
						|
%Docstring
 | 
						|
 Sets whether the ramp should be drawn within a frame
 | 
						|
 \param showFrame set to true to draw a frame around the ramp
 | 
						|
.. seealso:: showFrame
 | 
						|
%End
 | 
						|
 | 
						|
    bool showFrame() const;
 | 
						|
%Docstring
 | 
						|
 Fetches whether the ramp is drawn within a frame
 | 
						|
 :return: true if a frame is drawn around the ramp
 | 
						|
.. seealso:: setShowFrame
 | 
						|
 :rtype: bool
 | 
						|
%End
 | 
						|
 | 
						|
    void setMarkerSize( const int markerSize );
 | 
						|
%Docstring
 | 
						|
 Sets the size for drawing the triangular markers on the ramp
 | 
						|
 \param markerSize marker size in pixels
 | 
						|
%End
 | 
						|
 | 
						|
  signals:
 | 
						|
 | 
						|
    void valueChanged( const int value );
 | 
						|
%Docstring
 | 
						|
 Emitted when the widget's color component value changes
 | 
						|
 \param value new value of color component
 | 
						|
%End
 | 
						|
 | 
						|
  protected:
 | 
						|
 | 
						|
    virtual void mouseMoveEvent( QMouseEvent *event );
 | 
						|
    virtual void wheelEvent( QWheelEvent *event );
 | 
						|
    virtual void mousePressEvent( QMouseEvent *event );
 | 
						|
    virtual void keyPressEvent( QKeyEvent *event );
 | 
						|
 | 
						|
};
 | 
						|
 | 
						|
 | 
						|
 | 
						|
class QgsColorSliderWidget : QgsColorWidget
 | 
						|
{
 | 
						|
%Docstring
 | 
						|
 A composite horizontal color ramp widget and associated spinbox for manual value entry.
 | 
						|
.. versionadded:: 2.5
 | 
						|
%End
 | 
						|
 | 
						|
%TypeHeaderCode
 | 
						|
#include "qgscolorwidgets.h"
 | 
						|
%End
 | 
						|
  public:
 | 
						|
 | 
						|
    QgsColorSliderWidget( QWidget *parent /TransferThis/ = 0, const ColorComponent component = QgsColorWidget::Red );
 | 
						|
%Docstring
 | 
						|
 Construct a new color slider widget.
 | 
						|
 \param parent parent QWidget for the widget
 | 
						|
 \param component color component which is controlled by the slider
 | 
						|
%End
 | 
						|
 | 
						|
    virtual void setComponent( const ColorComponent component );
 | 
						|
    virtual void setComponentValue( const int value );
 | 
						|
    virtual void setColor( const QColor &color, const bool emitSignals = false );
 | 
						|
 | 
						|
};
 | 
						|
 | 
						|
 | 
						|
 | 
						|
class QgsColorTextWidget : QgsColorWidget
 | 
						|
{
 | 
						|
%Docstring
 | 
						|
 A line edit widget which displays colors as text and accepts string representations
 | 
						|
 of colors.
 | 
						|
.. versionadded:: 2.5
 | 
						|
%End
 | 
						|
 | 
						|
%TypeHeaderCode
 | 
						|
#include "qgscolorwidgets.h"
 | 
						|
%End
 | 
						|
  public:
 | 
						|
 | 
						|
    QgsColorTextWidget( QWidget *parent /TransferThis/ = 0 );
 | 
						|
%Docstring
 | 
						|
 Construct a new color line edit widget.
 | 
						|
 \param parent parent QWidget for the widget
 | 
						|
%End
 | 
						|
 | 
						|
    virtual void setColor( const QColor &color, const bool emitSignals = false );
 | 
						|
 | 
						|
  protected:
 | 
						|
    virtual void resizeEvent( QResizeEvent *event );
 | 
						|
 | 
						|
 | 
						|
};
 | 
						|
 | 
						|
 | 
						|
 | 
						|
class QgsColorPreviewWidget : QgsColorWidget
 | 
						|
{
 | 
						|
%Docstring
 | 
						|
 A preview box which displays one or two colors as swatches.
 | 
						|
.. versionadded:: 2.5
 | 
						|
%End
 | 
						|
 | 
						|
%TypeHeaderCode
 | 
						|
#include "qgscolorwidgets.h"
 | 
						|
%End
 | 
						|
  public:
 | 
						|
 | 
						|
    QgsColorPreviewWidget( QWidget *parent /TransferThis/ = 0 );
 | 
						|
%Docstring
 | 
						|
 Construct a new color preview widget.
 | 
						|
 \param parent parent QWidget for the widget
 | 
						|
%End
 | 
						|
 | 
						|
    virtual void paintEvent( QPaintEvent *event );
 | 
						|
 | 
						|
    virtual QSize sizeHint() const;
 | 
						|
 | 
						|
    QColor color2() const;
 | 
						|
%Docstring
 | 
						|
 Returns the secondary color for the widget
 | 
						|
 :return: secondary widget color, or an invalid color if the widget
 | 
						|
 has no secondary color
 | 
						|
.. seealso:: color
 | 
						|
.. seealso:: setColor2
 | 
						|
 :rtype: QColor
 | 
						|
%End
 | 
						|
 | 
						|
  public slots:
 | 
						|
 | 
						|
    virtual void setColor2( const QColor &color );
 | 
						|
%Docstring
 | 
						|
 Sets the second color for the widget
 | 
						|
 \param color secondary widget color. Set to an invalid color to prevent
 | 
						|
 drawing of a secondary color
 | 
						|
.. seealso:: setColor
 | 
						|
.. seealso:: color2
 | 
						|
%End
 | 
						|
 | 
						|
  protected:
 | 
						|
 | 
						|
    virtual void mousePressEvent( QMouseEvent *e );
 | 
						|
 | 
						|
 | 
						|
    virtual void mouseReleaseEvent( QMouseEvent *e );
 | 
						|
 | 
						|
 | 
						|
    virtual void mouseMoveEvent( QMouseEvent *e );
 | 
						|
 | 
						|
 | 
						|
};
 | 
						|
 | 
						|
/************************************************************************
 | 
						|
 * This file has been generated automatically from                      *
 | 
						|
 *                                                                      *
 | 
						|
 * src/gui/qgscolorwidgets.h                                            *
 | 
						|
 *                                                                      *
 | 
						|
 * Do not edit manually ! Edit header and run scripts/sipify.pl again   *
 | 
						|
 ************************************************************************/
 |