Krita Source Code Documentation
Loading...
Searching...
No Matches
DefaultToolTabbedWidget.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2017 Dmitry Kazakov <dimula73@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
8
9#include "kis_icon_utils.h"
12#include "KoFillConfigWidget.h"
13#include <KoInteractionTool.h>
14
16
17
19 : KoTitledTabWidget(parent)
20{
21 setObjectName("default-tool-tabbed-widget");
22
24 m_geometryWidget->setWindowTitle(i18n("Geometry"));
25 addTab(m_geometryWidget, KisIconUtils::loadIcon("geometry"), QString());
26
27 m_strokeWidget = new KoStrokeConfigWidget(tool->canvas(), this);
28 m_strokeWidget->setWindowTitle(i18nc("Draws a line around an area", "Stroke"));
29
32 managerLineWidth->setApparentUnitFromSymbol("px");
33 managerMitterLimit->setApparentUnitFromSymbol("px"); //set unit to px by default
34 m_strokeWidget->setUnitManagers(managerLineWidth, managerMitterLimit);
35
36 addTab(m_strokeWidget, KisIconUtils::loadIcon("krita_tool_line"), QString());
37
38
39 m_fillWidget = new KoFillConfigWidget(tool->canvas(), KoFlake::Fill, true, this);
40 m_fillWidget->setWindowTitle(i18n("Fill"));
41 addTab(m_fillWidget, KisIconUtils::loadIcon("krita_tool_color_fill"), QString());
42
43 connect(this, SIGNAL(currentChanged(int)), SLOT(slotCurrentIndexChanged(int)));
44 m_oldTabIndex = currentIndex();
45
47}
48
52
54{
55 if (currentIndex() == StrokeTab) {
57 } else {
59 }
60}
61
70
75
84
86{
87 // because of nesting we are required to only let one widget be active at at time
88 deactivate();
89 activate();
90
91 if (m_oldTabIndex == FillTab) {
93 } else if (m_oldTabIndex == StrokeTab) {
95 }
96
97 m_oldTabIndex = current;
98
99 if (current == FillTab) {
101 } else if (m_oldTabIndex == StrokeTab) {
103 }
104}
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
void slotCurrentIndexChanged(int current)
DefaultToolGeometryWidget * m_geometryWidget
KoStrokeConfigWidget * m_strokeWidget
void sigSwitchModeEditStrokeGradient(bool value)
KoFillConfigWidget * m_fillWidget
void slotMeshGradientHandleSelected(KoShapeMeshGradientHandles::Handle h)
DefaultToolTabbedWidget(KoInteractionTool *tool, QWidget *parent=0)
void sigSwitchModeEditFillGradient(bool value)
The KisDocumentAwareSpinBoxUnitManager class is a KisSpinBoxUnitManager that is able to connect to th...
void setApparentUnitFromSymbol(QString pSymbol)
A widget for configuring the fill of a shape.
void setSelectedMeshGradientHandle(const SvgMeshPosition &position)
A widget for configuring the stroke of a shape.
void setUnitManagers(KisSpinBoxUnitManager *managerLineWidth, KisSpinBoxUnitManager *managerMitterLimit)
KoCanvasBase * canvas() const
Returns the canvas the tool is working on.
QIcon loadIcon(const QString &name)
@ Fill
Definition KoFlake.h:29