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 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
 
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 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 149 of file kis_selection_options.cc.

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

338{
339}

Member Function Documentation

◆ action()

SelectionAction KisSelectionOptions::action ( ) const

Definition at line 347 of file kis_selection_options.cc.

348{
349 return m_d->buttonIndexToAction(
350 m_d->optionButtonStripAction->checkedButtonIndex());
351}

References m_d.

◆ actionChanged

void KisSelectionOptions::actionChanged ( SelectionAction action)
signal

◆ antiAliasSelection()

bool KisSelectionOptions::antiAliasSelection ( ) const

Definition at line 353 of file kis_selection_options.cc.

354{
355 return m_d->checkBoxAntiAliasSelection->isChecked();
356}

References m_d.

◆ antiAliasSelectionChanged

void KisSelectionOptions::antiAliasSelectionChanged ( bool antiAliasSelection)
signal

◆ featherSelection()

int KisSelectionOptions::featherSelection ( ) const

Definition at line 368 of file kis_selection_options.cc.

369{
370 return m_d->sliderFeatherSelection->value();
371}

References m_d.

◆ featherSelectionChanged

void KisSelectionOptions::featherSelectionChanged ( int featherSelection)
signal

◆ growSelection()

int KisSelectionOptions::growSelection ( ) const

Definition at line 358 of file kis_selection_options.cc.

359{
360 return m_d->sliderGrowSelection->value();
361}

References m_d.

◆ growSelectionChanged

void KisSelectionOptions::growSelectionChanged ( int growSelection)
signal

◆ mode()

SelectionMode KisSelectionOptions::mode ( ) const

Definition at line 341 of file kis_selection_options.cc.

342{
343 return m_d->buttonIndexToMode(
344 m_d->optionButtonStripMode->checkedButtonIndex());
345}

References m_d.

◆ modeChanged

void KisSelectionOptions::modeChanged ( SelectionMode mode)
signal

◆ referenceLayers()

KisSelectionOptions::ReferenceLayers KisSelectionOptions::referenceLayers ( ) const

Definition at line 374 of file kis_selection_options.cc.

375{
376 return m_d->buttonIndexToReferenceLayers(
377 m_d->optionButtonStripReference->checkedButtonIndex());
378}

References m_d.

◆ referenceLayersChanged

void KisSelectionOptions::referenceLayersChanged ( ReferenceLayers referenceLayers)
signal

◆ selectedColorLabels()

QList< int > KisSelectionOptions::selectedColorLabels ( ) const

Definition at line 380 of file kis_selection_options.cc.

381{
382 return m_d->widgetLabels->selection();
383}

References m_d.

◆ selectedColorLabelsChanged

void KisSelectionOptions::selectedColorLabelsChanged ( )
signal

◆ setAction()

void KisSelectionOptions::setAction ( SelectionAction newAction)

Definition at line 394 of file kis_selection_options.cc.

395{
396 KoGroupButton *button = m_d->optionButtonStripAction->button(
397 m_d->actionToButtonIndex(newAction));
399
400 button->setChecked(true);
401}
#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 443 of file kis_selection_options.cc.

444{
445 setWidgetVisible("sectionAction", visible);
446}

References KisOptionCollectionWidget::setWidgetVisible().

◆ setAdjustmentsSectionVisible()

void KisSelectionOptions::setAdjustmentsSectionVisible ( bool visible)

Definition at line 455 of file kis_selection_options.cc.

456{
457 setWidgetVisible("sectionAdjustments", visible);
458}

References KisOptionCollectionWidget::setWidgetVisible().

◆ setAntiAliasSelection()

void KisSelectionOptions::setAntiAliasSelection ( bool newAntiAliasSelection)

Definition at line 403 of file kis_selection_options.cc.

404{
405 m_d->checkBoxAntiAliasSelection->setChecked(newAntiAliasSelection);
406}

References m_d.

◆ setFeatherSelection()

void KisSelectionOptions::setFeatherSelection ( int newFeatherSelection)

Definition at line 418 of file kis_selection_options.cc.

419{
420 m_d->sliderFeatherSelection->setValue(newFeatherSelection);
421}

References m_d.

◆ setGrowSelection()

void KisSelectionOptions::setGrowSelection ( int newGrowSelection)

Definition at line 408 of file kis_selection_options.cc.

409{
410 m_d->sliderGrowSelection->setValue(newGrowSelection);
411}

References m_d.

◆ setMode()

void KisSelectionOptions::setMode ( SelectionMode newMode)

Definition at line 385 of file kis_selection_options.cc.

386{
388 m_d->optionButtonStripMode->button(m_d->modeToButtonIndex(newMode));
390
391 button->setChecked(true);
392}

References button(), KIS_SAFE_ASSERT_RECOVER_RETURN, and m_d.

◆ setModeSectionVisible()

void KisSelectionOptions::setModeSectionVisible ( bool visible)

Definition at line 438 of file kis_selection_options.cc.

439{
440 setWidgetVisible("sectionMode", visible);
441}

References KisOptionCollectionWidget::setWidgetVisible().

◆ setReferenceLayers()

void KisSelectionOptions::setReferenceLayers ( ReferenceLayers newReferenceLayers)

Definition at line 423 of file kis_selection_options.cc.

424{
425 KoGroupButton *button = m_d->optionButtonStripReference->button(
426 m_d->referenceLayersToButtonIndex(newReferenceLayers));
428
429 button->setChecked(true);
430}

References button(), KIS_SAFE_ASSERT_RECOVER_RETURN, and m_d.

◆ setReferenceSectionVisible()

void KisSelectionOptions::setReferenceSectionVisible ( bool visible)

Definition at line 460 of file kis_selection_options.cc.

461{
462 setWidgetVisible("sectionReference", visible);
463}

References KisOptionCollectionWidget::setWidgetVisible().

◆ setSelectedColorLabels()

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

Definition at line 432 of file kis_selection_options.cc.

434{
435 m_d->widgetLabels->setSelection(newSelectedColorLabels);
436}

References m_d.

◆ setStopGrowingAtDarkestPixel()

void KisSelectionOptions::setStopGrowingAtDarkestPixel ( bool newStopGrowingAtDarkestPixel)

Definition at line 413 of file kis_selection_options.cc.

414{
415 m_d->buttonStopGrowingAtDarkestPixel->setChecked(newStopGrowingAtDarkestPixel);
416}

References m_d.

◆ setStopGrowingAtDarkestPixelButtonVisible()

void KisSelectionOptions::setStopGrowingAtDarkestPixelButtonVisible ( bool visible)

Definition at line 448 of file kis_selection_options.cc.

449{
450 widgetAs<KisOptionCollectionWidgetWithHeader*>("sectionAdjustments")
451 ->widgetAs<KisOptionCollectionWidget*>("containerGrowSelection")
452 ->setWidgetVisible("buttonStopGrowingAtDarkestPixel", visible);
453}

References KisOptionCollectionWidget::setWidgetVisible().

◆ slotConfigChanged

void KisSelectionOptions::slotConfigChanged ( )
privateslot

Definition at line 507 of file kis_selection_options.cc.

508{
509 KisConfig cfg(true);
510
511 if (cfg.selectionActionBar()) {
512 m_d->checkBoxSelectionActionsPanel->setCheckState(Qt::Checked);
513 } else {
514 m_d->checkBoxSelectionActionsPanel->setCheckState(Qt::Unchecked);
515 }
516}

References m_d, and KisConfig::selectionActionBar().

◆ slotSelectionActionsPanelCheckboxToggled

void KisSelectionOptions::slotSelectionActionsPanelCheckboxToggled ( bool value)
privateslot

Definition at line 518 of file kis_selection_options.cc.

519{
520 KisConfig cfg(false);
521 cfg.setSelectionActionBar(value);
522
523 blockSignals(true);
525 blockSignals(false);
526}
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 363 of file kis_selection_options.cc.

364{
365 return m_d->buttonStopGrowingAtDarkestPixel->isChecked();
366}

References m_d.

◆ stopGrowingAtDarkestPixelChanged

void KisSelectionOptions::stopGrowingAtDarkestPixelChanged ( bool stopGrowingAtDarkestPixel)
signal

◆ updateActionButtonToolTip()

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

Definition at line 465 of file kis_selection_options.cc.

468{
469 const QString shortcutString = shortcut.toString(QKeySequence::NativeText);
470 QString toolTipText;
471 const int buttonIndex = m_d->actionToButtonIndex(action);
472
473 switch (action) {
476 toolTipText = shortcutString.isEmpty()
477 ? i18nc("@info:tooltip", "Replace")
478 : i18nc("@info:tooltip", "Replace (%1)", shortcutString);
479 break;
480 case SELECTION_ADD:
481 toolTipText = shortcutString.isEmpty()
482 ? i18nc("@info:tooltip", "Add")
483 : i18nc("@info:tooltip", "Add (%1)", shortcutString);
484 break;
486 toolTipText = shortcutString.isEmpty()
487 ? i18nc("@info:tooltip", "Subtract")
488 : i18nc("@info:tooltip", "Subtract (%1)", shortcutString);
489 break;
491 toolTipText = shortcutString.isEmpty()
492 ? i18nc("@info:tooltip", "Intersect")
493 : i18nc("@info:tooltip", "Intersect (%1)", shortcutString);
494 break;
496 toolTipText = shortcutString.isEmpty()
497 ? i18nc("@info:tooltip", "Symmetric Difference")
498 : i18nc("@info:tooltip",
499 "Symmetric Difference (%1)",
500 shortcutString);
501 break;
502 }
503
504 m_d->optionButtonStripAction->button(buttonIndex)->setToolTip(toolTipText);
505}
@ 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 70 of file kis_selection_options.h.


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