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 , CurrentGroup , 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 >
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 >
T widgetAs (const QString &id) const
 Get the widget with the given id casted to some other class.
 
template<typename T >
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< Private > m_d
 

Detailed Description

Definition at line 17 of file kis_selection_options.h.

Member Enumeration Documentation

◆ ReferenceLayers

Constructor & Destructor Documentation

◆ KisSelectionOptions()

KisSelectionOptions::KisSelectionOptions ( QWidget * parent = nullptr)

Definition at line 154 of file kis_selection_options.cc.

156 , m_d(new Private)
157{
158 m_d->q = this;
159 // Create widgets
160 m_d->optionButtonStripMode = new KisOptionButtonStrip;
161 m_d->optionButtonStripMode->addButton(
162 KisIconUtils::loadIcon("select-pixel"));
163 m_d->optionButtonStripMode->addButton(
164 KisIconUtils::loadIcon("select-shape"));
165 m_d->optionButtonStripMode->button(0)->setChecked(true);
166
167 m_d->optionButtonStripAction = new KisOptionButtonStrip;
168 m_d->optionButtonStripAction->addButton(
169 KisIconUtils::loadIcon("selection_replace"));
170 m_d->optionButtonStripAction->addButton(
171 KisIconUtils::loadIcon("selection_intersect"));
172 m_d->optionButtonStripAction->addButton(
173 KisIconUtils::loadIcon("selection_add"));
174 m_d->optionButtonStripAction->addButton(
175 KisIconUtils::loadIcon("selection_subtract"));
176 m_d->optionButtonStripAction->addButton(
177 KisIconUtils::loadIcon("selection_symmetric_difference"));
178 m_d->optionButtonStripAction->button(0)->setChecked(true);
179
180 m_d->checkBoxSelectionActionsPanel = new QCheckBox(i18n("Enable Selection Actions Bar"));
181 m_d->checkBoxSelectionActionsPanel->setToolTip(
182 i18n("When enabled, any selections will produce a small floating panel of useful selection-related actions."));
183
184 KisConfig cfg(true);
185
186 if (cfg.selectionActionBar()) {
187 m_d->checkBoxSelectionActionsPanel->setCheckState(Qt::CheckState::Checked);
188 } else {
189 m_d->checkBoxSelectionActionsPanel->setCheckState(Qt::CheckState::Unchecked);
190 }
191
192 m_d->checkBoxMoveSelectedContent = new QCheckBox(
193 i18nc("The move-selected-content checkbox in selection tool options",
194 "Move Selected Content"));
195
196 m_d->checkBoxAntiAliasSelection = new QCheckBox(
197 i18nc("The anti-alias checkbox in fill tool options", "Anti-aliasing"));
198 KisOptionCollectionWidget *containerGrowSelection = new KisOptionCollectionWidget;
199 m_d->sliderGrowSelection = new KisSliderSpinBox;
200 m_d->sliderGrowSelection->setPrefix(
201 i18nc("The 'grow/shrink' spinbox prefix in selection tools options",
202 "Grow: "));
203 m_d->sliderGrowSelection->setRange(-400, 400);
204 m_d->sliderGrowSelection->setSoftRange(-40, 40);
205 m_d->sliderGrowSelection->setSuffix(i18n(" px"));
206 m_d->buttonStopGrowingAtDarkestPixel = new QToolButton;
207 m_d->buttonStopGrowingAtDarkestPixel->setAutoRaise(true);
208 m_d->buttonStopGrowingAtDarkestPixel->setCheckable(true);
209 m_d->buttonStopGrowingAtDarkestPixel->setIcon(KisIconUtils::loadIcon("stop-at-boundary"));
210 containerGrowSelection->appendWidget("sliderGrowSelection", m_d->sliderGrowSelection);
211 containerGrowSelection->appendWidget("buttonStopGrowingAtDarkestPixel", m_d->buttonStopGrowingAtDarkestPixel);
212 containerGrowSelection->setOrientation(Qt::Horizontal);
213 containerGrowSelection->setWidgetVisible("buttonStopGrowingAtDarkestPixel", false);
214 m_d->sliderFeatherSelection = new KisSliderSpinBox;
215 m_d->sliderFeatherSelection->setPrefix(
216 i18nc("The 'feather' spinbox prefix in selection tools options",
217 "Feather: "));
218 m_d->sliderFeatherSelection->setRange(0, 400);
219 m_d->sliderFeatherSelection->setSoftRange(0, 40);
220 m_d->sliderFeatherSelection->setSuffix(i18n(" px"));
221
222 m_d->optionButtonStripReference = new KisOptionButtonStrip;
223 m_d->optionButtonStripReference->addButton(
224 KisIconUtils::loadIcon("current-layer"));
225 m_d->optionButtonStripReference->addButton(
226 KisIconUtils::loadIcon("current-group"));
227 m_d->optionButtonStripReference->addButton(
228 KisIconUtils::loadIcon("all-layers"));
229 m_d->optionButtonStripReference->addButton(KisIconUtils::loadIcon("tag"));
230 m_d->optionButtonStripReference->button(0)->setChecked(true);
231 m_d->widgetLabels = new KisColorLabelSelectorWidget;
232 m_d->widgetLabels->setExclusive(false);
233 m_d->widgetLabels->setButtonSize(20);
234 m_d->widgetLabels->setButtonWrapEnabled(true);
235 m_d->widgetLabels->setMouseDragEnabled(true);
236
237 // Set the tooltips
238 m_d->optionButtonStripMode->button(0)->setToolTip(
239 i18nc("@info:tooltip", "Pixel Selection"));
240 m_d->optionButtonStripMode->button(1)->setToolTip(
241 i18nc("@info:tooltip", "Vector Selection"));
242
243 m_d->optionButtonStripAction->button(0)->setToolTip(
244 i18nc("@info:tooltip", "Replace"));
245 m_d->optionButtonStripAction->button(1)->setToolTip(
246 i18nc("@info:tooltip", "Intersect"));
247 m_d->optionButtonStripAction->button(2)->setToolTip(
248 i18nc("@info:tooltip", "Add"));
249 m_d->optionButtonStripAction->button(3)->setToolTip(
250 i18nc("@info:tooltip", "Subtract"));
251 m_d->optionButtonStripAction->button(4)->setToolTip(
252 i18nc("@info:tooltip", "Symmetric Difference"));
253
254 m_d->checkBoxMoveSelectedContent->setToolTip(
255 i18nc("@info:tooltip", "Move Selected Content"));
256
257 m_d->checkBoxAntiAliasSelection->setToolTip(
258 i18n("Smooths the edges of the selection"));
259 m_d->sliderGrowSelection->setToolTip(
260 i18n("Grow or shrink the selection by the set amount"));
261 m_d->buttonStopGrowingAtDarkestPixel->setToolTip(
262 i18n("Stop growing at the darkest and/or most opaque pixels"));
263 m_d->sliderFeatherSelection->setToolTip(
264 i18n("Blur the selection by the set amount"));
265
266 m_d->optionButtonStripReference->button(0)->setToolTip(
267 i18n("Select regions found from the active layer"));
268 m_d->optionButtonStripReference->button(1)->setToolTip(
269 i18n("Select regions found from the active group"));
270 m_d->optionButtonStripReference->button(2)->setToolTip(
271 i18n("Select regions found from the merging of all layers"));
272 m_d->optionButtonStripReference->button(3)->setToolTip(
273 i18n("Select regions found from the merging of layers with specific color labels"));
274
275 // Construct the option widget
277
280 i18nc("The 'mode' section label in selection tools options",
281 "Mode"));
282 sectionMode->setPrimaryWidget(m_d->optionButtonStripMode);
283 appendWidget("sectionMode", sectionMode);
284
287 i18nc("The 'action' section label in selection tools options",
288 "Action"));
289 sectionAction->setPrimaryWidget(m_d->optionButtonStripAction);
290 appendWidget("sectionAction", sectionAction);
291
292 KisOptionCollectionWidgetWithHeader *sectionReference =
294 i18nc("The 'reference' section label in selection tools options",
295 "Reference"));
296 sectionReference->setPrimaryWidget(m_d->optionButtonStripReference);
297 sectionReference->appendWidget("widgetLabels", m_d->widgetLabels);
298 sectionReference->setWidgetVisible("widgetLabels", false);
299 appendWidget("sectionReference", sectionReference);
300
301 appendWidget("sapCheckBox", m_d->checkBoxSelectionActionsPanel);
302
303 appendWidget("checkBoxMoveSelectedContent", m_d->checkBoxMoveSelectedContent);
304
305 KisOptionCollectionWidgetWithHeader *sectionAdjustments =
307 i18nc("The 'adjustments' section label in selection tools options",
308 "Adjustments"));
309 sectionAdjustments->appendWidget("checkBoxAntiAliasSelection",
310 m_d->checkBoxAntiAliasSelection);
311 sectionAdjustments->appendWidget("containerGrowSelection", containerGrowSelection);
312 sectionAdjustments->appendWidget("sliderFeather",
313 m_d->sliderFeatherSelection);
314 appendWidget("sectionAdjustments", sectionAdjustments);
315
316
317 // Make connections
318 connect(m_d->optionButtonStripMode,
319 QOverload<int, bool>::of(&KisOptionButtonStrip::buttonToggled),
320 this,
321 [this](int i, int c) {
322 m_d->on_optionButtonStripMode_buttonToggled(i, c);
323 });
324 connect(m_d->optionButtonStripAction,
325 QOverload<int, bool>::of(&KisOptionButtonStrip::buttonToggled),
326 this,
327 [this](int i, int c) {
328 m_d->on_optionButtonStripAction_buttonToggled(i, c);
329 });
330 connect(m_d->checkBoxMoveSelectedContent,
331 SIGNAL(toggled(bool)),
332 SIGNAL(moveSelectedContentChanged(bool)));
333 connect(m_d->checkBoxAntiAliasSelection,
334 SIGNAL(toggled(bool)),
335 SIGNAL(antiAliasSelectionChanged(bool)));
336 connect(m_d->sliderGrowSelection,
337 SIGNAL(valueChanged(int)),
338 SIGNAL(growSelectionChanged(int)));
339 connect(m_d->buttonStopGrowingAtDarkestPixel,
340 SIGNAL(toggled(bool)),
342 connect(m_d->sliderFeatherSelection,
343 SIGNAL(valueChanged(int)),
344 SIGNAL(featherSelectionChanged(int)));
345 connect(m_d->optionButtonStripReference,
346 QOverload<int, bool>::of(&KisOptionButtonStrip::buttonToggled),
347 this,
348 [this](int i, int c) {
349 m_d->on_optionButtonStripReference_buttonToggled(i, c);
350 });
351 connect(m_d->widgetLabels,
352 SIGNAL(selectionChanged()),
354
355 connect(KisConfigNotifier::instance(), SIGNAL(configChanged()), SLOT(slotConfigChanged()));
356 connect(m_d->checkBoxSelectionActionsPanel,
357 SIGNAL(toggled(bool)),
359}
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 361 of file kis_selection_options.cc.

362{
363}

Member Function Documentation

◆ action()

SelectionAction KisSelectionOptions::action ( ) const

Definition at line 371 of file kis_selection_options.cc.

372{
373 return m_d->buttonIndexToAction(
374 m_d->optionButtonStripAction->checkedButtonIndex());
375}

References m_d.

◆ actionChanged

void KisSelectionOptions::actionChanged ( SelectionAction action)
signal

◆ antiAliasSelection()

bool KisSelectionOptions::antiAliasSelection ( ) const

Definition at line 382 of file kis_selection_options.cc.

383{
384 return m_d->checkBoxAntiAliasSelection->isChecked();
385}

References m_d.

◆ antiAliasSelectionChanged

void KisSelectionOptions::antiAliasSelectionChanged ( bool antiAliasSelection)
signal

◆ featherSelection()

int KisSelectionOptions::featherSelection ( ) const

Definition at line 397 of file kis_selection_options.cc.

398{
399 return m_d->sliderFeatherSelection->value();
400}

References m_d.

◆ featherSelectionChanged

void KisSelectionOptions::featherSelectionChanged ( int featherSelection)
signal

◆ growSelection()

int KisSelectionOptions::growSelection ( ) const

Definition at line 387 of file kis_selection_options.cc.

388{
389 return m_d->sliderGrowSelection->value();
390}

References m_d.

◆ growSelectionChanged

void KisSelectionOptions::growSelectionChanged ( int growSelection)
signal

◆ mode()

SelectionMode KisSelectionOptions::mode ( ) const

Definition at line 365 of file kis_selection_options.cc.

366{
367 return m_d->buttonIndexToMode(
368 m_d->optionButtonStripMode->checkedButtonIndex());
369}

References m_d.

◆ modeChanged

void KisSelectionOptions::modeChanged ( SelectionMode mode)
signal

◆ moveSelectedContent()

bool KisSelectionOptions::moveSelectedContent ( ) const

Definition at line 377 of file kis_selection_options.cc.

378{
379 return m_d->checkBoxMoveSelectedContent->isChecked();
380}

References m_d.

◆ moveSelectedContentChanged

void KisSelectionOptions::moveSelectedContentChanged ( bool moveSelectedContent)
signal

◆ referenceLayers()

KisSelectionOptions::ReferenceLayers KisSelectionOptions::referenceLayers ( ) const

Definition at line 403 of file kis_selection_options.cc.

404{
405 return m_d->buttonIndexToReferenceLayers(
406 m_d->optionButtonStripReference->checkedButtonIndex());
407}

References m_d.

◆ referenceLayersChanged

void KisSelectionOptions::referenceLayersChanged ( ReferenceLayers referenceLayers)
signal

◆ selectedColorLabels()

QList< int > KisSelectionOptions::selectedColorLabels ( ) const

Definition at line 409 of file kis_selection_options.cc.

410{
411 return m_d->widgetLabels->selection();
412}

References m_d.

◆ selectedColorLabelsChanged

void KisSelectionOptions::selectedColorLabelsChanged ( )
signal

◆ setAction()

void KisSelectionOptions::setAction ( SelectionAction newAction)

Definition at line 423 of file kis_selection_options.cc.

424{
425 KoGroupButton *button = m_d->optionButtonStripAction->button(
426 m_d->actionToButtonIndex(newAction));
428
429 button->setChecked(true);
430}
#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 477 of file kis_selection_options.cc.

478{
479 setWidgetVisible("sectionAction", visible);
480}

References KisOptionCollectionWidget::setWidgetVisible().

◆ setAdjustmentsSectionVisible()

void KisSelectionOptions::setAdjustmentsSectionVisible ( bool visible)

Definition at line 489 of file kis_selection_options.cc.

490{
491 setWidgetVisible("sectionAdjustments", visible);
492}

References KisOptionCollectionWidget::setWidgetVisible().

◆ setAntiAliasSelection()

void KisSelectionOptions::setAntiAliasSelection ( bool newAntiAliasSelection)

Definition at line 437 of file kis_selection_options.cc.

438{
439 m_d->checkBoxAntiAliasSelection->setChecked(newAntiAliasSelection);
440}

References m_d.

◆ setFeatherSelection()

void KisSelectionOptions::setFeatherSelection ( int newFeatherSelection)

Definition at line 452 of file kis_selection_options.cc.

453{
454 m_d->sliderFeatherSelection->setValue(newFeatherSelection);
455}

References m_d.

◆ setGrowSelection()

void KisSelectionOptions::setGrowSelection ( int newGrowSelection)

Definition at line 442 of file kis_selection_options.cc.

443{
444 m_d->sliderGrowSelection->setValue(newGrowSelection);
445}

References m_d.

◆ setMode()

void KisSelectionOptions::setMode ( SelectionMode newMode)

Definition at line 414 of file kis_selection_options.cc.

415{
417 m_d->optionButtonStripMode->button(m_d->modeToButtonIndex(newMode));
419
420 button->setChecked(true);
421}

References button(), KIS_SAFE_ASSERT_RECOVER_RETURN, and m_d.

◆ setModeSectionVisible()

void KisSelectionOptions::setModeSectionVisible ( bool visible)

Definition at line 472 of file kis_selection_options.cc.

473{
474 setWidgetVisible("sectionMode", visible);
475}

References KisOptionCollectionWidget::setWidgetVisible().

◆ setMoveSelectedContent()

void KisSelectionOptions::setMoveSelectedContent ( bool newMoveSelectedContent)

Definition at line 432 of file kis_selection_options.cc.

433{
434 m_d->checkBoxMoveSelectedContent->setChecked(newMoveSelectedContent);
435}

References m_d.

◆ setReferenceLayers()

void KisSelectionOptions::setReferenceLayers ( ReferenceLayers newReferenceLayers)

Definition at line 457 of file kis_selection_options.cc.

458{
459 KoGroupButton *button = m_d->optionButtonStripReference->button(
460 m_d->referenceLayersToButtonIndex(newReferenceLayers));
462
463 button->setChecked(true);
464}

References button(), KIS_SAFE_ASSERT_RECOVER_RETURN, and m_d.

◆ setReferenceSectionVisible()

void KisSelectionOptions::setReferenceSectionVisible ( bool visible)

Definition at line 494 of file kis_selection_options.cc.

495{
496 setWidgetVisible("sectionReference", visible);
497}

References KisOptionCollectionWidget::setWidgetVisible().

◆ setSelectedColorLabels()

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

Definition at line 466 of file kis_selection_options.cc.

468{
469 m_d->widgetLabels->setSelection(newSelectedColorLabels);
470}

References m_d.

◆ setStopGrowingAtDarkestPixel()

void KisSelectionOptions::setStopGrowingAtDarkestPixel ( bool newStopGrowingAtDarkestPixel)

Definition at line 447 of file kis_selection_options.cc.

448{
449 m_d->buttonStopGrowingAtDarkestPixel->setChecked(newStopGrowingAtDarkestPixel);
450}

References m_d.

◆ setStopGrowingAtDarkestPixelButtonVisible()

void KisSelectionOptions::setStopGrowingAtDarkestPixelButtonVisible ( bool visible)

Definition at line 482 of file kis_selection_options.cc.

483{
484 widgetAs<KisOptionCollectionWidgetWithHeader*>("sectionAdjustments")
485 ->widgetAs<KisOptionCollectionWidget*>("containerGrowSelection")
486 ->setWidgetVisible("buttonStopGrowingAtDarkestPixel", visible);
487}

References KisOptionCollectionWidget::setWidgetVisible().

◆ slotConfigChanged

void KisSelectionOptions::slotConfigChanged ( )
privateslot

Definition at line 541 of file kis_selection_options.cc.

542{
543 KisConfig cfg(true);
544
545 if (cfg.selectionActionBar()) {
546 m_d->checkBoxSelectionActionsPanel->setCheckState(Qt::Checked);
547 } else {
548 m_d->checkBoxSelectionActionsPanel->setCheckState(Qt::Unchecked);
549 }
550}

References m_d, and KisConfig::selectionActionBar().

◆ slotSelectionActionsPanelCheckboxToggled

void KisSelectionOptions::slotSelectionActionsPanelCheckboxToggled ( bool value)
privateslot

Definition at line 552 of file kis_selection_options.cc.

553{
554 KisConfig cfg(false);
555 cfg.setSelectionActionBar(value);
556
557 blockSignals(true);
559 blockSignals(false);
560}
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 392 of file kis_selection_options.cc.

393{
394 return m_d->buttonStopGrowingAtDarkestPixel->isChecked();
395}

References m_d.

◆ stopGrowingAtDarkestPixelChanged

void KisSelectionOptions::stopGrowingAtDarkestPixelChanged ( bool stopGrowingAtDarkestPixel)
signal

◆ updateActionButtonToolTip()

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

Definition at line 499 of file kis_selection_options.cc.

502{
503 const QString shortcutString = shortcut.toString(QKeySequence::NativeText);
504 QString toolTipText;
505 const int buttonIndex = m_d->actionToButtonIndex(action);
506
507 switch (action) {
510 toolTipText = shortcutString.isEmpty()
511 ? i18nc("@info:tooltip", "Replace")
512 : i18nc("@info:tooltip", "Replace (%1)", shortcutString);
513 break;
514 case SELECTION_ADD:
515 toolTipText = shortcutString.isEmpty()
516 ? i18nc("@info:tooltip", "Add")
517 : i18nc("@info:tooltip", "Add (%1)", shortcutString);
518 break;
520 toolTipText = shortcutString.isEmpty()
521 ? i18nc("@info:tooltip", "Subtract")
522 : i18nc("@info:tooltip", "Subtract (%1)", shortcutString);
523 break;
525 toolTipText = shortcutString.isEmpty()
526 ? i18nc("@info:tooltip", "Intersect")
527 : i18nc("@info:tooltip", "Intersect (%1)", shortcutString);
528 break;
530 toolTipText = shortcutString.isEmpty()
531 ? i18nc("@info:tooltip", "Symmetric Difference")
532 : i18nc("@info:tooltip",
533 "Symmetric Difference (%1)",
534 shortcutString);
535 break;
536 }
537
538 m_d->optionButtonStripAction->button(buttonIndex)->setToolTip(toolTipText);
539}
@ 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: