Krita Source Code Documentation
Loading...
Searching...
No Matches
KoBackgroundColour.cpp
Go to the documentation of this file.
1/* This file is part of the KDE libraries
2 SPDX-FileCopyrightText: 2026 Arkady Flury <arkady.flury@gmail.com>
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
14
16 const KoColorDisplayRendererInterface *displayRenderer,
17 QWidget *parent, QWidget *dialogParent)
18 : KoDualColorButton(canvasResourceProvider, displayRenderer, parent, dialogParent)
19{
20 foregroundRect = QRect( 0, 0, 12, 12);
21 backgroundRect = QRect( 6, 6, 22, 22);
23}
24
25
26void KoBackgroundColour::paint_icons(QPainter &painter)
27{
28 Q_UNUSED(painter);
29}
30
31void KoBackgroundColour::mousePressEvent( QMouseEvent *event )
32{
33 Q_UNUSED(event);
34}
35
36void KoBackgroundColour::mouseReleaseEvent( QMouseEvent *event )
37{
38 Q_UNUSED(event);
39
40 KConfigGroup cfg = KSharedConfig::openConfig()->group("colorselector");
41 bool usePlatformDialog = cfg.readEntry("UsePlatformColorDialog", false);
42
43 backgroundSelect(usePlatformDialog);
44
45 update();
46}
47
48bool KoBackgroundColour::event(QEvent *event)
49{
50 if (event->type() == QEvent::ToolTip) {
51 this->setToolTip(i18n("Background color selector"));
52 }
53 return QWidget::event(event);
54}
bool event(QEvent *event) override
void paint_icons(QPainter &painter) override
void mousePressEvent(QMouseEvent *event) override
KoBackgroundColour(KisCanvasResourceProvider *canvasResourceProvider, const KoColorDisplayRendererInterface *displayRenderer=0, QWidget *parent=0, QWidget *dialogParent=0)
void mouseReleaseEvent(QMouseEvent *event) override
A widget for selecting two related colors.
void setColorDialogState(Selection state)
void backgroundSelect(bool usePlatformDialog)