Commit 080e298f authored by Agata Cacko's avatar Agata Cacko

Fix Contiguous sel. tool no checkbox for AA

Before this commit there was an issue when other selection tools
had vector selections mode checked. In vector selections mode,
there is no anti-aliasing, so the checkbox is hidden. The problem is,
similar color selection tool and contiguous color selection tool are
pixel-only, so they don't care about vector selections mode being
checked.

Moreover similar color selection tool doesn't use AA checkbox.

This commit ensures that checkbox is visible always on contiguous
selection tool, never on similar color selection tool and only in pixel
selection mode in other tools.

BUG:408733
parent 716e6d3e
......@@ -137,6 +137,10 @@ public:
&m_widgetHelper, SLOT(slotIntersectModeRequested()));
updateActionShortcutToolTips();
if (isPixelOnly() && m_widgetHelper.optionWidget()) {
m_widgetHelper.optionWidget()->enablePixelOnlySelectionMode();
}
}
void deactivate()
......@@ -155,6 +159,9 @@ public:
this->connect(&m_widgetHelper, SIGNAL(selectionActionChanged(int)), this, SLOT(resetCursorStyle()));
updateActionShortcutToolTips();
if (isPixelOnly() && m_widgetHelper.optionWidget()) {
m_widgetHelper.optionWidget()->enablePixelOnlySelectionMode();
}
return m_widgetHelper.optionWidget();
}
......@@ -366,6 +373,10 @@ protected:
KisSelectionToolConfigWidgetHelper m_widgetHelper;
SelectionAction m_selectionActionAlternate;
virtual bool isPixelOnly() const {
return false;
}
private:
Qt::KeyboardModifiers keysAtStart;
......
......@@ -112,6 +112,12 @@ void KisSelectionOptions::setAntiAliasSelection(bool value)
m_page->chkAntiAliasing->setChecked(value);
}
void KisSelectionOptions::enablePixelOnlySelectionMode()
{
setMode(PIXEL_SELECTION);
disableSelectionModeOption();
}
void KisSelectionOptions::updateActionButtonToolTip(int action, const QKeySequence &shortcut)
{
const QString shortcutString = shortcut.toString(QKeySequence::NativeText);
......
......@@ -58,6 +58,7 @@ public:
void setAction(int);
void setMode(int);
void setAntiAliasSelection(bool value);
void enablePixelOnlySelectionMode();
void updateActionButtonToolTip(int action, const QKeySequence &shortcut);
......
......@@ -168,7 +168,6 @@ QWidget* KisToolSelectContiguous::createOptionWidget()
KisToolSelectBase::createOptionWidget();
KisSelectionOptions *selectionWidget = selectionOptionWidget();
selectionWidget->disableSelectionModeOption();
QVBoxLayout * l = dynamic_cast<QVBoxLayout*>(selectionWidget->layout());
Q_ASSERT(l);
......
......@@ -53,6 +53,8 @@ protected:
bool wantsAutoScroll() const override { return false; }
bool isPixelOnly() const override { return true; }
public Q_SLOTS:
void activate(ToolActivation toolActivation, const QSet<KoShape*> &shapes) override;
virtual void slotSetFuzziness(int);
......
......@@ -92,6 +92,11 @@ KisToolSelectSimilar::KisToolSelectSimilar(KoCanvasBase * canvas)
void KisToolSelectSimilar::activate(ToolActivation toolActivation, const QSet<KoShape*> &shapes)
{
KisToolSelect::activate(toolActivation, shapes);
if (selectionOptionWidget()) {
// similar color selection tool doesn't use antialiasing option for now
// hence explicit disabling it
selectionOptionWidget()->disableAntiAliasSelectionOption();
}
m_configGroup = KSharedConfig::openConfig()->group(toolId());
}
......@@ -153,8 +158,9 @@ QWidget* KisToolSelectSimilar::createOptionWidget()
{
KisToolSelectBase::createOptionWidget();
KisSelectionOptions *selectionWidget = selectionOptionWidget();
// similar color selection tool doesn't use antialiasing option for now
// hence explicit disabling it
selectionWidget->disableAntiAliasSelectionOption();
selectionWidget->disableSelectionModeOption();
QHBoxLayout* fl = new QHBoxLayout();
QLabel * lbl = new QLabel(i18n("Fuzziness: "), selectionWidget);
......
......@@ -45,6 +45,7 @@ public Q_SLOTS:
protected:
using KisToolSelectBase::m_widgetHelper;
bool isPixelOnly() const override { return true; }
private:
int m_fuzziness;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment