Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.
C++
Wrapped all docker tool option check-boxes within a single widget which can be toggled for visibility. Also implimented a QToolButton to control the toggle
Aries Moczar3e8c536cf300
diff --git a/plugins/assistants/Assistants/AssistantsToolOptions.ui b/plugins/assistants/Assistants/AssistantsToolOptions.uiindex d85e028028..3d81017bcf 100644--- a/plugins/assistants/Assistants/AssistantsToolOptions.ui+++ b/plugins/assistants/Assistants/AssistantsToolOptions.ui@@ -210,106 +210,6 @@</property></widget></item>- <item>- <widget class="Line" name="editor_widget_control_line">- <property name="orientation">- <enum>Qt::Horizontal</enum>- </property>- </widget>- </item>- <item>- <widget class="QLabel" name="editorWidgetText">- <property name="sizePolicy">- <sizepolicy hsizetype="Fixed" vsizetype="Preferred">- <horstretch>0</horstretch>- <verstretch>0</verstretch>- </sizepolicy>- </property>- <property name="text">- <string>Editor Widget Control:</string>- </property>- </widget>- </item>- <item>- <widget class="QCheckBox" name="showMove">- <property name="enabled">- <bool>true</bool>- </property>- <property name="sizePolicy">- <sizepolicy hsizetype="Minimum" vsizetype="Fixed">- <horstretch>0</horstretch>- <verstretch>0</verstretch>- </sizepolicy>- </property>- <property name="text">- <string>Show Move</string>- </property>- </widget>- </item>- <item>- <widget class="QCheckBox" name="showSnap">- <property name="enabled">- <bool>true</bool>- </property>- <property name="sizePolicy">- <sizepolicy hsizetype="Minimum" vsizetype="Fixed">- <horstretch>0</horstretch>- <verstretch>0</verstretch>- </sizepolicy>- </property>- <property name="text">- <string>Show Snapping</string>- </property>- </widget>- </item>- <item>- <widget class="QCheckBox" name="showLock">- <property name="enabled">- <bool>true</bool>- </property>- <property name="sizePolicy">- <sizepolicy hsizetype="Minimum" vsizetype="Fixed">- <horstretch>0</horstretch>- <verstretch>0</verstretch>- </sizepolicy>- </property>- <property name="text">- <string>Show Lock</string>- </property>- </widget>- </item>- <item>- <widget class="QCheckBox" name="showDuplicate">- <property name="enabled">- <bool>true</bool>- </property>- <property name="sizePolicy">- <sizepolicy hsizetype="Minimum" vsizetype="Fixed">- <horstretch>0</horstretch>- <verstretch>0</verstretch>- </sizepolicy>- </property>- <property name="text">- <string>Show Duplicate</string>- </property>- </widget>- </item>- <item>- <widget class="QCheckBox" name="showDelete">- <property name="enabled">- <bool>true</bool>- </property>- <property name="sizePolicy">- <sizepolicy hsizetype="Minimum" vsizetype="Fixed">- <horstretch>0</horstretch>- <verstretch>0</verstretch>- </sizepolicy>- </property>- <property name="text">- <string>Show Delete</string>- </property>- </widget>- </item><item><layout class="QHBoxLayout" name="horizontalLayout_4"><item>@@ -343,6 +243,142 @@</item></layout></item>+ <item>+ <widget class="Line" name="dockerOptionsLine">+ <property name="orientation">+ <enum>Qt::Horizontal</enum>+ </property>+ </widget>+ </item>+ <item>+ <layout class="QHBoxLayout" name="ShowDockerOptionsLayout">+ <item>+ <widget class="QToolButton" name="ShowDockerOptionsButton">+ <property name="iconSize">+ <size>+ <width>18</width>+ <height>18</height>+ </size>+ </property>+ </widget>+ </item>+ <item>+ <widget class="QLabel" name="ShowDockerOptionsLabel">+ <property name="sizePolicy">+ <sizepolicy hsizetype="Fixed" vsizetype="Preferred">+ <horstretch>0</horstretch>+ <verstretch>0</verstretch>+ </sizepolicy>+ </property>+ <property name="text">+ <string>Show Docker Tool Options</string>+ </property>+ </widget>+ </item>+ </layout>+ </item>+ <item>+ <widget class=" QWidget" name="ShowDockerOptionsContainer">+ <property name="visible">+ <bool>false</bool>+ </property>+ <layout class="QVBoxLayout" name="verticalLayout">+ <item>+ <widget class="QLabel" name="editorWidgetText">+ <property name="sizePolicy">+ <sizepolicy hsizetype="Fixed" vsizetype="Preferred">+ <horstretch>0</horstretch>+ <verstretch>0</verstretch>+ </sizepolicy>+ </property>+ <property name="text">+ <string>Editor Widget Control:</string>+ </property>+ </widget>+ </item>+ <item>+ <widget class="QCheckBox" name="showMove">+ <property name="enabled">+ <bool>true</bool>+ </property>+ <property name="sizePolicy">+ <sizepolicy hsizetype="Minimum" vsizetype="Fixed">+ <horstretch>0</horstretch>+ <verstretch>0</verstretch>+ </sizepolicy>+ </property>+ <property name="text">+ <string>Show Move</string>+ </property>+ </widget>+ </item>+ <item>+ <widget class="QCheckBox" name="showSnap">+ <property name="enabled">+ <bool>true</bool>+ </property>+ <property name="sizePolicy">+ <sizepolicy hsizetype="Minimum" vsizetype="Fixed">+ <horstretch>0</horstretch>+ <verstretch>0</verstretch>+ </sizepolicy>+ </property>+ <property name="text">+ <string>Show Snapping</string>+ </property>+ </widget>+ </item>+ <item>+ <widget class="QCheckBox" name="showLock">+ <property name="enabled">+ <bool>true</bool>+ </property>+ <property name="sizePolicy">+ <sizepolicy hsizetype="Minimum" vsizetype="Fixed">+ <horstretch>0</horstretch>+ <verstretch>0</verstretch>+ </sizepolicy>+ </property>+ <property name="text">+ <string>Show Lock</string>+ </property>+ </widget>+ </item>+ <item>+ <widget class="QCheckBox" name="showDuplicate">+ <property name="enabled">+ <bool>true</bool>+ </property>+ <property name="sizePolicy">+ <sizepolicy hsizetype="Minimum" vsizetype="Fixed">+ <horstretch>0</horstretch>+ <verstretch>0</verstretch>+ </sizepolicy>+ </property>+ <property name="text">+ <string>Show Duplicate</string>+ </property>+ </widget>+ </item>+ <item>+ <widget class="QCheckBox" name="showDelete">+ <property name="enabled">+ <bool>true</bool>+ </property>+ <property name="sizePolicy">+ <sizepolicy hsizetype="Minimum" vsizetype="Fixed">+ <horstretch>0</horstretch>+ <verstretch>0</verstretch>+ </sizepolicy>+ </property>+ <property name="text">+ <string>Show Delete</string>+ </property>+ </widget>+ </item>+ </layout>+ </widget>+ </item><item><layout class="QHBoxLayout" name="horizontalLayout_5"/></item>@@ -420,7 +456,7 @@</spacer></item><item>- <widget class="QPushButton" name="deleteAllAssistantsButton">+ <widget class="QToolButton" name="deleteAllAssistantsButton"><property name="text"><string>All</string></property>@@ -429,10 +465,7 @@<width>18</width><height>18</height></size>- </property>- <property name="flat">- <bool>false</bool>- </property>+ </property></widget></item></layout>diff --git a/plugins/assistants/Assistants/kis_assistant_tool.cc b/plugins/assistants/Assistants/kis_assistant_tool.ccindex 01a0fc73fa..19ca1e49ca 100644--- a/plugins/assistants/Assistants/kis_assistant_tool.cc+++ b/plugins/assistants/Assistants/kis_assistant_tool.cc@@ -7,6 +7,7 @@* SPDX-License-Identifier: LGPL-2.0-or-later*/+#include <cstdio>#include <kis_assistant_tool.h>#include <kis_debug.h>@@ -46,6 +47,7 @@#include "VanishingPointAssistant.h"#include <math.h>+#include <queue>KisAssistantTool::KisAssistantTool(KoCanvasBase * canvas): KisTool(canvas, KisCursor::arrowCursor())@@ -1035,7 +1037,7 @@ void KisAssistantTool::updateToolOptionsUI()bool showCustomColorSettings = m_options.useCustomAssistantColor->isChecked() && hasActiveAssistant;m_options.customColorOpacitySlider->setVisible(showCustomColorSettings);m_options.customAssistantColorButton->setVisible(showCustomColorSettings);-+// disable global color settings if we are using the custom colorm_options.assistantsGlobalOpacitySlider->setEnabled(!showCustomColorSettings);m_options.assistantsColor->setEnabled(!showCustomColorSettings);@@ -1653,6 +1655,9 @@ QWidget *KisAssistantTool::createOptionWidget()m_options.deleteAllAssistantsButton->setIcon(KisIconUtils::loadIcon("edit-delete"));m_options.deleteAllAssistantsButton->setIconSize(QSize(16, 16));+ m_options.ShowDockerOptionsButton->setIcon(KisIconUtils::loadIcon("16_light_draw-arrow-forward.svg"));+ m_options.ShowDockerOptionsButton->setIconSize(QSize(16, 16));+QList<KoID> assistants;Q_FOREACH (const QString& key, KisPaintingAssistantFactoryRegistry::instance()->keys()) {QString name = KisPaintingAssistantFactoryRegistry::instance()->get(key)->name();@@ -1764,6 +1769,8 @@ QWidget *KisAssistantTool::createOptionWidget()connect(m_options.localAssistantCheckbox, SIGNAL(stateChanged(int)), SLOT(slotLocalAssistantCheckboxChanged()));+ //Show panel for docker tool option visibility+ connect(m_options.ShowDockerOptionsButton, SIGNAL(clicked()), this, SLOT(slotToggleDockToolOptionsVisible()));//set editor widget buttons on first startup.AssistantEditorData &globalEditorWidgetData = m_canvas->paintingAssistantsDecoration()->globalEditorWidgetData;@@ -1860,7 +1867,21 @@ void KisAssistantTool::slotSelectedAssistantTypeChanged(){updateToolOptionsUI();}+void KisAssistantTool::slotToggleDockToolOptionsVisible(){+ ToggleDockToolOptionsVisible = ToggleDockToolOptionsVisible ? false:true;+ m_options.ShowDockerOptionsContainer->setVisible(ToggleDockToolOptionsVisible);++ if (ToggleDockToolOptionsVisible){+ m_options.ShowDockerOptionsButton->setIcon(KisIconUtils::loadIcon("16_light_draw-arrow-down.svg"));+ }+ else{+ m_options.ShowDockerOptionsButton->setIcon(KisIconUtils::loadIcon("16_light_draw-arrow-forward.svg"));+ }++ m_options.ShowDockerOptionsButton->setIconSize(QSize(16, 16));++}void KisAssistantTool::slotToggleMoveButton(int index){AssistantEditorData &globalEditorWidgetData = m_canvas->paintingAssistantsDecoration()->globalEditorWidgetData;diff --git a/plugins/assistants/Assistants/kis_assistant_tool.h b/plugins/assistants/Assistants/kis_assistant_tool.hindex 14148cdf5c..8d7ac036d7 100644--- a/plugins/assistants/Assistants/kis_assistant_tool.h+++ b/plugins/assistants/Assistants/kis_assistant_tool.h@@ -85,6 +85,8 @@ private:// This uses m_handleDrag or m_newAssistant to figure out what handle to snap and wherebool snap(KoPointerEvent *event);+ //Recorded state for toggle panel for docker tool options visibility+ bool ToggleDockToolOptionsVisible = false;void beginActionImpl(KoPointerEvent *event);void continueActionImpl(KoPointerEvent *event);void endActionImpl(KoPointerEvent *event);@@ -121,6 +123,8 @@ private Q_SLOTS:void slotSelectedAssistantTypeChanged();void slotChangeFixedLengthUnit(int index);+ void slotToggleDockToolOptionsVisible();+//When the user checks an editor widget button checkbox, update the AssistantEditorData//struct within the current document's KisPaintingAssistantsDecoration instancevoid slotToggleMoveButton(int index);