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

#include <kis_selection_options.h>

+ Inheritance diagram for KisSelectionOptions:

Classes

class  Private
 

Public Types

enum  ReferenceLayers { CurrentLayer , AllLayers , ColorLabeledLayers }
 

Signals

void actionChanged (SelectionAction action)
 
void antiAliasSelectionChanged (bool antiAliasSelection)
 
void featherSelectionChanged (int featherSelection)
 
void growSelectionChanged (int growSelection)
 
void modeChanged (SelectionMode mode)
 
void moveSelectedContentChanged (bool moveSelectedContent)
 
void referenceLayersChanged (ReferenceLayers referenceLayers)
 
void selectedColorLabelsChanged ()
 
void stopGrowingAtDarkestPixelChanged (bool stopGrowingAtDarkestPixel)
 

Public Member Functions

SelectionAction action () const
 
bool antiAliasSelection () const
 
int featherSelection () const
 
int growSelection () const
 
 KisSelectionOptions (QWidget *parent=nullptr)
 
SelectionMode mode () const
 
bool moveSelectedContent () const
 
ReferenceLayers referenceLayers () const
 
QList< int > selectedColorLabels () const
 
void setAction (SelectionAction newAction)
 
void setActionSectionVisible (bool visible)
 
void setAdjustmentsSectionVisible (bool visible)
 
void setAntiAliasSelection (bool newAntiAliasSelection)
 
void setFeatherSelection (int newFeatherSelection)
 
void setGrowSelection (int newGrowSelection)
 
void setMode (SelectionMode newMode)
 
void setModeSectionVisible (bool visible)
 
void setMoveSelectedContent (bool newMoveSelectedContent)
 
void setReferenceLayers (ReferenceLayers newReferenceLayers)
 
void setReferenceSectionVisible (bool visible)
 
void setSelectedColorLabels (const QList< int > &newSelectedColorLabels)
 
void setStopGrowingAtDarkestPixel (bool newStopGrowingAtDarkestPixel)
 
void setStopGrowingAtDarkestPixelButtonVisible (bool visible)
 
bool stopGrowingAtDarkestPixel () const
 
void updateActionButtonToolTip (SelectionAction action, const QKeySequence &shortcut)
 
 ~KisSelectionOptions () override
 
- Public Member Functions inherited from KisOptionCollectionWidget
void appendWidget (const QString &id, QWidget *widget)
 Insert the given widget with the given id at the end of the list. The list widget takes ownership of the inserted widget.
 
bool containsWidget (const QString &id) const
 Get if the list contains a widget with the given id.
 
QWidget * findWidget (const QString &path) const
 Get the widget that is at the given path. The path must be a forward slash separated list of ids. If the list contains some other KisOptionCollectionWidget or KisOptionCollectionWidgetWithHeader, and they do as well, then they form a hierarchy tree, so the path is searched recursively through all those child widgets.
 
template<typename T >
findWidgetAs (const QString &path) const
 Get the widget that is at the given path casted to some other class.
 
void insertWidget (int index, const QString &id, QWidget *widget)
 Insert the given widget with the given id at the given position. The list widget takes ownership of the inserted widget.
 
 KisOptionCollectionWidget (QWidget *parent=nullptr)
 
int numberOfVisibleWidgets () const
 Get the number of visible widgets in the list.
 
void removeWidget (const QString &id)
 Remove the widget that has the given id from the list. This also destroys the widget.
 
void removeWidget (int index)
 Remove the widget that is at the given position from the list. This also destroys the widget.
 
void setOrientation (Qt::Orientation orientation, bool recursive=false)
 Set the orientation of the list of widgets.
 
void setSeparatorsVisible (bool visible)
 Set the visibility of the separators.
 
void setWidgetsMargin (int margin)
 Set the margins of the widgets. This allows to indent the widgets with respect to the separators. The separators themselves are not changed.
 
void setWidgetVisible (const QString &id, bool visible)
 Set the visibility of the widget that has the given id. Use this function instead of the widget's one directly to get better visual results.
 
void setWidgetVisible (int index, bool visible)
 Set the visibility of the widget that is at the given position. Use this function instead of the widget's one directly to get better visual results.
 
int size () const
 Get the number of widgets in the list.
 
QWidget * takeWidget (const QString &id)
 Remove the widget that has the given id from the list. The widget is returned instead of being destroyed.
 
QWidget * takeWidget (int index)
 Remove the widget that is at the given position from the list. The widget is returned instead of being destroyed.
 
QWidget * widget (const QString &id) const
 Get the widget with the given id.
 
QWidget * widget (int index) const
 Get the widget that is at the given position.
 
template<typename T >
widgetAs (const QString &id) const
 Get the widget with the given id casted to some other class.
 
template<typename T >
widgetAs (int index) const
 Get the widget that is at the given position casted to some other class.
 
int widgetIndexFromId (const QString &id) const
 Get the index of the widget that has the given id.
 
 ~KisOptionCollectionWidget () override
 

Private Slots

void slotConfigChanged ()
 
void slotSelectionActionsPanelCheckboxToggled (bool value)
 

Private Attributes

QScopedPointer< Privatem_d
 

Detailed Description

Definition at line 17 of file kis_selection_options.h.

Member Enumeration Documentation

◆ ReferenceLayers

Enumerator
CurrentLayer 
AllLayers 
ColorLabeledLayers 

Definition at line 22 of file kis_selection_options.h.

Constructor & Destructor Documentation

◆ KisSelectionOptions()

KisSelectionOptions::KisSelectionOptions ( QWidget * parent = nullptr)

Definition at line 150 of file kis_selection_options.cc.

152 , m_d(new Private)
153{
154 m_d->q = this;
155 // Create widgets
156 m_d->optionButtonStripMode = new KisOptionButtonStrip;
157 m_d->optionButtonStripMode->addButton(
158 KisIconUtils::loadIcon("select-pixel"));
159 m_d->optionButtonStripMode->addButton(
160 KisIconUtils::loadIcon("select-shape"));
161 m_d->optionButtonStripMode->button(0)->setChecked(true);
162
163 m_d->optionButtonStripAction = new KisOptionButtonStrip;
164 m_d->optionButtonStripAction->addButton(
165 KisIconUtils::loadIcon("selection_replace"));
166 m_d->optionButtonStripAction->addButton(
167 KisIconUtils::loadIcon("selection_intersect"));
168 m_d->optionButtonStripAction->addButton(
169 KisIconUtils::loadIcon("selection_add"));
170 m_d->optionButtonStripAction->addButton(
171 KisIconUtils::loadIcon("selection_subtract"));
172 m_d->optionButtonStripAction->addButton(
173 KisIconUtils::loadIcon("selection_symmetric_difference"));
174 m_d->optionButtonStripAction->button(0)->setChecked(true);
175
176 m_d->checkBoxSelectionActionsPanel = new QCheckBox(i18n("Enable Selection Actions Bar"));
177 m_d->checkBoxSelectionActionsPanel->setToolTip(
178 i18n("When enabled, any selections will produce a small floating panel of useful selection-related actions."));
179
180 KisConfig cfg(true);
181
182 if (cfg.selectionActionBar()) {
183 m_d->checkBoxSelectionActionsPanel->setCheckState(Qt::CheckState::Checked);
184 } else {
185 m_d->checkBoxSelectionActionsPanel->setCheckState(Qt::CheckState::Unchecked);
186 }
187
188 m_d->checkBoxMoveSelectedContent = new QCheckBox(
189 i18nc("The move-selected-content checkbox in selection tool options",
190 "Move Selected Content"));
191
192 m_d->checkBoxAntiAliasSelection = new QCheckBox(
193 i18nc("The anti-alias checkbox in fill tool options", "Anti-aliasing"));
194 KisOptionCollectionWidget *containerGrowSelection = new KisOptionCollectionWidget;
195 m_d->sliderGrowSelection = new KisSliderSpinBox;
196 m_d->sliderGrowSelection->setPrefix(
197 i18nc("The 'grow/shrink' spinbox prefix in selection tools options",
198 "Grow: "));
199 m_d->sliderGrowSelection->setRange(-400, 400);
200 m_d->sliderGrowSelection->setSoftRange(-40, 40);
201 m_d->sliderGrowSelection->setSuffix(i18n(" px"));
202 m_d->buttonStopGrowingAtDarkestPixel = new QToolButton;
203 m_d->buttonStopGrowingAtDarkestPixel->setAutoRaise(true);
204 m_d->buttonStopGrowingAtDarkestPixel->setCheckable(true);
205 m_d->buttonStopGrowingAtDarkestPixel->setIcon(KisIconUtils::loadIcon("stop-at-boundary"));
206 containerGrowSelection->appendWidget("sliderGrowSelection", m_d->sliderGrowSelection);
207 containerGrowSelection->appendWidget("buttonStopGrowingAtDarkestPixel", m_d->buttonStopGrowingAtDarkestPixel);
208 containerGrowSelection->setOrientation(Qt::Horizontal);
209 containerGrowSelection->setWidgetVisible("buttonStopGrowingAtDarkestPixel", false);
210 m_d->sliderFeatherSelection = new KisSliderSpinBox;
211 m_d->sliderFeatherSelection->setPrefix(
212 i18nc("The 'feather' spinbox prefix in selection tools options",
213 "Feather: "));
214 m_d->sliderFeatherSelection->setRange(0, 400);
215 m_d->sliderFeatherSelection->setSoftRange(0, 40);
216 m_d->sliderFeatherSelection->setSuffix(i18n(" px"));
217
218 m_d->optionButtonStripReference = new KisOptionButtonStrip;
219 m_d->optionButtonStripReference->addButton(
220 KisIconUtils::loadIcon("current-layer"));
221 m_d->optionButtonStripReference->addButton(
222 KisIconUtils::loadIcon("all-layers"));
223 m_d->optionButtonStripReference->addButton(KisIconUtils::loadIcon("tag"));
224 m_d->optionButtonStripReference->button(0)->setChecked(true);
225 m_d->widgetLabels = new KisColorLabelSelectorWidget;
226 m_d->widgetLabels->setExclusive(false);
227 m_d->widgetLabels->setButtonSize(20);
228 m_d->widgetLabels->setButtonWrapEnabled(true);
229 m_d->widgetLabels->setMouseDragEnabled(true);
230
231 // Set the tooltips
232 m_d->optionButtonStripMode->button(0)->setToolTip(
233 i18nc("@info:tooltip", "Pixel Selection"));
234 m_d->optionButtonStripMode->button(1)->setToolTip(
235 i18nc("@info:tooltip", "Vector Selection"));
236
237 m_d->optionButtonStripAction->button(0)->setToolTip(
238 i18nc("@info:tooltip", "Replace"));
239 m_d->optionButtonStripAction->button(1)->setToolTip(
240 i18nc("@info:tooltip", "Intersect"));
241 m_d->optionButtonStripAction->button(2)->setToolTip(
242 i18nc("@info:tooltip", "Add"));
243 m_d->optionButtonStripAction->button(3)->setToolTip(
244 i18nc("@info:tooltip", "Subtract"));
245 m_d->optionButtonStripAction->button(4)->setToolTip(
246 i18nc("@info:tooltip", "Symmetric Difference"));
247
248 m_d->checkBoxMoveSelectedContent->setToolTip(
249 i18nc("@info:tooltip", "Move Selected Content"));
250
251 m_d->checkBoxAntiAliasSelection->setToolTip(
252 i18n("Smooths the edges of the selection"));
253 m_d->sliderGrowSelection->setToolTip(
254 i18n("Grow or shrink the selection by the set amount"));
255 m_d->buttonStopGrowingAtDarkestPixel->setToolTip(
256 i18n("Stop growing at the darkest and/or most opaque pixels"));
257 m_d->sliderFeatherSelection->setToolTip(
258 i18n("Blur the selection by the set amount"));
259
260 m_d->optionButtonStripReference->button(0)->setToolTip(
261 i18n("Select regions found from the active layer"));
262 m_d->optionButtonStripReference->button(1)->setToolTip(
263 i18n("Select regions found from the merging of all layers"));
264 m_d->optionButtonStripReference->button(2)->setToolTip(
265 i18n("Select regions found from the merging of layers with specific color labels"));
266
267 // Construct the option widget
269
272 i18nc("The 'mode' section label in selection tools options",
273 "Mode"));
274 sectionMode->setPrimaryWidget(m_d->optionButtonStripMode);
275 appendWidget("sectionMode", sectionMode);
276
279 i18nc("The 'action' section label in selection tools options",
280 "Action"));
281 sectionAction->setPrimaryWidget(m_d->optionButtonStripAction);
282 appendWidget("sectionAction", sectionAction);
283
284 KisOptionCollectionWidgetWithHeader *sectionReference =
286 i18nc("The 'reference' section label in selection tools options",
287 "Reference"));
288 sectionReference->setPrimaryWidget(m_d->optionButtonStripReference);
289 sectionReference->appendWidget("widgetLabels", m_d->widgetLabels);
290 sectionReference->setWidgetVisible("widgetLabels", false);
291 appendWidget("sectionReference", sectionReference);
292
293
294 appendWidget("checkBoxMoveSelectedContent", m_d->checkBoxMoveSelectedContent);
295 appendWidget("sapCheckBox", m_d->checkBoxSelectionActionsPanel);
296
297 KisOptionCollectionWidgetWithHeader *sectionAdjustments =
299 i18nc("The 'adjustments' section label in selection tools options",
300 "Adjustments"));
301 sectionAdjustments->appendWidget("checkBoxAntiAliasSelection",
302 m_d->checkBoxAntiAliasSelection);
303 sectionAdjustments->appendWidget("containerGrowSelection", containerGrowSelection);
304 sectionAdjustments->appendWidget("sliderFeather",
305 m_d->sliderFeatherSelection);
306 appendWidget("sectionAdjustments", sectionAdjustments);
307
308
309 // Make connections
310 connect(m_d->optionButtonStripMode,
311 QOverload<int, bool>::of(&KisOptionButtonStrip::buttonToggled),
312 [this](int i, int c) {
313 m_d->on_optionButtonStripMode_buttonToggled(i, c);
314 });
315 connect(m_d->optionButtonStripAction,
316 QOverload<int, bool>::of(&KisOptionButtonStrip::buttonToggled),
317 [this](int i, int c) {
318 m_d->on_optionButtonStripAction_buttonToggled(i, c);
319 });
320 connect(m_d->checkBoxMoveSelectedContent,
321 SIGNAL(toggled(bool)),
322 SIGNAL(moveSelectedContentChanged(bool)));
323 connect(m_d->checkBoxAntiAliasSelection,
324 SIGNAL(toggled(bool)),
325 SIGNAL(antiAliasSelectionChanged(bool)));
326 connect(m_d->sliderGrowSelection,
327 SIGNAL(valueChanged(int)),
328 SIGNAL(growSelectionChanged(int)));
329 connect(m_d->buttonStopGrowingAtDarkestPixel,
330 SIGNAL(toggled(bool)),
332 connect(m_d->sliderFeatherSelection,
333 SIGNAL(valueChanged(int)),
334 SIGNAL(featherSelectionChanged(int)));
335 connect(m_d->optionButtonStripReference,
336 QOverload<int, bool>::of(&KisOptionButtonStrip::buttonToggled),
337 [this](int i, int c) {
338 m_d->on_optionButtonStripReference_buttonToggled(i, c);
339 });
340 connect(m_d->widgetLabels,
341 SIGNAL(selectionChanged()),
343
344 connect(KisConfigNotifier::instance(), SIGNAL(configChanged()), SLOT(slotConfigChanged()));
345 connect(m_d->checkBoxSelectionActionsPanel,
346 SIGNAL(toggled(bool)),
348}
void setExclusive(bool exclusive)
Set if the button selection is mutually exclusive. This allows switching between single or multiple s...
static KisConfigNotifier * instance()
Provides a list of consecutive tool buttons.
void buttonToggled(KoGroupButton *button, bool checked)
KoGroupButton * addButton(const QIcon &icon, const QString &text=QString())
Wrapper class around a KisOptionCollectionWidget that also provide a header with a title label and an...
void setPrimaryWidget(QWidget *widget)
Set the primary widget. The list widget takes ownership of it.
void appendWidget(const QString &id, QWidget *widget)
Insert the given widget with the given id at the end of the list. The list widget takes ownership of ...
void setWidgetVisible(int index, bool visible)
Set the visibility of the widget that is at the given position.
Class providing a list of widgets with some addons such as separators, orientation or individual widg...
void setOrientation(Qt::Orientation orientation, bool recursive=false)
Set the orientation of the list of widgets.
KisOptionCollectionWidget(QWidget *parent=nullptr)
void setWidgetVisible(int index, bool visible)
Set the visibility of the widget that is at the given position. Use this function instead of the widg...
void appendWidget(const QString &id, QWidget *widget)
Insert the given widget with the given id at the end of the list. The list widget takes ownership of ...
void setSeparatorsVisible(bool visible)
Set the visibility of the separators.
void slotSelectionActionsPanelCheckboxToggled(bool value)
void antiAliasSelectionChanged(bool antiAliasSelection)
void featherSelectionChanged(int featherSelection)
void selectedColorLabelsChanged()
QScopedPointer< Private > m_d
void stopGrowingAtDarkestPixelChanged(bool stopGrowingAtDarkestPixel)
void growSelectionChanged(int growSelection)
void moveSelectedContentChanged(bool moveSelectedContent)
This class is a spinbox in which you can click and drag to set the value. A slider like bar is displa...
void setRange(int newMinimum, int newMaximum, bool computeNewFastSliderStep=true)
Set the minimum and the maximum values of the range, computing a new "fast slider step" based on the ...
QIcon loadIcon(const QString &name)

References KisOptionButtonStrip::addButton(), antiAliasSelectionChanged(), KisOptionCollectionWidget::appendWidget(), KisOptionCollectionWidgetWithHeader::appendWidget(), KisOptionButtonStrip::buttonToggled(), featherSelectionChanged(), growSelectionChanged(), KisConfigNotifier::instance(), KisOptionCollectionWidget::KisOptionCollectionWidget(), KisIconUtils::loadIcon(), m_d, moveSelectedContentChanged(), selectedColorLabelsChanged(), KisConfig::selectionActionBar(), KisColorLabelSelectorWidget::setExclusive(), KisOptionCollectionWidget::setOrientation(), KisOptionCollectionWidgetWithHeader::setPrimaryWidget(), KisSliderSpinBox::setRange(), KisOptionCollectionWidget::setSeparatorsVisible(), KisOptionCollectionWidget::setWidgetVisible(), KisOptionCollectionWidgetWithHeader::setWidgetVisible(), slotConfigChanged(), slotSelectionActionsPanelCheckboxToggled(), and stopGrowingAtDarkestPixelChanged().

◆ ~KisSelectionOptions()

KisSelectionOptions::~KisSelectionOptions ( )
override

Definition at line 350 of file kis_selection_options.cc.

351{
352}

Member Function Documentation

◆ action()

SelectionAction KisSelectionOptions::action ( ) const

Definition at line 360 of file kis_selection_options.cc.

361{
362 return m_d->buttonIndexToAction(
363 m_d->optionButtonStripAction->checkedButtonIndex());
364}

References m_d.

◆ actionChanged

void KisSelectionOptions::actionChanged ( SelectionAction action)
signal

◆ antiAliasSelection()

bool KisSelectionOptions::antiAliasSelection ( ) const

Definition at line 371 of file kis_selection_options.cc.

372{
373 return m_d->checkBoxAntiAliasSelection->isChecked();
374}

References m_d.

◆ antiAliasSelectionChanged

void KisSelectionOptions::antiAliasSelectionChanged ( bool antiAliasSelection)
signal

◆ featherSelection()

int KisSelectionOptions::featherSelection ( ) const

Definition at line 386 of file kis_selection_options.cc.

387{
388 return m_d->sliderFeatherSelection->value();
389}

References m_d.

◆ featherSelectionChanged

void KisSelectionOptions::featherSelectionChanged ( int featherSelection)
signal

◆ growSelection()

int KisSelectionOptions::growSelection ( ) const

Definition at line 376 of file kis_selection_options.cc.

377{
378 return m_d->sliderGrowSelection->value();
379}

References m_d.

◆ growSelectionChanged

void KisSelectionOptions::growSelectionChanged ( int growSelection)
signal

◆ mode()

SelectionMode KisSelectionOptions::mode ( ) const

Definition at line 354 of file kis_selection_options.cc.

355{
356 return m_d->buttonIndexToMode(
357 m_d->optionButtonStripMode->checkedButtonIndex());
358}

References m_d.

◆ modeChanged

void KisSelectionOptions::modeChanged ( SelectionMode mode)
signal

◆ moveSelectedContent()

bool KisSelectionOptions::moveSelectedContent ( ) const

Definition at line 366 of file kis_selection_options.cc.

367{
368 return m_d->checkBoxMoveSelectedContent->isChecked();
369}

References m_d.

◆ moveSelectedContentChanged

void KisSelectionOptions::moveSelectedContentChanged ( bool moveSelectedContent)
signal

◆ referenceLayers()

KisSelectionOptions::ReferenceLayers KisSelectionOptions::referenceLayers ( ) const

Definition at line 392 of file kis_selection_options.cc.

393{
394 return m_d->buttonIndexToReferenceLayers(
395 m_d->optionButtonStripReference->checkedButtonIndex());
396}

References m_d.

◆ referenceLayersChanged

void KisSelectionOptions::referenceLayersChanged ( ReferenceLayers referenceLayers)
signal

◆ selectedColorLabels()

QList< int > KisSelectionOptions::selectedColorLabels ( ) const

Definition at line 398 of file kis_selection_options.cc.

399{
400 return m_d->widgetLabels->selection();
401}

References m_d.

◆ selectedColorLabelsChanged

void KisSelectionOptions::selectedColorLabelsChanged ( )
signal

◆ setAction()

void KisSelectionOptions::setAction ( SelectionAction newAction)

Definition at line 412 of file kis_selection_options.cc.

413{
414 KoGroupButton *button = m_d->optionButtonStripAction->button(
415 m_d->actionToButtonIndex(newAction));
417
418 button->setChecked(true);
419}
#define KIS_SAFE_ASSERT_RECOVER_RETURN(cond)
Definition kis_assert.h:128
QString button(const QWheelEvent &ev)

References button(), KIS_SAFE_ASSERT_RECOVER_RETURN, and m_d.

◆ setActionSectionVisible()

void KisSelectionOptions::setActionSectionVisible ( bool visible)

Definition at line 466 of file kis_selection_options.cc.

467{
468 setWidgetVisible("sectionAction", visible);
469}

References KisOptionCollectionWidget::setWidgetVisible().

◆ setAdjustmentsSectionVisible()

void KisSelectionOptions::setAdjustmentsSectionVisible ( bool visible)

Definition at line 478 of file kis_selection_options.cc.

479{
480 setWidgetVisible("sectionAdjustments", visible);
481}

References KisOptionCollectionWidget::setWidgetVisible().

◆ setAntiAliasSelection()

void KisSelectionOptions::setAntiAliasSelection ( bool newAntiAliasSelection)

Definition at line 426 of file kis_selection_options.cc.

427{
428 m_d->checkBoxAntiAliasSelection->setChecked(newAntiAliasSelection);
429}

References m_d.

◆ setFeatherSelection()

void KisSelectionOptions::setFeatherSelection ( int newFeatherSelection)

Definition at line 441 of file kis_selection_options.cc.

442{
443 m_d->sliderFeatherSelection->setValue(newFeatherSelection);
444}

References m_d.

◆ setGrowSelection()

void KisSelectionOptions::setGrowSelection ( int newGrowSelection)

Definition at line 431 of file kis_selection_options.cc.

432{
433 m_d->sliderGrowSelection->setValue(newGrowSelection);
434}

References m_d.

◆ setMode()

void KisSelectionOptions::setMode ( SelectionMode newMode)

Definition at line 403 of file kis_selection_options.cc.

404{
406 m_d->optionButtonStripMode->button(m_d->modeToButtonIndex(newMode));
408
409 button->setChecked(true);
410}

References button(), KIS_SAFE_ASSERT_RECOVER_RETURN, and m_d.

◆ setModeSectionVisible()

void KisSelectionOptions::setModeSectionVisible ( bool visible)

Definition at line 461 of file kis_selection_options.cc.

462{
463 setWidgetVisible("sectionMode", visible);
464}

References KisOptionCollectionWidget::setWidgetVisible().

◆ setMoveSelectedContent()

void KisSelectionOptions::setMoveSelectedContent ( bool newMoveSelectedContent)

Definition at line 421 of file kis_selection_options.cc.

422{
423 m_d->checkBoxMoveSelectedContent->setChecked(newMoveSelectedContent);
424}

References m_d.

◆ setReferenceLayers()

void KisSelectionOptions::setReferenceLayers ( ReferenceLayers newReferenceLayers)

Definition at line 446 of file kis_selection_options.cc.

447{
448 KoGroupButton *button = m_d->optionButtonStripReference->button(
449 m_d->referenceLayersToButtonIndex(newReferenceLayers));
451
452 button->setChecked(true);
453}

References button(), KIS_SAFE_ASSERT_RECOVER_RETURN, and m_d.

◆ setReferenceSectionVisible()

void KisSelectionOptions::setReferenceSectionVisible ( bool visible)

Definition at line 483 of file kis_selection_options.cc.

484{
485 setWidgetVisible("sectionReference", visible);
486}

References KisOptionCollectionWidget::setWidgetVisible().

◆ setSelectedColorLabels()

void KisSelectionOptions::setSelectedColorLabels ( const QList< int > & newSelectedColorLabels)

Definition at line 455 of file kis_selection_options.cc.

457{
458 m_d->widgetLabels->setSelection(newSelectedColorLabels);
459}

References m_d.

◆ setStopGrowingAtDarkestPixel()

void KisSelectionOptions::setStopGrowingAtDarkestPixel ( bool newStopGrowingAtDarkestPixel)

Definition at line 436 of file kis_selection_options.cc.

437{
438 m_d->buttonStopGrowingAtDarkestPixel->setChecked(newStopGrowingAtDarkestPixel);
439}

References m_d.

◆ setStopGrowingAtDarkestPixelButtonVisible()

void KisSelectionOptions::setStopGrowingAtDarkestPixelButtonVisible ( bool visible)

Definition at line 471 of file kis_selection_options.cc.

472{
473 widgetAs<KisOptionCollectionWidgetWithHeader*>("sectionAdjustments")
474 ->widgetAs<KisOptionCollectionWidget*>("containerGrowSelection")
475 ->setWidgetVisible("buttonStopGrowingAtDarkestPixel", visible);
476}

References KisOptionCollectionWidget::setWidgetVisible().

◆ slotConfigChanged

void KisSelectionOptions::slotConfigChanged ( )
privateslot

Definition at line 530 of file kis_selection_options.cc.

531{
532 KisConfig cfg(true);
533
534 if (cfg.selectionActionBar()) {
535 m_d->checkBoxSelectionActionsPanel->setCheckState(Qt::Checked);
536 } else {
537 m_d->checkBoxSelectionActionsPanel->setCheckState(Qt::Unchecked);
538 }
539}

References m_d, and KisConfig::selectionActionBar().

◆ slotSelectionActionsPanelCheckboxToggled

void KisSelectionOptions::slotSelectionActionsPanelCheckboxToggled ( bool value)
privateslot

Definition at line 541 of file kis_selection_options.cc.

542{
543 KisConfig cfg(false);
544 cfg.setSelectionActionBar(value);
545
546 blockSignals(true);
548 blockSignals(false);
549}
float value(const T *src, size_t ch)

References KisConfigNotifier::instance(), KisConfigNotifier::notifyConfigChanged(), KisConfig::setSelectionActionBar(), and value().

◆ stopGrowingAtDarkestPixel()

bool KisSelectionOptions::stopGrowingAtDarkestPixel ( ) const

Definition at line 381 of file kis_selection_options.cc.

382{
383 return m_d->buttonStopGrowingAtDarkestPixel->isChecked();
384}

References m_d.

◆ stopGrowingAtDarkestPixelChanged

void KisSelectionOptions::stopGrowingAtDarkestPixelChanged ( bool stopGrowingAtDarkestPixel)
signal

◆ updateActionButtonToolTip()

void KisSelectionOptions::updateActionButtonToolTip ( SelectionAction action,
const QKeySequence & shortcut )

Definition at line 488 of file kis_selection_options.cc.

491{
492 const QString shortcutString = shortcut.toString(QKeySequence::NativeText);
493 QString toolTipText;
494 const int buttonIndex = m_d->actionToButtonIndex(action);
495
496 switch (action) {
499 toolTipText = shortcutString.isEmpty()
500 ? i18nc("@info:tooltip", "Replace")
501 : i18nc("@info:tooltip", "Replace (%1)", shortcutString);
502 break;
503 case SELECTION_ADD:
504 toolTipText = shortcutString.isEmpty()
505 ? i18nc("@info:tooltip", "Add")
506 : i18nc("@info:tooltip", "Add (%1)", shortcutString);
507 break;
509 toolTipText = shortcutString.isEmpty()
510 ? i18nc("@info:tooltip", "Subtract")
511 : i18nc("@info:tooltip", "Subtract (%1)", shortcutString);
512 break;
514 toolTipText = shortcutString.isEmpty()
515 ? i18nc("@info:tooltip", "Intersect")
516 : i18nc("@info:tooltip", "Intersect (%1)", shortcutString);
517 break;
519 toolTipText = shortcutString.isEmpty()
520 ? i18nc("@info:tooltip", "Symmetric Difference")
521 : i18nc("@info:tooltip",
522 "Symmetric Difference (%1)",
523 shortcutString);
524 break;
525 }
526
527 m_d->optionButtonStripAction->button(buttonIndex)->setToolTip(toolTipText);
528}
@ SELECTION_REPLACE
@ SELECTION_INTERSECT
@ SELECTION_SYMMETRICDIFFERENCE
@ SELECTION_DEFAULT
@ SELECTION_SUBTRACT
@ SELECTION_ADD
SelectionAction action() const

References action(), m_d, SELECTION_ADD, SELECTION_DEFAULT, SELECTION_INTERSECT, SELECTION_REPLACE, SELECTION_SUBTRACT, and SELECTION_SYMMETRICDIFFERENCE.

Member Data Documentation

◆ m_d

QScopedPointer<Private> KisSelectionOptions::m_d
private

Definition at line 73 of file kis_selection_options.h.


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