• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • krita API Reference
  • KDE Home
  • Contact Us
 

KritaWidgets

  • sources
  • kfour-appscomplete
  • krita
  • libs
  • widgets
kis_color_input.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2008 Cyrille Berger <[email protected]>
3  *
4  * SPDX-License-Identifier: LGPL-2.0-or-later
5  */
6 
7 #ifndef _KIS_COLOR_INPUT_H_
8 #define _KIS_COLOR_INPUT_H_
9 
10 #include <QWidget>
11 
12 class KoChannelInfo;
13 class KoColor;
14 class QWidget;
15 class QSpinBox;
16 class QDoubleSpinBox;
17 class KisIntParseSpinBox;
18 class KisDoubleParseSpinBox;
19 class KoColorSlider;
20 class QLineEdit;
21 
22 #include <KoColorDisplayRendererInterface.h>
23 #include "kritawidgets_export.h"
24 
25 class KRITAWIDGETS_EXPORT KisColorInput : public QWidget
26 {
27  Q_OBJECT
28 public:
29  KisColorInput(QWidget* parent, const KoChannelInfo*, KoColor* color, KoColorDisplayRendererInterface *displayRenderer = KoDumbColorDisplayRenderer::instance(), bool usePercentage = false);
30  inline bool usePercentage() const {
31  return m_usePercentage;
32  }
33  virtual inline void setPercentageWise(bool val) {
34  m_usePercentage = val;
35  }
36 
37 protected:
38  void init();
39  virtual QWidget* createInput() = 0;
40 Q_SIGNALS:
41  void updated();
42 protected:
43  const KoChannelInfo* m_channelInfo;
44  KoColor* m_color;
45  KoColorSlider* m_colorSlider;
46  KoColorDisplayRendererInterface *m_displayRenderer;
47  bool m_usePercentage;
48 };
49 
50 class KRITAWIDGETS_EXPORT KisIntegerColorInput : public KisColorInput
51 {
52  Q_OBJECT
53 public:
54  KisIntegerColorInput(QWidget* parent, const KoChannelInfo*, KoColor* color, KoColorDisplayRendererInterface *displayRenderer = KoDumbColorDisplayRenderer::instance(), bool usePercentage = false);
55 protected:
56  QWidget* createInput() override;
57  void setPercentageWise(bool val) override;
58 public Q_SLOTS:
59  void setValue(int);
60  void update();
61 private Q_SLOTS:
62  void onColorSliderChanged(int);
63  void onNumInputChanged(int);
64 private:
65  KisIntParseSpinBox* m_intNumInput;
66 };
67 
68 
69 class KRITAWIDGETS_EXPORT KisFloatColorInput : public KisColorInput
70 {
71  Q_OBJECT
72 public:
73  KisFloatColorInput(QWidget* parent, const KoChannelInfo*, KoColor* color, KoColorDisplayRendererInterface *displayRenderer = KoDumbColorDisplayRenderer::instance(), bool usePercentage = false);
74 protected:
75  QWidget* createInput() override;
76 public Q_SLOTS:
77  void setValue(double);
78  void sliderChanged(int);
79  void update();
80 private:
81  KisDoubleParseSpinBox* m_dblNumInput;
82  qreal m_minValue;
83  qreal m_maxValue;
84 };
85 
86 class KRITAWIDGETS_EXPORT KisHexColorInput : public KisColorInput
87 {
88  Q_OBJECT
89 public:
90  KisHexColorInput(QWidget* parent, KoColor* color, KoColorDisplayRendererInterface *displayRenderer = KoDumbColorDisplayRenderer::instance(), bool usePercentage = false);
91 protected:
92  QWidget* createInput() override;
93 public Q_SLOTS:
94  void setValue();
95  void update();
96 private:
97  QLineEdit* m_hexInput;
98 };
99 
100 #endif
KisColorInput::m_usePercentage
bool m_usePercentage
Definition: kis_color_input.h:47
KisColorInput::m_channelInfo
const KoChannelInfo * m_channelInfo
Definition: kis_color_input.h:43
KisDoubleParseSpinBox
KisColorInput
Definition: kis_color_input.h:25
QLineEdit
KisFloatColorInput
Definition: kis_color_input.h:69
KisColorInput::m_displayRenderer
KoColorDisplayRendererInterface * m_displayRenderer
Definition: kis_color_input.h:46
QWidget::update
void update()
KisColorInput::createInput
virtual QWidget * createInput()=0
QWidget
QDoubleSpinBox
KisColorInput::setPercentageWise
virtual void setPercentageWise(bool val)
Definition: kis_color_input.h:33
KisColorInput::m_color
KoColor * m_color
Definition: kis_color_input.h:44
QSpinBox
KisColorInput::m_colorSlider
KoColorSlider * m_colorSlider
Definition: kis_color_input.h:45
KisIntegerColorInput
Definition: kis_color_input.h:50
KisColorInput::usePercentage
bool usePercentage() const
Definition: kis_color_input.h:30
KisHexColorInput
Definition: kis_color_input.h:86
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Tue Jan 19 2021 23:44:00 by doxygen 1.8.16 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KritaWidgets

Skip menu "KritaWidgets"
  • Main Page
  • Namespace List
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

krita API Reference

Skip menu "krita API Reference"
  • libs
  •   KritaBasicFlakes
  •   brush
  •   KritaUndo2
  •   KritaFlake
  •   image
  •   KritaPlugin
  •   Krita
  •   KritaPigment
  •   KritaResources
  •   KritaStore
  •   ui
  •   KritaWidgets
  •   KritaWidgetUtils
  • plugins
  •   Assitants
  •   Extensions
  •   Filters
  •   Generators
  •   Formats
  •           src
  •   PaintOps
  •     libpaintop

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal