Krita

PresetChooser.cpp
1/*
2 * SPDX-FileCopyrightText: 2017 Boudewijn Rempt <boud@valdyas.org>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6#include "PresetChooser.h"
7
8#include <KoResource.h>
9#include <kis_config.h>
10#include "Resource.h"
11
12PresetChooser::PresetChooser(QWidget *parent)
13 : KisPresetChooser(parent)
14{
15 connect(this, SIGNAL(resourceSelected(KoResourceSP )), SLOT(slotResourceSelected(KoResourceSP )));
16 connect(this, SIGNAL(resourceClicked(KoResourceSP )), SLOT(slotResourceClicked(KoResourceSP )));
17 showTaggingBar(true);
18}
19
20
22{
23 KoResourceSP r = resource->resource();
24 setCurrentResource(r);
25}
26
28{
29 KoResourceSP r = currentResource();
30 if (r) {
31 return new Resource(r->resourceId(), "paintoppreset", r->name(), r->filename(), r->image());
32 }
33 return 0;
34}
35
36void PresetChooser::slotResourceSelected(KoResourceSP r)
37{
38 emit presetSelected(Resource(r->resourceId(), "paintoppreset", r->name(), r->filename(), r->image()));
39}
40
41void PresetChooser::slotResourceClicked(KoResourceSP r)
42{
43 emit presetClicked(Resource(r->resourceId(), "paintoppreset", r->name(), r->filename(), r->image()));
44}
void presetSelected(Resource resource)
Emitted whenever a user selects the given preset.
void setCurrentPreset(Resource *resource)
Make the given preset active.
Resource * currentPreset() const
void presetClicked(Resource resource)
Emitted whenever a user clicks on the given preset.
A Resource represents a gradient, pattern, brush tip, brush preset, palette or workspace definition.
Definition Resource.h:31
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sun Feb 25 2024 18:47:29 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.