|
Krita Source Code Documentation
|
A widget for selecting two related colors. More...
#include <KoDualColorButton.h>
Inheritance diagram for KoDualColorButton:Classes | |
| class | Private |
Public Types | |
| enum | Selection { Foreground , Background } |
Public Slots | |
| void | backgroundSelect (bool usePlatformDialog) |
| void | foregroundSelect (bool usePlatformDialog) |
| 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 () |
| virtual void | paint_icons (QPainter &painter) |
| void | ResetColours () |
| void | setBackgroundColor (const KoColor &color) |
| void | setColorDialogState (Selection state) |
| void | setDisplayRenderer (const KoColorDisplayRendererInterface *displayRenderer=KoDumbColorDisplayRenderer::instance()) |
| void | setForegroundColor (const KoColor &color) |
| void | setPopDialog (bool popDialog) |
| void | slotColorDialogClosed () |
| void | slotSetBackgroundColorFromDialog (const KoColor color) |
| void | slotSetForegroundColorFromDialog (const KoColor color) |
| void | swapColours () |
| void | updateArrows () |
| void | updateColorSpace () |
| setColorSpace set ColorSpace so we can lock the selector. Right now this'll be changed per view-change. | |
Signals | |
| void | backgroundColorChanged (const KoColor &color) |
| void | foregroundColorChanged (const KoColor &color) |
Public Member Functions | |
| KoColor | backgroundColor () const |
| KoColor | foregroundColor () const |
| KoDualColorButton (KisCanvasResourceProvider *canvasResourceProvider, const KoColorDisplayRendererInterface *displayRenderer, QWidget *parent=0, QWidget *dialogParent=0) | |
| bool | popDialog () const |
| QSize | sizeHint () const override |
| ~KoDualColorButton () override | |
Public Attributes | |
| QPixmap | arrowBitmap |
| QRect | backgroundRect = QRect( 14, 14, 28, 28) |
| QRect | foregroundRect = QRect( 0, 0, 14, 14) |
| QPixmap | resetArrowPixmap |
| bool | resetColours = false |
| QPixmap | resetPixmap |
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 | mouseMoveEvent (QMouseEvent *event) override |
| virtual void | mousePressEvent (QMouseEvent *event) override |
| virtual void | mouseReleaseEvent (QMouseEvent *event) override |
| void | paintEvent (QPaintEvent *event) override |
Properties | |
| KoColor | backgroundColor |
| KoColor | foregroundColor |
| bool | popDialog |
Private Attributes | |
| Private *const | d |
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 41 of file KoDualColorButton.h.
| Enumerator | |
|---|---|
| Foreground | |
| Background | |
Definition at line 51 of file KoDualColorButton.h.
| KoDualColorButton::KoDualColorButton | ( | KisCanvasResourceProvider * | canvasResourceProvider, |
| const KoColorDisplayRendererInterface * | displayRenderer, | ||
| 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 85 of file KoDualColorButton.cpp.
References d, and KoDualColorButton::Private::init().
|
override |
| KoColor KoDualColorButton::backgroundColor | ( | ) | const |
Returns the current background color.
Definition at line 135 of file KoDualColorButton.cpp.
References KoDualColorButton::Private::backgroundColor, and d.
Emitted when the background color is changed.
|
slot |
Definition at line 303 of file KoDualColorButton.cpp.
References KoDualColorButton::Private::backgroundColor, backgroundColorChanged(), d, KoDualColorButton::Private::displayRenderer, openBackgroundDialog(), KoDualColorButton::Private::popDialog, and KoColor::toQColor().
|
overrideprotected |
Definition at line 438 of file KoDualColorButton.cpp.
References event(), and updateArrows().
|
overrideprotected |
Definition at line 248 of file KoDualColorButton.cpp.
References event().
|
overrideprotected |
Definition at line 253 of file KoDualColorButton.cpp.
References event().
|
overrideprotected |
Definition at line 451 of file KoDualColorButton.cpp.
References backgroundRect, and event().
| KoColor KoDualColorButton::foregroundColor | ( | ) | const |
Returns the current foreground color.
Definition at line 130 of file KoDualColorButton.cpp.
References d, and KoDualColorButton::Private::foregroundColor.
Emitted when the foreground color is changed.
|
slot |
Definition at line 320 of file KoDualColorButton.cpp.
References d, KoDualColorButton::Private::displayRenderer, KoDualColorButton::Private::foregroundColor, foregroundColorChanged(), openForegroundDialog(), KoDualColorButton::Private::popDialog, and KoColor::toQColor().
|
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 199 of file KoDualColorButton.cpp.
References KoColor::convertTo(), d, KoDualColorButton::Private::displayRenderer, and KoColor::toQColor().
|
overrideprotectedvirtual |
Reimplemented in KoResetBgFgColours, and KoSwapBgFgColours.
Definition at line 385 of file KoDualColorButton.cpp.
References KoDualColorButton::Private::backgroundColor, d, KoDualColorButton::Private::dragFlag, KoDualColorButton::Private::dragPosition, event(), Foreground, KoDualColorButton::Private::foregroundColor, getColorFromDisplayRenderer(), KoDualColorButton::Private::miniCtlFlag, and KoDualColorButton::Private::tmpSelection.
|
overrideprotectedvirtual |
Reimplemented in KoBackgroundColour, KoForegroundColour, KoResetBgFgColours, and KoSwapBgFgColours.
Definition at line 337 of file KoDualColorButton.cpp.
References Background, backgroundRect, d, KoDualColorButton::Private::dragFlag, KoDualColorButton::Private::dragPosition, event(), Foreground, foregroundRect, KoDualColorButton::Private::miniCtlFlag, ResetColours(), swapColours(), and KoDualColorButton::Private::tmpSelection.
|
overrideprotectedvirtual |
Reimplemented in KoBackgroundColour, KoForegroundColour, KoResetBgFgColours, and KoSwapBgFgColours.
Definition at line 401 of file KoDualColorButton.cpp.
References Background, KoDualColorButton::Private::backgroundColor, backgroundColorChanged(), backgroundRect, backgroundSelect(), d, KoDualColorButton::Private::dragFlag, event(), Foreground, KoDualColorButton::Private::foregroundColor, foregroundColorChanged(), foregroundRect, foregroundSelect(), KoDualColorButton::Private::miniCtlFlag, and KoDualColorButton::Private::tmpSelection.
|
slot |
Definition at line 290 of file KoDualColorButton.cpp.
References Background, KoDualColorButton::Private::backgroundColor, backgroundColorChanged(), KoDualColorButton::Private::colorDialogState, KoDualColorButton::Private::colorSelectorDialog, d, KisDlgInternalColorSelector::setPreviousColor(), KisDlgInternalColorSelector::slotColorUpdated(), and slotSetBackgroundColorFromDialog().
|
slot |
Definition at line 277 of file KoDualColorButton.cpp.
References KoDualColorButton::Private::colorDialogState, KoDualColorButton::Private::colorSelectorDialog, d, Foreground, KoDualColorButton::Private::foregroundColor, foregroundColorChanged(), KisDlgInternalColorSelector::setPreviousColor(), KisDlgInternalColorSelector::slotColorUpdated(), and slotSetForegroundColorFromDialog().
|
virtualslot |
Reimplemented in KoBackgroundColour, KoForegroundColour, KoResetBgFgColours, and KoSwapBgFgColours.
Definition at line 242 of file KoDualColorButton.cpp.
References arrowBitmap, foregroundRect, and resetPixmap.
|
overrideprotected |
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 216 of file KoDualColorButton.cpp.
References KoDualColorButton::Private::backgroundColor, backgroundRect, d, KoDualColorButton::Private::foregroundColor, foregroundRect, getColorFromDisplayRenderer(), paint_icons(), and resetColours.
| 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.
Definition at line 140 of file KoDualColorButton.cpp.
References d, and KoDualColorButton::Private::popDialog.
|
slot |
Definition at line 366 of file KoDualColorButton.cpp.
References KoDualColorButton::Private::backgroundColor, backgroundColorChanged(), d, KoDualColorButton::Private::displayRenderer, KoDualColorButton::Private::foregroundColor, and foregroundColorChanged().
Sets the background 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 164 of file KoDualColorButton.cpp.
References Background, KoDualColorButton::Private::backgroundColor, KoDualColorButton::Private::colorDialogState, KoDualColorButton::Private::colorSelectorDialog, d, and KisDlgInternalColorSelector::slotColorUpdated().
Definition at line 123 of file KoDualColorButton.cpp.
References KoDualColorButton::Private::colorDialogState, d, and KoDualColorButton::Private::tmpSelection.
|
slot |
Definition at line 179 of file KoDualColorButton.cpp.
References KoDualColorButton::Private::colorSelectorDialog, d, KoDualColorButton::Private::displayRenderer, KoDumbColorDisplayRenderer::instance(), KisDlgInternalColorSelector::setDisplayRenderer(), 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 150 of file KoDualColorButton.cpp.
References KoDualColorButton::Private::colorDialogState, KoDualColorButton::Private::colorSelectorDialog, d, Foreground, KoDualColorButton::Private::foregroundColor, and KisDlgInternalColorSelector::slotColorUpdated().
|
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 211 of file KoDualColorButton.cpp.
References d, KoDualColorButton::Private::popDialog, and popDialog.
|
override |
Returns the minimum size needed to display the widget and all its controls.
Definition at line 145 of file KoDualColorButton.cpp.
|
slot |
Definition at line 272 of file KoDualColorButton.cpp.
References KoDualColorButton::Private::colorDialogState, and d.
Definition at line 265 of file KoDualColorButton.cpp.
References KoDualColorButton::Private::backgroundColor, backgroundColorChanged(), and d.
Definition at line 258 of file KoDualColorButton.cpp.
References d, KoDualColorButton::Private::foregroundColor, and foregroundColorChanged().
|
slot |
Definition at line 375 of file KoDualColorButton.cpp.
References KoDualColorButton::Private::backgroundColor, backgroundColorChanged(), d, KoDualColorButton::Private::foregroundColor, and foregroundColorChanged().
|
slot |
Definition at line 101 of file KoDualColorButton.cpp.
References arrowBitmap, d, KoDualColorButton::Private::dialogParent, KisIconUtils::loadIcon(), resetArrowPixmap, and resetPixmap.
|
slot |
setColorSpace set ColorSpace so we can lock the selector. Right now this'll be changed per view-change.
| cs |
Definition at line 194 of file KoDualColorButton.cpp.
References KoDualColorButton::Private::colorSelectorDialog, d, KoDualColorButton::Private::displayRenderer, and KisDlgInternalColorSelector::lockUsedColorSpace().
| QPixmap KoDualColorButton::arrowBitmap |
Definition at line 59 of file KoDualColorButton.h.
| QRect KoDualColorButton::backgroundRect = QRect( 14, 14, 28, 28) |
Definition at line 56 of file KoDualColorButton.h.
|
private |
Definition at line 193 of file KoDualColorButton.h.
| QRect KoDualColorButton::foregroundRect = QRect( 0, 0, 14, 14) |
Definition at line 55 of file KoDualColorButton.h.
| QPixmap KoDualColorButton::resetArrowPixmap |
Definition at line 57 of file KoDualColorButton.h.
| bool KoDualColorButton::resetColours = false |
Definition at line 61 of file KoDualColorButton.h.
| QPixmap KoDualColorButton::resetPixmap |
Definition at line 58 of file KoDualColorButton.h.
|
readwrite |
Definition at line 46 of file KoDualColorButton.h.
|
readwrite |
Definition at line 45 of file KoDualColorButton.h.
|
readwrite |
Definition at line 47 of file KoDualColorButton.h.