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 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779
|
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgscolorwidgets.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
class QgsColorWidget : QWidget
{
%Docstring(signature="appended")
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 :py:class:`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).
%End
%TypeHeaderCode
#include "qgscolorwidgets.h"
%End
public:
enum ColorComponent /BaseType=IntEnum/
{
Multiple,
Red,
Green,
Blue,
Hue,
Saturation,
Value,
Alpha,
Cyan,
Magenta,
Yellow,
Black
};
enum class ComponentUnit
{
Scaled0to255,
Percent,
Degree
};
QgsColorWidget( QWidget *parent /TransferThis/ = 0, 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:: :py:func:`setColor`
%End
ColorComponent component() const;
%Docstring
Returns the color component which the widget controls
:return: color component for widget
.. seealso:: :py:func:`setComponent`
%End
int componentValue() const /Deprecated/;
%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:: :py:func:`setComponentValue`
.. seealso:: :py:func:`component`
.. deprecated:: 3.40
Use :py:func:`~QgsColorWidget.componentValueF` instead.
%End
float componentValueF() 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:: :py:func:`setComponentValueF`
.. seealso:: :py:func:`component`
.. versionadded:: 3.40
%End
static QPixmap createDragIcon( const QColor &color );
%Docstring
Create an icon for dragging colors
:param color: for icon
%End
static ComponentUnit componentUnit( ColorComponent component );
%Docstring
Returns color ``component`` unit
%End
public slots:
virtual void setColor( const QColor &color, 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:: :py:func:`color`
%End
virtual void setComponent( QgsColorWidget::ColorComponent component );
%Docstring
Sets the color component which the widget controls
:param component: color component for widget
.. seealso:: :py:func:`component`
%End
virtual void setComponentValue( int value ) /Deprecated/;
%Docstring
Alters the widget's color by setting the value for the widget's color
component
:param value: value for widget's color component in the range between 0
and the value returned by
:py:func:`~QgsColorWidget.componentRange`. This value is
automatically clipped to the range of valid values for the
color component.
.. seealso:: :py:func:`componentValue`
.. seealso:: :py:func:`setComponent`
.. note::
this method has no effect if the widget is set to the QgsColorWidget.Multiple
component
.. deprecated:: 3.40
Use :py:func:`~QgsColorWidget.setComponentValueF` instead.
%End
virtual void setComponentValueF( float 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 in the range 0.0-1.0.
This value is automatically clipped to the range 0.0-1.0.
.. seealso:: :py:func:`componentValue`
.. seealso:: :py:func:`setComponent`
.. note::
this method has no effect if the widget is set to the QgsColorWidget.Multiple
component
.. versionadded:: 3.40
%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.
%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
%End
static int componentRange( ColorComponent component );
%Docstring
Returns the range of valid values a color component
:return: maximum value allowed for color component
%End
int componentValue( ColorComponent component ) const /Deprecated/;
%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 in the range between 0 and the value
returned by :py:func:`~QgsColorWidget.componentRange`, or -1 if
widget has an invalid color set
.. seealso:: :py:func:`hue`
.. deprecated:: 3.40
Use :py:func:`~QgsColorWidget.componentValueF` instead.
%End
float componentValueF( 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 in the range 0-1.0, or -1 if widget
has an invalid color set
.. seealso:: :py:func:`hue`
.. versionadded:: 3.40
%End
int hue() const /Deprecated/;
%Docstring
Returns the hue for the widget. This may differ from the hue for the
QColor returned by :py:func:`~QgsColorWidget.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 in the range 0-359
.. deprecated:: 3.40
Use :py:func:`~QgsColorWidget.hueF` instead.
%End
float hueF() const;
%Docstring
Returns the hue for the widget. This may differ from the hue for the
QColor returned by :py:func:`~QgsColorWidget.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 in the range 0-1.0
.. versionadded:: 3.40
%End
static void alterColor( QColor &color, QgsColorWidget::ColorComponent component, int newValue ) /Deprecated/;
%Docstring
Alters a color by modifying 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 in the range between 0 and
the value returned by
:py:func:`~QgsColorWidget.componentRange`. Values are
automatically clipped to a valid range for the color
component.
.. deprecated:: 3.40
Use :py:func:`~QgsColorWidget.alterColorF` instead.
%End
static void alterColorF( QColor &color, QgsColorWidget::ColorComponent component, float newValue );
%Docstring
Alters a color by modifying 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 in the range between 0 and
the value returned by
:py:func:`~QgsColorWidget.componentRange`. Values are
automatically clipped to range 0.0-1.0
.. versionadded:: 3.40
%End
QColor::Spec colorSpec() const;
%Docstring
Returns color widget type of color, either RGB, HSV, CMYK, or Invalid if
this component value is Multiple or Alpha
%End
static QColor::Spec colorSpec( QgsColorWidget::ColorComponent component );
%Docstring
Returns ``component`` type of color, either RGB, HSV, CMYK, or Invalid
if ``component`` value is Multiple or Alpha
%End
static const QPixmap &transparentBackground();
%Docstring
Generates a checkboard pattern pixmap for use as a background to
transparent colors
:return: checkerboard pixmap
%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(signature="appended")
An action containing a color widget, which can be embedded into a menu.
.. seealso:: :py:class:`QgsColorWidget`
%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: :py:class:`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.
%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:: :py:func:`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:: :py:func:`setDismissOnColorSelection`
%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(signature="appended")
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.
%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
~QgsColorWheel();
virtual QSize sizeHint() const;
virtual void paintEvent( QPaintEvent *event );
public slots:
virtual void setColor( const QColor &color, 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(signature="appended")
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.
%End
%TypeHeaderCode
#include "qgscolorwidgets.h"
%End
public:
QgsColorBox( QWidget *parent /TransferThis/ = 0, 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
~QgsColorBox();
virtual QSize sizeHint() const;
virtual void paintEvent( QPaintEvent *event );
virtual void setComponent( ColorComponent component );
public slots:
virtual void setColor( const QColor &color, 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 QgsColorRampWidget : QgsColorWidget
{
%Docstring(signature="appended")
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%).
%End
%TypeHeaderCode
#include "qgscolorwidgets.h"
%End
public:
enum Orientation /BaseType=IntEnum/
{
Horizontal,
Vertical
};
QgsColorRampWidget( QWidget *parent /TransferThis/ = 0, ColorComponent component = QgsColorWidget::Red, 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( Orientation orientation );
%Docstring
Sets the orientation for the color ramp
:param orientation: new orientation for the ramp
.. seealso:: :py:func:`orientation`
%End
Orientation orientation() const;
%Docstring
Fetches the orientation for the color ramp
:return: orientation for the ramp
.. seealso:: :py:func:`setOrientation`
%End
void setInteriorMargin( int margin );
%Docstring
Sets the margin between the edge of the widget and the ramp
:param margin: margin around the ramp
.. seealso:: :py:func:`interiorMargin`
%End
int interiorMargin() const;
%Docstring
Fetches the margin between the edge of the widget and the ramp
:return: margin around the ramp
.. seealso:: :py:func:`setInteriorMargin`
%End
void setShowFrame( 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:: :py:func:`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:: :py:func:`setShowFrame`
%End
void setMarkerSize( int markerSize );
%Docstring
Sets the size for drawing the triangular markers on the ramp
:param markerSize: marker size in pixels
%End
signals:
void valueChanged( int value ) /Deprecated/;
%Docstring
Emitted when the widget's color component value changes
:param value: new value of color component in the range between 0 and
the value returned by
:py:func:`~QgsColorRampWidget.componentRange`
.. deprecated:: 3.40
Use :py:func:`~QgsColorRampWidget.valueChangedF` instead.
%End
void valueChangedF( float value );
%Docstring
Emitted when the widget's color component value changes
:param value: new value of color component in the range 0.0-1.0
.. versionadded:: 3.40
%End
protected:
virtual void mouseMoveEvent( QMouseEvent *event );
virtual void wheelEvent( QWheelEvent *event );
virtual void mousePressEvent( QMouseEvent *event );
virtual void mouseReleaseEvent( QMouseEvent *event );
virtual void keyPressEvent( QKeyEvent *event );
};
class QgsColorSliderWidget : QgsColorWidget
{
%Docstring(signature="appended")
A composite horizontal color ramp widget and associated spinbox for
manual value entry.
%End
%TypeHeaderCode
#include "qgscolorwidgets.h"
%End
public:
QgsColorSliderWidget( QWidget *parent /TransferThis/ = 0, 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( ColorComponent component );
virtual void setComponentValueF( float value );
virtual void setColor( const QColor &color, bool emitSignals = false );
};
class QgsColorTextWidget : QgsColorWidget
{
%Docstring(signature="appended")
A line edit widget which displays colors as text and accepts string
representations of colors.
%End
%TypeHeaderCode
#include "qgscolorwidgets.h"
%End
public:
enum ColorTextFormat /BaseType=IntEnum/
{
HexRgb,
HexRgbA,
Rgb,
Rgba
};
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, bool emitSignals = false );
void setAllowOpacity( bool allowOpacity );
%Docstring
Sets whether opacity modification (transparency) is permitted. Defaults
to ``True``.
:param allowOpacity: set to ``False`` to disable opacity modification
%End
protected:
virtual void resizeEvent( QResizeEvent *event );
};
class QgsColorPreviewWidget : QgsColorWidget
{
%Docstring(signature="appended")
A preview box which displays one or two colors as swatches.
%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:: :py:func:`color`
.. seealso:: :py:func:`setColor2`
%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:: :py:func:`setColor`
.. seealso:: :py:func:`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.py again *
************************************************************************/
|