Krita Source Code Documentation
Loading...
Searching...
No Matches
KisShadeSelectorLineComboBox Class Reference

#include <kis_shade_selector_line_combo_box.h>

+ Inheritance diagram for KisShadeSelectorLineComboBox:

Public Slots

void setConfiguration (const QString &stri)
 
void setGradient (bool)
 
void setLineHeight (int height)
 
void setPatchCount (int count)
 
void setPatches (bool)
 
void updateSettings ()
 

Public Member Functions

QString configuration () const
 
void hidePopup () override
 
 KisShadeSelectorLineComboBox (QWidget *parent=0)
 
void setLineNumber (int n)
 
void showPopup () override
 
 ~KisShadeSelectorLineComboBox () override
 

Protected Member Functions

void resizeEvent (QResizeEvent *e) override
 

Private Attributes

KisShadeSelectorLinem_currentLine
 
QScopedPointer< KisColorSelectorBaseProxym_parentProxy
 
KisShadeSelectorLineComboBoxPopupm_popup
 

Detailed Description

Definition at line 16 of file kis_shade_selector_line_combo_box.h.

Constructor & Destructor Documentation

◆ KisShadeSelectorLineComboBox()

KisShadeSelectorLineComboBox::KisShadeSelectorLineComboBox ( QWidget * parent = 0)
explicit

Definition at line 26 of file kis_shade_selector_line_combo_box.cpp.

26 :
27 QComboBox(parent),
30 m_currentLine(new KisShadeSelectorLine(0,0,0, m_parentProxy.data(), this))
31{
32 QGridLayout* l = new QGridLayout(this);
33 {
34 int left;
35 l->getContentsMargins(&left, nullptr, nullptr, nullptr);
36 l->setContentsMargins(left, 0, 30, 0);
37
38 }
39 l->addWidget(m_currentLine);
40
41 m_currentLine->setAttribute(Qt::WA_TransparentForMouseEvents);
42
43 KoColor color;
44 color.fromQColor(QColor(190, 50, 50));
45 m_currentLine->setColor(color);
46
48}
KisShadeSelectorLineComboBoxPopup * m_popup
QScopedPointer< KisColorSelectorBaseProxy > m_parentProxy
void setColor(const KoColor &color)
void fromQColor(const QColor &c)
Convenient function for converting from a QColor.
Definition KoColor.cpp:213

References KoColor::fromQColor(), m_currentLine, KisShadeSelectorLine::setColor(), and updateSettings().

◆ ~KisShadeSelectorLineComboBox()

KisShadeSelectorLineComboBox::~KisShadeSelectorLineComboBox ( )
override

Definition at line 50 of file kis_shade_selector_line_combo_box.cpp.

51{
52}

Member Function Documentation

◆ configuration()

QString KisShadeSelectorLineComboBox::configuration ( ) const

Definition at line 88 of file kis_shade_selector_line_combo_box.cpp.

89{
90 return m_currentLine->toString();
91}
QString toString() const override

References m_currentLine, and KisShadeSelectorLine::toString().

◆ hidePopup()

void KisShadeSelectorLineComboBox::hidePopup ( )
override

Definition at line 54 of file kis_shade_selector_line_combo_box.cpp.

55{
56 QComboBox::hidePopup();
57 m_popup->hide();
58}

References m_popup.

◆ resizeEvent()

void KisShadeSelectorLineComboBox::resizeEvent ( QResizeEvent * e)
overrideprotected

Definition at line 104 of file kis_shade_selector_line_combo_box.cpp.

105{
106 e->accept();
107
108 m_popup->setMinimumWidth(qMax(280, width()));
109 m_popup->setMaximumWidth(qMax(280, width()));
110}

References m_popup.

◆ setConfiguration

void KisShadeSelectorLineComboBox::setConfiguration ( const QString & stri)
slot

Definition at line 82 of file kis_shade_selector_line_combo_box.cpp.

83{
85 update();
86}
void fromString(const QString &string) override
bool update(QSpinBox *spinBox)

References KisShadeSelectorLine::fromString(), and m_currentLine.

◆ setGradient

void KisShadeSelectorLineComboBox::setGradient ( bool b)
slot

Definition at line 129 of file kis_shade_selector_line_combo_box.cpp.

130{
132 for(int i=0; i<m_popup->layout()->count(); i++) {
133 KisShadeSelectorLine* item = dynamic_cast<KisShadeSelectorLine*>(m_popup->layout()->itemAt(i)->widget());
134 if(item!=nullptr) {
135 item->m_gradient=b;
136 }
137 }
138
139 update();
140}

References m_currentLine, KisShadeSelectorLine::m_gradient, and m_popup.

◆ setLineHeight

void KisShadeSelectorLineComboBox::setLineHeight ( int height)
slot

◆ setLineNumber()

void KisShadeSelectorLineComboBox::setLineNumber ( int n)

Definition at line 93 of file kis_shade_selector_line_combo_box.cpp.

94{
96 for(int i=0; i<m_popup->layout()->count(); i++) {
97 KisShadeSelectorLine* item = dynamic_cast<KisShadeSelectorLine*>(m_popup->layout()->itemAt(i)->widget());
98 if(item!=nullptr) {
99 item->setLineNumber(n);
100 }
101 }
102}

References m_currentLine, m_popup, and KisShadeSelectorLineBase::setLineNumber().

◆ setPatchCount

void KisShadeSelectorLineComboBox::setPatchCount ( int count)
slot

Definition at line 155 of file kis_shade_selector_line_combo_box.cpp.

156{
158 for(int i=0; i<m_popup->layout()->count(); i++) {
159 KisShadeSelectorLine* item = dynamic_cast<KisShadeSelectorLine*>(m_popup->layout()->itemAt(i)->widget());
160 if(item!=nullptr) {
161 item->m_patchCount=count;
162 }
163 }
164
165 update();
166}

References m_currentLine, KisShadeSelectorLine::m_patchCount, and m_popup.

◆ setPatches

void KisShadeSelectorLineComboBox::setPatches ( bool b)
slot

Definition at line 142 of file kis_shade_selector_line_combo_box.cpp.

143{
145 for(int i=0; i<m_popup->layout()->count(); i++) {
146 KisShadeSelectorLine* item = dynamic_cast<KisShadeSelectorLine*>(m_popup->layout()->itemAt(i)->widget());
147 if(item!=nullptr) {
148 item->m_gradient=!b;
149 }
150 }
151
152 update();
153}

References m_currentLine, KisShadeSelectorLine::m_gradient, and m_popup.

◆ showPopup()

void KisShadeSelectorLineComboBox::showPopup ( )
override

Definition at line 60 of file kis_shade_selector_line_combo_box.cpp.

61{
62 QComboBox::showPopup();
63 m_popup->show();
64
65 const int widgetMargin = 20;
66 QScreen *screen = qApp->screenAt(QCursor::pos());
67 QRect fitRect;
68 if (screen) {
69 fitRect = kisGrowRect(screen->availableGeometry(), -widgetMargin);
70 }
71 else {
72 fitRect = kisGrowRect(QRect(0, 0, 1024, 768), -widgetMargin);
73 }
74 QRect popupRect = m_popup->rect();
75 popupRect.moveTo(mapToGlobal(QPoint()));
76 popupRect = kisEnsureInRect(popupRect, fitRect);
77
78 m_popup->move(popupRect.topLeft());
80}
T kisGrowRect(const T &rect, U offset)
Definition kis_global.h:186
QRect kisEnsureInRect(QRect rc, const QRect &bounds)
Definition kis_global.h:267

References kisEnsureInRect(), kisGrowRect(), m_currentLine, m_popup, KisShadeSelectorLineComboBoxPopup::setConfiguration(), and KisShadeSelectorLine::toString().

◆ updateSettings

void KisShadeSelectorLineComboBox::updateSettings ( )
slot

Definition at line 112 of file kis_shade_selector_line_combo_box.cpp.

113{
115 for(int i=0; i<m_popup->layout()->count(); i++) {
116 KisShadeSelectorLine* item = dynamic_cast<KisShadeSelectorLine*>(m_popup->layout()->itemAt(i)->widget());
117 if(item!=nullptr) {
118 item->updateSettings();
119 item->m_lineHeight = 30;
120 item->setMaximumHeight(30);
121 item->setMinimumHeight(30);
122 }
123 }
124
126}

References m_currentLine, KisShadeSelectorLine::m_lineHeight, m_popup, setLineHeight(), and KisShadeSelectorLine::updateSettings().

Member Data Documentation

◆ m_currentLine

KisShadeSelectorLine* KisShadeSelectorLineComboBox::m_currentLine
private

Definition at line 41 of file kis_shade_selector_line_combo_box.h.

◆ m_parentProxy

QScopedPointer<KisColorSelectorBaseProxy> KisShadeSelectorLineComboBox::m_parentProxy
private

Definition at line 40 of file kis_shade_selector_line_combo_box.h.

◆ m_popup

KisShadeSelectorLineComboBoxPopup* KisShadeSelectorLineComboBox::m_popup
private

Definition at line 39 of file kis_shade_selector_line_combo_box.h.


The documentation for this class was generated from the following files: