Krita Source Code Documentation
Loading...
Searching...
No Matches
KoForegroundColour.cpp
Go to the documentation of this file.
1/* This file is part of the KDE libraries
2 SPDX-FileCopyrightText: 1999 Daniel M. Duley <mosfet@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-only
5*/
6
8#include <QPainter>
9#include <QColorDialog>
10#include <QEvent>
11#include <kconfiggroup.h>
12#include <ksharedconfig.h>
13
15 const KoColorDisplayRendererInterface *displayRenderer,
16 QWidget *parent, QWidget *dialogParent)
17 : KoDualColorButton(canvasResourceProvider, displayRenderer, parent, dialogParent)
18{
19 foregroundRect = QRect( 0, 0, 22, 22);
20 backgroundRect = QRect( 16, 16, 12, 12);
22}
23
24
25void KoForegroundColour::paint_icons(QPainter &painter)
26{
27 Q_UNUSED(painter);
28}
29
30void KoForegroundColour::mousePressEvent( QMouseEvent *event )
31{
32 Q_UNUSED(event);
33}
34
35void KoForegroundColour::mouseReleaseEvent( QMouseEvent *event )
36{
37 Q_UNUSED(event);
38
39 KConfigGroup cfg = KSharedConfig::openConfig()->group("colorselector");
40 bool usePlatformDialog = cfg.readEntry("UsePlatformColorDialog", false);
41
42 foregroundSelect(usePlatformDialog);
43
44 update();
45}
46
47bool KoForegroundColour::event(QEvent *event)
48{
49 if (event->type() == QEvent::ToolTip) {
50 this->setToolTip(i18n("Foreground color selector"));
51 }
52 return QWidget::event(event);
53}
A widget for selecting two related colors.
void setColorDialogState(Selection state)
void foregroundSelect(bool usePlatformDialog)
void mouseReleaseEvent(QMouseEvent *event) override
void mousePressEvent(QMouseEvent *event) override
void paint_icons(QPainter &painter) override
bool event(QEvent *event) override
KoForegroundColour(KisCanvasResourceProvider *canvasResourceProvider, const KoColorDisplayRendererInterface *displayRenderer=0, QWidget *parent=0, QWidget *dialogParent=0)