Krita

PaletteView.h
1/*
2 * SPDX-FileCopyrightText: 2017 Wolthera van Hövell tot Westerflier <griffinvalley@gmail.com>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6
7#ifndef LIBKIS_PALETTE_VIEW_H
8#define LIBKIS_PALETTE_VIEW_H
9
10#include <QObject>
11#include <QScopedPointer>
12#include "kritalibkis_export.h"
13#include "libkis.h"
14#include "Palette.h"
15#include "ManagedColor.h"
16#include "KoColorSet.h"
17#include <kis_palette_view.h>
18#include <KisPaletteModel.h>
19
20#include <Swatch.h>
21
22class KisSwatch;
23
24/**
25 * @class PaletteView
26 * @brief The PaletteView class is a wrapper around a MVC method for handling
27 * palettes. This class shows a nice widget that can drag and drop, edit colors in a colorset
28 * and will handle adding and removing entries if you'd like it to.
29 */
30
31class KRITALIBKIS_EXPORT PaletteView : public QWidget
32{
33 Q_OBJECT
34public:
35 PaletteView(QWidget *parent = 0);
37public Q_SLOTS:
38 /**
39 * @brief setPalette
40 * Set a new palette.
41 * @param palette
42 */
43 void setPalette(Palette *palette);
44 /**
45 * @brief addEntryWithDialog
46 * This gives a simple dialog for adding colors, with options like
47 * adding name, id, and to which group the color should be added.
48 * @param color the default color to add
49 * @return whether it was successful.
50 */
51 bool addEntryWithDialog(ManagedColor *color);
52 /**
53 * @brief addGroupWithDialog
54 * gives a little dialog to ask for the desired groupname.
55 * @return whether this was successful.
56 */
57 bool addGroupWithDialog();
58 /**
59 * @brief removeSelectedEntryWithDialog
60 * removes the selected entry. If it is a group, it pop up a dialog
61 * asking whether the colors should also be removed.
62 * @return whether this was successful
63 */
64 bool removeSelectedEntryWithDialog();
65 /**
66 * @brief trySelectClosestColor
67 * tries to select the closest color to the one given.
68 * It does not force a change on the active color.
69 * @param color the color to compare to.
70 */
71 void trySelectClosestColor(ManagedColor *color);
73 /**
74 * @brief entrySelectedForeGround
75 * fires when a swatch is selected with leftclick.
76 * @param entry
77 */
79 /**
80 * @brief entrySelectedBackGround
81 * fires when a swatch is selected with rightclick.
82 * @param entry
83 */
85
86private Q_SLOTS:
87
88 void fgSelected(KisSwatch swatch);
89 void bgSelected(KisSwatch swatch);
90
91private:
92
93
94
95 struct Private;
97};
98
99#endif // LIBKIS_PALETTE_VIEW_H
The ManagedColor class is a class to handle colors that are color managed.
The PaletteView class is a wrapper around a MVC method for handling palettes.
Definition PaletteView.h:32
void entrySelectedForeGround(Swatch entry)
entrySelectedForeGround fires when a swatch is selected with leftclick.
void entrySelectedBackGround(Swatch entry)
entrySelectedBackGround fires when a swatch is selected with rightclick.
The Palette class Palette is a resource object that stores organised color data.
Definition Palette.h:45
The Swatch class is a thin wrapper around the KisSwatch class.
Definition Swatch.h:22
Q_SIGNALSQ_SIGNALS
Q_SLOTSQ_SLOTS
void setPalette(const QPalette &)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:35:00 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.