Krita Source Code Documentation
Loading...
Searching...
No Matches
KisPaletteComboBox.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2018 Michael Zhou <simeirxh@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
7#ifndef KISPALETTECOMBOBOX_H
8#define KISPALETTECOMBOBOX_H
9
10#include "kritawidgets_export.h"
11
12#include <QPointer>
13#include <QPixmap>
14#include <QPair>
15#include <QHash>
16#include <KisSqueezedComboBox.h>
17#include <KisPaletteModel.h>
18#include <KisSwatchGroup.h>
19
20class KisPaletteView;
21
27class KRITAWIDGETS_EXPORT KisPaletteComboBox : public KisSqueezedComboBox
28{
29 Q_OBJECT
30private:
31
32 typedef QPair<int, int> SwatchPosType; // first is column #, second is row #
33 typedef QHash<SwatchPosType, int> PosIdxMapType;
34
35public:
36 explicit KisPaletteComboBox(QWidget *parent = 0);
38
39Q_SIGNALS:
41
42public:
43 void setCompanionView(KisPaletteView *);
44
45private Q_SLOTS:
46
47 void setPaletteModel(const KisPaletteModel *);
48 void slotPaletteChanged();
49 void slotSwatchSelected(const QModelIndex &index);
50 void slotIndexUpdated(int);
51
52private:
53
54 QPixmap createColorSquare(const KisSwatch &swatch) const;
55 static bool swatchInfoLess(const KisSwatchGroup::SwatchInfo &, const KisSwatchGroup::SwatchInfo &);
56
57private:
60 QHash<QString, PosIdxMapType> m_groupMapMap;
62};
63
64#endif // KISPALETTECOMBOBOX_H
The KisPaletteComboBox class A combobox used with KisPaletteView.
QPointer< const KisPaletteModel > m_model
QPointer< KisPaletteView > m_view
QPair< int, int > SwatchPosType
QHash< QString, PosIdxMapType > m_groupMapMap
void sigColorSelected(const KoColor &)
QHash< SwatchPosType, int > PosIdxMapType
QVector< KisSwatch > m_idxSwatchMap
The KisPaletteModel class This, together with KisPaletteView and KisPaletteDelegate forms a mvc way t...