|
Krita Source Code Documentation
|
A widget for selecting two related colors. More...
#include <KoDualColorButton.h>
Inheritance diagram for KoDualColorButton:Public Types | |
| enum | Selection { Foreground , Background } |
Public Slots | |
| QColor | getColorFromDisplayRenderer (KoColor c) |
| getColorFromDisplayRenderer convenience function to get the right qcolor from the display renderer, including checking whether the display renderer actually exists. | |
| void | openBackgroundDialog () |
| void | openForegroundDialog () |
| void | setBackgroundColor (const KoColor &color) |
| void | setColorSpace (const KoColorSpace *cs) |
| setColorSpace set ColorSpace so we can lock the selector. Right now this'll be changed per view-change. | |
| void | setDisplayRenderer (const KoColorDisplayRendererInterface *displayRenderer=KoDumbColorDisplayRenderer::instance()) |
| void | setForegroundColor (const KoColor &color) |
| void | setPopDialog (bool popDialog) |
| void | slotSetForeGroundColorFromDialog (const KoColor color) |
Signals | |
| void | backgroundColorChanged (const KoColor &color) |
| void | foregroundColorChanged (const KoColor &color) |
Public Member Functions | |
| KoColor | backgroundColor () const |
| KoColor | foregroundColor () const |
| void | init (KoDualColorButton *q) |
| KoDualColorButton (const KoColor &foregroundColor, const KoColor &backgroundColor, const KoColorDisplayRendererInterface *displayRenderer, QWidget *parent=0, QWidget *dialogParent=0) | |
| KoDualColorButton (const KoColor &foregroundColor, const KoColor &backgroundColor, QWidget *parent=0, QWidget *dialogParent=0) | |
| bool | popDialog () const |
| Private (const KoColor &fgColor, const KoColor &bgColor, QWidget *_dialogParent, const KoColorDisplayRendererInterface *_displayRenderer) | |
| QSize | sizeHint () const override |
| void | updateArrows () |
| ~KoDualColorButton () override | |
Public Attributes | |
| QPixmap | arrowBitmap |
| KoColor | backgroundColor |
| KisDlgInternalColorSelector * | colorSelectorDialog |
| QWidget * | dialogParent |
| QPointer< const KoColorDisplayRendererInterface > | displayRenderer |
| bool | dragFlag |
| QPoint | dragPosition |
| KoColor | foregroundColor |
| bool | miniCtlFlag |
| bool | popDialog |
| QPixmap | resetPixmap |
| Selection | tmpSelection |
Protected Member Functions | |
| void | changeEvent (QEvent *event) override |
| void | dragEnterEvent (QDragEnterEvent *event) override |
| void | dropEvent (QDropEvent *event) override |
| bool | event (QEvent *event) override |
| virtual void | metrics (QRect &foregroundRect, QRect &backgroundRect) |
| void | mouseMoveEvent (QMouseEvent *event) override |
| void | mousePressEvent (QMouseEvent *event) override |
| void | mouseReleaseEvent (QMouseEvent *event) override |
| void | paintEvent (QPaintEvent *event) override |
Private Attributes | |
| Private *const | d |
Private Attributes inherited from Private | |
| KisCanvas2 * | canvas |
| int | displayedFrame |
| int | intendedFrame |
Additional Inherited Members | |
Private Member Functions inherited from Private | |
| Private (KisCanvas2 *c) | |
A widget for selecting two related colors.
KoDualColorButton allows the user to select two cascaded colors (usually a foreground and background color). Other features include drag and drop from other KDE color widgets, a reset to black and white control, and a swap colors control.
When the user clicks on the foreground or background rectangle the rectangle is first sunken and the selectionChanged() signal is emitted. Further clicks will present a color dialog and Q_EMIT either the foregroundColorChanged() or backgroundColorChanged() if a new color is selected.
Note: With drag and drop when dropping a color the current selected color will be set, while when dragging a color it will use whatever color rectangle the mouse was pressed inside.
Definition at line 30 of file KoDualColorButton.cpp.
| Enumerator | |
|---|---|
| Foreground | |
| Background | |
Definition at line 47 of file KoDualColorButton.h.
| KoDualColorButton::KoDualColorButton | ( | const KoColor & | foregroundColor, |
| const KoColor & | backgroundColor, | ||
| QWidget * | parent = 0, | ||
| QWidget * | dialogParent = 0 ) |
Constructs a new KoDualColorButton with the supplied foreground and background colors.
| parent | The parent widget of the KoDualColorButton. |
| dialogParent | The parent widget of the color selection dialog. |
Definition at line 100 of file KoDualColorButton.cpp.
References d.
| KoDualColorButton::KoDualColorButton | ( | const KoColor & | foregroundColor, |
| const KoColor & | backgroundColor, | ||
| const KoColorDisplayRendererInterface * | displayRenderer, | ||
| QWidget * | parent = 0, | ||
| QWidget * | dialogParent = 0 ) |
Definition at line 109 of file KoDualColorButton.cpp.
References d.
|
override |
| KoColor KoDualColorButton::backgroundColor | ( | ) | const |
Returns the current background color.
Emitted when the background color is changed.
|
overrideprotected |
Definition at line 404 of file KoDualColorButton.cpp.
|
overrideprotected |
Definition at line 233 of file KoDualColorButton.cpp.
References event().
|
overrideprotected |
Definition at line 238 of file KoDualColorButton.cpp.
References event().
|
overrideprotected |
Definition at line 417 of file KoDualColorButton.cpp.
| KoColor KoDualColorButton::foregroundColor | ( | ) | const |
Returns the current foreground color.
Emitted when the foreground color is changed.
|
slot |
getColorFromDisplayRenderer convenience function to get the right qcolor from the display renderer, including checking whether the display renderer actually exists.
| c | the kocolor to convert. |
Definition at line 185 of file KoDualColorButton.cpp.
References KoColor::convertTo(), d, and KoColor::toQColor().
| void KoDualColorButton::init | ( | KoDualColorButton * | q | ) |
|
protectedvirtual |
Sets the supplied rectangles to the proper size and position for the current widget size. You can reimplement this to change the layout of the widget. Restrictions are that the swap control will always be at the top right, the reset control will always be at the bottom left, and you must leave at least a 14x14 space in those corners.
Definition at line 202 of file KoDualColorButton.cpp.
|
overrideprotected |
Definition at line 323 of file KoDualColorButton.cpp.
References d, event(), Foreground, and getColorFromDisplayRenderer().
|
overrideprotected |
Definition at line 278 of file KoDualColorButton.cpp.
References Background, backgroundColorChanged(), d, event(), Foreground, foregroundColorChanged(), and metrics().
|
overrideprotected |
Definition at line 339 of file KoDualColorButton.cpp.
References Background, backgroundColorChanged(), d, event(), Foreground, foregroundColorChanged(), KisDlgInternalColorSelector::getModalColorDialog(), and metrics().
|
slot |
Definition at line 271 of file KoDualColorButton.cpp.
References backgroundColorChanged(), d, and KisDlgInternalColorSelector::getModalColorDialog().
|
slot |
|
overrideprotected |
Definition at line 208 of file KoDualColorButton.cpp.
References d, getColorFromDisplayRenderer(), metrics(), and palette.
| bool KoDualColorButton::popDialog | ( | ) | const |
Returns if a dialog with a color chooser will be popped up when clicking If false then you could/should connect to the pleasePopDialog signal and pop your own dialog. Just set the current color afterwards.
|
inline |
Definition at line 33 of file KoDualColorButton.cpp.
|
slot |
setColorSpace set ColorSpace so we can lock the selector. Right now this'll be changed per view-change.
| cs |
Definition at line 180 of file KoDualColorButton.cpp.
References d.
|
slot |
Definition at line 165 of file KoDualColorButton.cpp.
References connect(), d, displayRenderer, KoDumbColorDisplayRenderer::instance(), and setDisplayRenderer().
Sets the foreground color.
The internal color selector might Q_EMIT the color of a different profile, so we should break this cycling dependency somehow.
Definition at line 145 of file KoDualColorButton.cpp.
References d.
|
slot |
Sets if a dialog with a color chooser should be popped up when clicking If you set this to false then you could connect to the pleasePopDialog signal and pop your own dialog. Just set the current color afterwards.
Definition at line 197 of file KoDualColorButton.cpp.
|
override |
Returns the minimum size needed to display the widget and all its controls.
Definition at line 140 of file KoDualColorButton.cpp.
Definition at line 257 of file KoDualColorButton.cpp.
References d, and foregroundColorChanged().
|
inline |
Definition at line 50 of file KoDualColorButton.cpp.
References p.
| QPixmap KoDualColorButton::arrowBitmap |
Definition at line 72 of file KoDualColorButton.cpp.
|
readwrite |
Definition at line 76 of file KoDualColorButton.cpp.
| KisDlgInternalColorSelector* KoDualColorButton::colorSelectorDialog |
Definition at line 77 of file KoDualColorButton.cpp.
|
private |
Definition at line 167 of file KoDualColorButton.h.
| QWidget* KoDualColorButton::dialogParent |
Definition at line 70 of file KoDualColorButton.cpp.
| QPointer<const KoColorDisplayRendererInterface> KoDualColorButton::displayRenderer |
Definition at line 81 of file KoDualColorButton.cpp.
| bool KoDualColorButton::dragFlag |
Definition at line 74 of file KoDualColorButton.cpp.
| QPoint KoDualColorButton::dragPosition |
Definition at line 78 of file KoDualColorButton.cpp.
|
readwrite |
Definition at line 75 of file KoDualColorButton.cpp.
| bool KoDualColorButton::miniCtlFlag |
Definition at line 74 of file KoDualColorButton.cpp.
|
readwrite |
Definition at line 80 of file KoDualColorButton.cpp.
| QPixmap KoDualColorButton::resetPixmap |
Definition at line 73 of file KoDualColorButton.cpp.
| Selection KoDualColorButton::tmpSelection |
Definition at line 79 of file KoDualColorButton.cpp.