QGIS/python/gui/qgscolorwidgets.sip.in

631 lines
14 KiB
Plaintext
Raw Normal View History

2017-05-01 13:35:13 +02:00
/************************************************************************
* 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
{
2017-05-01 13:35:13 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
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).
2017-05-01 13:35:13 +02:00
.. versionadded:: 2.5
%End
2017-05-01 13:35:13 +02:00
%TypeHeaderCode
#include "qgscolorwidgets.h"
%End
public:
enum ColorComponent
{
2017-05-01 13:35:13 +02:00
Multiple,
Red,
Green,
Blue,
Hue,
Saturation,
Value,
Alpha
};
2017-05-01 13:35:13 +02:00
QgsColorWidget( QWidget *parent /TransferThis/ = 0, const ColorComponent component = Multiple );
%Docstring
2017-12-15 10:36:55 -04:00
Construct a new color widget.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param parent: parent QWidget for the widget
:param component: color component the widget alters
2017-05-01 13:35:13 +02:00
%End
QColor color() const;
2017-05-01 13:35:13 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the current color for the widget
:return: current widget color
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setColor`
2017-05-01 13:35:13 +02:00
%End
ColorComponent component() const;
2017-05-01 13:35:13 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the color component which the widget controls
:return: color component for widget
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setComponent`
2017-05-01 13:35:13 +02:00
%End
int componentValue() const;
2017-05-01 13:35:13 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
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
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setComponentValue`
2017-12-15 10:36:55 -04:00
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`component`
2017-05-01 13:35:13 +02:00
%End
2014-11-13 23:13:13 +01:00
static QPixmap createDragIcon( const QColor &color );
2017-05-01 13:35:13 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Create an icon for dragging colors
2017-12-15 21:36:08 -04:00
:param color: for icon
2017-05-01 13:35:13 +02:00
%End
public slots:
virtual void setColor( const QColor &color, const bool emitSignals = false );
2017-05-01 13:35:13 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets the color for the widget
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param color: widget color
:param emitSignals: set to true to emit the colorChanged signal after setting color
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`color`
2017-05-01 13:35:13 +02:00
%End
virtual void setComponent( const QgsColorWidget::ColorComponent component );
2017-05-01 13:35:13 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets the color component which the widget controls
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param component: color component for widget
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`component`
2017-05-01 13:35:13 +02:00
%End
virtual void setComponentValue( const int value );
2017-05-01 13:35:13 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Alters the widget's color by setting the value for the widget's color component
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param value: value for widget's color component. This value is automatically
clipped to the range of valid values for the color component.
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`componentValue`
2017-12-15 10:36:55 -04:00
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setComponent`
2017-12-15 10:36:55 -04:00
2017-05-01 13:35:13 +02:00
.. note::
this method has no effect if the widget is set to the QgsColorWidget.Multiple
2018-01-12 20:51:17 -04:00
component
2017-05-01 13:35:13 +02:00
%End
signals:
void colorChanged( const QColor &color );
2017-05-01 13:35:13 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Emitted when the widget's color changes
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param color: new widget color
2017-05-01 13:35:13 +02:00
%End
void hovered();
2017-05-01 13:35:13 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Emitted when mouse hovers over widget.
2017-05-01 13:35:13 +02:00
.. versionadded:: 2.14
%End
protected:
2017-05-01 13:35:13 +02:00
int componentRange() const;
2017-05-01 13:35:13 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
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
2017-05-01 13:35:13 +02:00
%End
int componentRange( const ColorComponent component ) const;
2017-05-01 13:35:13 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the range of valid values a color component
:return: maximum value allowed for color component
2017-05-01 13:35:13 +02:00
%End
int componentValue( const ColorComponent component ) const;
2017-05-01 13:35:13 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
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)
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param component: color component to return
:return: value of color component, or -1 if widget has an invalid color set
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`hue`
2017-05-01 13:35:13 +02:00
%End
int hue() const;
2017-05-01 13:35:13 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
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
2017-05-01 13:35:13 +02:00
%End
void alterColor( QColor &color, const QgsColorWidget::ColorComponent component, const int newValue ) const;
%Docstring
2017-12-15 10:36:55 -04:00
Alters a color by modifiying the value of a specific color component
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
: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.
2017-05-01 13:35:13 +02:00
%End
static const QPixmap &transparentBackground();
%Docstring
2017-12-15 10:36:55 -04:00
Generates a checkboard pattern pixmap for use as a background to transparent colors
:return: checkerboard pixmap
2017-05-01 13:35:13 +02:00
%End
2017-05-01 13:35:13 +02:00
virtual void dragEnterEvent( QDragEnterEvent *e );
2017-05-01 13:35:13 +02:00
virtual void dropEvent( QDropEvent *e );
2014-09-11 21:11:04 +10:00
2017-05-01 13:35:13 +02:00
virtual void mouseMoveEvent( QMouseEvent *e );
virtual void mousePressEvent( QMouseEvent *e );
virtual void mouseReleaseEvent( QMouseEvent *e );
};
class QgsColorWidgetAction: QWidgetAction
{
2017-05-01 13:35:13 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
An action containing a color widget, which can be embedded into a menu.
2017-12-05 20:04:14 -04:00
.. seealso:: :py:class:`QgsColorWidget`
2017-12-15 10:36:55 -04:00
2017-05-01 13:35:13 +02:00
.. versionadded:: 2.14
%End
2017-05-01 13:35:13 +02:00
%TypeHeaderCode
#include "qgscolorwidgets.h"
%End
public:
2017-05-01 13:35:13 +02:00
QgsColorWidgetAction( QgsColorWidget *colorWidget, QMenu *menu = 0, QWidget *parent /TransferThis/ = 0 );
%Docstring
2017-12-15 10:36:55 -04:00
Construct a new color widget action.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param colorWidget: QgsColorWidget to show in action
:param menu: parent menu
:param parent: parent widget
2017-05-01 13:35:13 +02:00
%End
QgsColorWidget *colorWidget();
%Docstring
2017-12-15 10:36:55 -04:00
Returns the color widget contained in the widget action.
2017-05-01 13:35:13 +02:00
%End
void setDismissOnColorSelection( bool dismiss );
2017-05-01 13:35:13 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets whether the parent menu should be dismissed and closed when a color is selected
from the action's color widget.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
: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:: :py:func:`dismissOnColorSelection`
2017-05-01 13:35:13 +02:00
%End
bool dismissOnColorSelection() const;
2017-05-01 13:35:13 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns whether the parent menu will be dismissed after a color is selected from the
action's color widget.
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setDismissOnColorSelection`
2017-05-01 13:35:13 +02:00
%End
signals:
void colorChanged( const QColor &color );
2017-05-01 13:35:13 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Emitted when a color has been selected from the widget
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param color: selected color
2017-05-01 13:35:13 +02:00
%End
};
2016-02-14 03:50:23 +01:00
class QgsColorWheel : QgsColorWidget
{
2017-05-01 13:35:13 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
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.
2017-05-01 13:35:13 +02:00
.. versionadded:: 2.5
%End
2017-05-01 13:35:13 +02:00
%TypeHeaderCode
#include "qgscolorwidgets.h"
%End
public:
2017-05-01 13:35:13 +02:00
QgsColorWheel( QWidget *parent /TransferThis/ = 0 );
%Docstring
2017-12-15 10:36:55 -04:00
Constructs a new color wheel widget.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param parent: parent QWidget for the widget
2017-05-01 13:35:13 +02:00
%End
~QgsColorWheel();
2014-11-13 23:13:13 +01:00
virtual QSize sizeHint() const;
2017-05-01 13:35:13 +02:00
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 );
2014-11-13 23:13:13 +01:00
};
class QgsColorBox : QgsColorWidget
{
2017-05-01 13:35:13 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
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.
2017-05-01 13:35:13 +02:00
.. versionadded:: 2.5
%End
2017-05-01 13:35:13 +02:00
%TypeHeaderCode
#include "qgscolorwidgets.h"
%End
public:
2017-05-01 13:35:13 +02:00
QgsColorBox( QWidget *parent /TransferThis/ = 0, const ColorComponent component = Value );
%Docstring
2017-12-15 10:36:55 -04:00
Construct a new color box widget.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
: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.
2017-05-01 13:35:13 +02:00
%End
~QgsColorBox();
2014-11-13 23:13:13 +01:00
virtual QSize sizeHint() const;
2017-05-01 13:35:13 +02:00
virtual void paintEvent( QPaintEvent *event );
virtual void setComponent( const ColorComponent component );
2014-11-13 23:13:13 +01:00
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 );
2017-05-01 13:35:13 +02:00
};
class QgsColorRampWidget : QgsColorWidget
{
2017-05-01 13:35:13 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
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%).
2017-05-01 13:35:13 +02:00
.. versionadded:: 2.5
%End
2017-05-01 13:35:13 +02:00
%TypeHeaderCode
#include "qgscolorwidgets.h"
%End
public:
2014-11-13 23:13:13 +01:00
enum Orientation
{
2017-05-01 13:35:13 +02:00
Horizontal,
Vertical
};
2017-05-01 13:35:13 +02:00
QgsColorRampWidget( QWidget *parent /TransferThis/ = 0,
const ColorComponent component = QgsColorWidget::Red,
const Orientation orientation = QgsColorRampWidget::Horizontal );
2017-05-01 13:35:13 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Construct a new color ramp widget.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param parent: parent QWidget for the widget
:param component: color component which varies along the ramp
:param orientation: orientation for widget
2017-05-01 13:35:13 +02:00
%End
virtual QSize sizeHint() const;
2017-05-01 13:35:13 +02:00
virtual void paintEvent( QPaintEvent *event );
2014-11-13 23:13:13 +01:00
void setOrientation( const Orientation orientation );
2017-05-01 13:35:13 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets the orientation for the color ramp
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param orientation: new orientation for the ramp
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`orientation`
2017-05-01 13:35:13 +02:00
%End
Orientation orientation() const;
2017-05-01 13:35:13 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Fetches the orientation for the color ramp
:return: orientation for the ramp
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setOrientation`
2017-05-01 13:35:13 +02:00
%End
void setInteriorMargin( const int margin );
2017-05-01 13:35:13 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets the margin between the edge of the widget and the ramp
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param margin: margin around the ramp
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`interiorMargin`
2017-05-01 13:35:13 +02:00
%End
int interiorMargin() const;
2017-05-01 13:35:13 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Fetches the margin between the edge of the widget and the ramp
:return: margin around the ramp
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setInteriorMargin`
2017-05-01 13:35:13 +02:00
%End
void setShowFrame( const bool showFrame );
2017-05-01 13:35:13 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets whether the ramp should be drawn within a frame
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param showFrame: set to true to draw a frame around the ramp
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`showFrame`
2017-05-01 13:35:13 +02:00
%End
bool showFrame() const;
2017-05-01 13:35:13 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Fetches whether the ramp is drawn within a frame
:return: true if a frame is drawn around the ramp
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setShowFrame`
2017-05-01 13:35:13 +02:00
%End
void setMarkerSize( const int markerSize );
2017-05-01 13:35:13 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets the size for drawing the triangular markers on the ramp
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param markerSize: marker size in pixels
2017-05-01 13:35:13 +02:00
%End
signals:
void valueChanged( const int value );
2017-05-01 13:35:13 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Emitted when the widget's color component value changes
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param value: new value of color component
2017-05-01 13:35:13 +02:00
%End
2014-11-13 23:13:13 +01:00
protected:
2014-11-13 23:13:13 +01:00
virtual void mouseMoveEvent( QMouseEvent *event );
2017-05-01 13:35:13 +02:00
virtual void wheelEvent( QWheelEvent *event );
virtual void mousePressEvent( QMouseEvent *event );
2017-05-01 13:35:13 +02:00
virtual void keyPressEvent( QKeyEvent *event );
};
class QgsColorSliderWidget : QgsColorWidget
{
2017-05-01 13:35:13 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
A composite horizontal color ramp widget and associated spinbox for manual value entry.
2017-05-01 13:35:13 +02:00
.. versionadded:: 2.5
%End
2017-05-01 13:35:13 +02:00
%TypeHeaderCode
#include "qgscolorwidgets.h"
%End
public:
2017-05-01 13:35:13 +02:00
QgsColorSliderWidget( QWidget *parent /TransferThis/ = 0, const ColorComponent component = QgsColorWidget::Red );
%Docstring
2017-12-15 10:36:55 -04:00
Construct a new color slider widget.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param parent: parent QWidget for the widget
:param component: color component which is controlled by the slider
2017-05-01 13:35:13 +02:00
%End
2014-11-13 23:13:13 +01:00
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
{
2017-05-01 13:35:13 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
A line edit widget which displays colors as text and accepts string representations
of colors.
2017-05-01 13:35:13 +02:00
.. versionadded:: 2.5
%End
2017-05-01 13:35:13 +02:00
%TypeHeaderCode
#include "qgscolorwidgets.h"
%End
public:
2017-05-01 13:35:13 +02:00
QgsColorTextWidget( QWidget *parent /TransferThis/ = 0 );
%Docstring
2017-12-15 10:36:55 -04:00
Construct a new color line edit widget.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param parent: parent QWidget for the widget
2017-05-01 13:35:13 +02:00
%End
2014-11-13 23:13:13 +01:00
virtual void setColor( const QColor &color, const bool emitSignals = false );
protected:
2017-05-01 13:35:13 +02:00
virtual void resizeEvent( QResizeEvent *event );
2014-11-13 23:13:13 +01:00
};
class QgsColorPreviewWidget : QgsColorWidget
{
2017-05-01 13:35:13 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
A preview box which displays one or two colors as swatches.
2017-05-01 13:35:13 +02:00
.. versionadded:: 2.5
%End
2017-05-01 13:35:13 +02:00
%TypeHeaderCode
#include "qgscolorwidgets.h"
%End
public:
2017-05-01 13:35:13 +02:00
QgsColorPreviewWidget( QWidget *parent /TransferThis/ = 0 );
%Docstring
2017-12-15 10:36:55 -04:00
Construct a new color preview widget.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param parent: parent QWidget for the widget
2017-05-01 13:35:13 +02:00
%End
2017-05-01 13:35:13 +02:00
virtual void paintEvent( QPaintEvent *event );
virtual QSize sizeHint() const;
2017-05-01 13:35:13 +02:00
QColor color2() const;
2017-05-01 13:35:13 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the secondary color for the widget
:return: secondary widget color, or an invalid color if the widget
has no secondary color
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`color`
2017-12-15 10:36:55 -04:00
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setColor2`
2017-05-01 13:35:13 +02:00
%End
public slots:
2017-05-01 13:35:13 +02:00
virtual void setColor2( const QColor &color );
%Docstring
2017-12-15 10:36:55 -04:00
Sets the second color for the widget
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param color: secondary widget color. Set to an invalid color to prevent
drawing of a secondary color
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setColor`
2017-12-15 10:36:55 -04:00
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`color2`
2017-05-01 13:35:13 +02:00
%End
2014-11-13 23:13:13 +01:00
protected:
2017-05-01 13:35:13 +02:00
virtual void mousePressEvent( QMouseEvent *e );
virtual void mouseReleaseEvent( QMouseEvent *e );
2017-05-01 13:35:13 +02:00
virtual void mouseMoveEvent( QMouseEvent *e );
2014-11-13 23:13:13 +01:00
};
2017-05-01 13:35:13 +02:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgscolorwidgets.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/