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 <kis_palette_view.h>
17#include <KisPaletteModel.h>
18
19#include <Swatch.h>
20
21class KisSwatch;
22
23/**
24 * @class PaletteView
25 * @brief The PaletteView class is a wrapper around a MVC method for handling
26 * palettes. This class shows a nice widget that can drag and drop, edit colors in a colorset
27 * and will handle adding and removing entries if you'd like it to.
28 */
29
30class KRITALIBKIS_EXPORT PaletteView : public QWidget
31{
33public:
34 PaletteView(QWidget *parent = 0);
35 ~PaletteView();
36public Q_SLOTS:
37 /**
38 * @brief setPalette
39 * Set a new palette.
40 * @param palette
41 */
43 /**
44 * @brief addEntryWithDialog
45 * This gives a simple dialog for adding colors, with options like
46 * adding name, id, and to which group the color should be added.
47 * @param color the default color to add
48 * @return whether it was successful.
49 */
51 /**
52 * @brief addGroupWithDialog
53 * gives a little dialog to ask for the desired groupname.
54 * @return whether this was successful.
55 */
56 bool addGroupWithDialog();
57 /**
58 * @brief removeSelectedEntryWithDialog
59 * removes the selected entry. If it is a group, it pop up a dialog
60 * asking whether the colors should also be removed.
61 * @return whether this was successful
62 */
64 /**
65 * @brief trySelectClosestColor
66 * tries to select the closest color to the one given.
67 * It does not force a change on the active color.
68 * @param color the color to compare to.
69 */
72 /**
73 * @brief entrySelectedForeGround
74 * fires when a swatch is selected with leftclick.
75 * @param entry
76 */
78 /**
79 * @brief entrySelectedBackGround
80 * fires when a swatch is selected with rightclick.
81 * @param entry
82 */
84
85private Q_SLOTS:
86
87 void fgSelected(QModelIndex index);
88
89private:
90
91
92
93 struct Private;
95};
96
97#endif // LIBKIS_PALETTE_VIEW_H
The ManagedColor class is a class to handle colors that are color managed.
void entrySelectedForeGround(Swatch entry)
entrySelectedForeGround fires when a swatch is selected with leftclick.
bool addEntryWithDialog(ManagedColor *color)
addEntryWithDialog This gives a simple dialog for adding colors, with options like adding name,...
bool removeSelectedEntryWithDialog()
removeSelectedEntryWithDialog removes the selected entry.
void trySelectClosestColor(ManagedColor *color)
trySelectClosestColor tries to select the closest color to the one given.
void entrySelectedBackGround(Swatch entry)
entrySelectedBackGround fires when a swatch is selected with rightclick.
bool addGroupWithDialog()
addGroupWithDialog gives a little dialog to ask for the desired groupname.
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_OBJECTQ_OBJECT
Q_SIGNALSQ_SIGNALS
Q_SLOTSQ_SLOTS
QObject * parent() const const
QWidget(QWidget *parent, Qt::WindowFlags f)
void setPalette(const QPalette &)
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Apr 18 2025 12:12:36 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.