Skip to content

armgit / krita

Public Imported from GitHub
0

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++

Try to improve orderning of qml components plugin.

Wolthera van Hövell tot Westerflier7171c167843c
diff --git a/qmlmodules/components/CMakeLists.txt b/qmlmodules/components/CMakeLists.txt
index 495374d8da..62bb66c489 100644
--- a/qmlmodules/components/CMakeLists.txt
+++ b/qmlmodules/components/CMakeLists.txt
@@ -13,6 +13,10 @@ if (QT_MAJOR_VERSION STREQUAL "6")
PRIVATE
SvgTextLabel.cpp
SvgTextLabel.h
+ KisNumParser.cpp
+ KisNumParser.h
+ KisCubicCurveQMLWrapper.cpp
+ KisCubicCurveQMLWrapper.h
)
else ()
@@ -36,33 +40,48 @@ else ()
endif ()
-ecm_target_qml_sources(kritaqmlcomponents SOURCES
-
- qml/button/GroupButton.qml
- qml/button/OptionButtonStrip.qml
-
+ecm_target_qml_sources(kritaqmlcomponents PRIVATE PATH textinput SOURCES
+ qml/textinput/TextInputWithSelectionRange.qml
+ qml/textinput/TextInputWithPrefixAndSuffix.qml
+)
+
+ecm_target_qml_sources(kritaqmlcomponents PRIVATE PATH overlays SOURCES
qml/overlays/WarningOverlay.qml
qml/overlays/SliderOverlay.qml
- qml/tooltip/KisToolTip.qml
+)
- qml/textinput/TextInputWithSelectionRange.qml
- qml/textinput/TextInputWithPrefixAndSuffix.qml
-
+ecm_target_qml_sources(kritaqmlcomponents PRIVATE PATH spinbox SOURCES
qml/spinbox/ParseSpinBoxContentItem.qml
- qml/spinbox/IntParseSpinBox.qml
- qml/spinbox/DoubleSpinBox.qml
- qml/spinbox/DoubleParseSpinBox.qml
+)
+ecm_target_qml_sources(kritaqmlcomponents PRIVATE PATH sliderspinbox SOURCES
qml/sliderspinbox/SliderSpinBoxManipulator.qml
qml/sliderspinbox/SliderSpinBoxRangeSwitch.qml
qml/sliderspinbox/SliderSpinBoxContentItem.qml
- qml/sliderspinbox/IntSliderSpinBox.qml
- qml/sliderspinbox/DoubleSliderSpinBox.qml
+)
- qml/curvewidget/CurveWidget.qml
- qml/angleselector/AngleGauge.qml
- qml/angleselector/AngleSelector.qml
+ecm_target_qml_sources(kritaqmlcomponents PRIVATE PATH angleselector SOURCES
qml/angleselector/AngleSelectorUtil.js
+ qml/angleselector/AngleGauge.qml
+)
+
+ecm_target_qml_sources(kritaqmlcomponents SOURCES
+ qml/button/GroupButton.qml
+ qml/button/OptionButtonStrip.qml
+
+ qml/IntParseSpinBox.qml
+ qml/DoubleSpinBox.qml
+ qml/DoubleParseSpinBox.qml
+
+ qml/IntSliderSpinBox.qml
+ qml/DoubleSliderSpinBox.qml
+
+ qml/tooltip/KisToolTip.qml
+
+ qml/curvewidget/CurveWidget.qml
+
+ qml/AngleSelector.qml
+
)
target_link_libraries(kritaqmlcomponents
diff --git a/qmlmodules/components/qml/angleselector/AngleSelector.qml b/qmlmodules/components/qml/AngleSelector.qml
similarity index 98%
rename from qmlmodules/components/qml/angleselector/AngleSelector.qml
rename to qmlmodules/components/qml/AngleSelector.qml
index 1ee0e45068..eff7ee2814 100644
--- a/qmlmodules/components/qml/angleselector/AngleSelector.qml
+++ b/qmlmodules/components/qml/AngleSelector.qml
@@ -5,8 +5,9 @@
*/
import QtQuick 2.15
import QtQuick.Controls 2.15
-import org.krita.components 1.0 as Kis
-import "AngleSelectorUtil.js" as AngleSelectorUtil
+import "angleselector"
+import "tooltip"
+import "angleselector/AngleSelectorUtil.js" as AngleSelectorUtil
/*
\qmltype AngleSelector
@@ -212,7 +213,7 @@ FocusScope {
spacing: 5
anchors.fill: parent
- Kis.AngleGauge {
+ AngleGauge {
id: angleGauge
anchors.verticalCenter: parent.verticalCenter
@@ -232,7 +233,7 @@ FocusScope {
}
}
- Kis.DoubleParseSpinBox {
+ DoubleParseSpinBox {
id: spinBox
anchors.verticalCenter: parent.verticalCenter
@@ -306,7 +307,7 @@ FocusScope {
display: AbstractButton.IconOnly
action: actionFlipHorizontallyAndVertically
icon.color: palette.buttonText;
- Kis.KisToolTip {
+ KisToolTip {
parentControl: buttonFlipHorizontallyAndVertically
text: actionFlipHorizontallyAndVertically.text
}
diff --git a/qmlmodules/components/qml/spinbox/DoubleParseSpinBox.qml b/qmlmodules/components/qml/DoubleParseSpinBox.qml
similarity index 98%
rename from qmlmodules/components/qml/spinbox/DoubleParseSpinBox.qml
rename to qmlmodules/components/qml/DoubleParseSpinBox.qml
index c2de104444..592d19e5cb 100644
--- a/qmlmodules/components/qml/spinbox/DoubleParseSpinBox.qml
+++ b/qmlmodules/components/qml/DoubleParseSpinBox.qml
@@ -4,6 +4,7 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/
import QtQuick 2.15
+import "spinbox"
/*
\qmltype DoubleParseSpinBox
diff --git a/qmlmodules/components/qml/sliderspinbox/DoubleSliderSpinBox.qml b/qmlmodules/components/qml/DoubleSliderSpinBox.qml
similarity index 98%
rename from qmlmodules/components/qml/sliderspinbox/DoubleSliderSpinBox.qml
rename to qmlmodules/components/qml/DoubleSliderSpinBox.qml
index 05006af481..c8f2a23243 100644
--- a/qmlmodules/components/qml/sliderspinbox/DoubleSliderSpinBox.qml
+++ b/qmlmodules/components/qml/DoubleSliderSpinBox.qml
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/
import QtQuick 2.15
-import org.krita.components 1.0 as Kis
+import "sliderspinbox"
/*
\qmltype DoubleSliderSpinBox
@@ -59,7 +59,7 @@ import org.krita.components 1.0 as Kis
The "soft range" is considered valid if the "soft maximum" is greater than
the "soft minimum".
*/
-Kis.DoubleSpinBox {
+DoubleSpinBox {
id: root
/*
@@ -142,7 +142,7 @@ Kis.DoubleSpinBox {
contentItem: FocusScope {
focus: true
- Kis.SliderSpinBoxContentItem {
+ SliderSpinBoxContentItem {
id: contentId
anchors.fill: parent
diff --git a/qmlmodules/components/qml/spinbox/DoubleSpinBox.qml b/qmlmodules/components/qml/DoubleSpinBox.qml
similarity index 100%
rename from qmlmodules/components/qml/spinbox/DoubleSpinBox.qml
rename to qmlmodules/components/qml/DoubleSpinBox.qml
diff --git a/qmlmodules/components/qml/spinbox/IntParseSpinBox.qml b/qmlmodules/components/qml/IntParseSpinBox.qml
similarity index 99%
rename from qmlmodules/components/qml/spinbox/IntParseSpinBox.qml
rename to qmlmodules/components/qml/IntParseSpinBox.qml
index 20190e7b59..eaa7d93043 100644
--- a/qmlmodules/components/qml/spinbox/IntParseSpinBox.qml
+++ b/qmlmodules/components/qml/IntParseSpinBox.qml
@@ -5,6 +5,7 @@
*/
import QtQuick 2.15
import QtQuick.Controls 2.15
+import "spinbox"
/*
\qmltype IntParseSpinBox
diff --git a/qmlmodules/components/qml/sliderspinbox/IntSliderSpinBox.qml b/qmlmodules/components/qml/IntSliderSpinBox.qml
similarity index 99%
rename from qmlmodules/components/qml/sliderspinbox/IntSliderSpinBox.qml
rename to qmlmodules/components/qml/IntSliderSpinBox.qml
index 89c8dbbf9c..a9eca30f8d 100644
--- a/qmlmodules/components/qml/sliderspinbox/IntSliderSpinBox.qml
+++ b/qmlmodules/components/qml/IntSliderSpinBox.qml
@@ -5,6 +5,7 @@
*/
import QtQuick 2.15
import QtQuick.Controls 2.15
+import "sliderspinbox"
/*
\qmltype IntSliderSpinBox
@@ -134,7 +135,7 @@ SpinBox {
contentItem: FocusScope {
focus: true
- KisSliderSpinBoxContentItem {
+ SliderSpinBoxContentItem {
id: contentId
anchors.fill: parent
diff --git a/qmlmodules/components/qml/button/GroupButton.qml b/qmlmodules/components/qml/button/GroupButton.qml
index 066a39da4c..acec104f1a 100644
--- a/qmlmodules/components/qml/button/GroupButton.qml
+++ b/qmlmodules/components/qml/button/GroupButton.qml
@@ -72,7 +72,7 @@ Button {
/sa GroupPosition
*/
- property int groupPosition: KisGroupButton.GroupPosition.NoGroup
+ property int groupPosition: GroupButton.GroupPosition.NoGroup
palette.button: checked? sysPalette.highlight: sysPalette.button;
palette.buttonText: checked? sysPalette.highlightedText: sysPalette.buttonText
@@ -80,10 +80,10 @@ Button {
clip: true
implicitWidth: implicitContentWidth + (root.leftPadding ?? root.padding)
+ (root.rightPadding ?? root.padding)
- leftInset: (groupPosition === KisGroupButton.GroupPosition.GroupRight ||
- groupPosition === KisGroupButton.GroupPosition.GroupCenter) * -50
- rightInset: (groupPosition === KisGroupButton.GroupPosition.GroupLeft ||
- groupPosition === KisGroupButton.GroupPosition.GroupCenter) * -50
+ leftInset: (groupPosition === GroupButton.GroupPosition.GroupRight ||
+ groupPosition === GroupButton.GroupPosition.GroupCenter) * -50
+ rightInset: (groupPosition === GroupButton.GroupPosition.GroupLeft ||
+ groupPosition === GroupButton.GroupPosition.GroupCenter) * -50
Rectangle {
width: 1
@@ -91,7 +91,7 @@ Button {
anchors.right: parent.right
color: root.palette.buttonText;
opacity: 0.1;
- visible: root.groupPosition === KisGroupButton.GroupPosition.GroupLeft ||
- root.groupPosition === KisGroupButton.GroupPosition.GroupCenter
+ visible: root.groupPosition === GroupButton.GroupPosition.GroupLeft ||
+ root.groupPosition === GroupButton.GroupPosition.GroupCenter
}
}
diff --git a/qmlmodules/components/qml/sliderspinbox/SliderSpinBoxContentItem.qml b/qmlmodules/components/qml/sliderspinbox/SliderSpinBoxContentItem.qml
index 8fbe8a1de5..47ce7b7e39 100644
--- a/qmlmodules/components/qml/sliderspinbox/SliderSpinBoxContentItem.qml
+++ b/qmlmodules/components/qml/sliderspinbox/SliderSpinBoxContentItem.qml
@@ -5,7 +5,8 @@
*/
import QtQuick 2.15
import QtQuick.Controls 2.15
-import org.krita.components 1.0 as Kis
+import "../overlays"
+import "../spinbox"
/*
\qmltype SliderSpinBoxContentItem
@@ -151,15 +152,15 @@ FocusScope {
color: root.parentSpinBox.palette.text
//: @info:tooltip toggle between soft and hard range in the slider spin box
toolTip: i18nc("@info:tooltip","Toggle between full range and subrange.\nFull range: [%1, %2]\nSubrange: [%3, %4]",
- Number(root.from).toLocaleString(Qt.locale(), decimals),
- Number(root.to).toLocaleString(Qt.locale(), decimals),
- Number(root.softFrom).toLocaleString(Qt.locale(), decimals),
- Number(root.softTo).toLocaleString(Qt.locale(), decimals));
+ Number(root.from).toLocaleString(Qt.locale(), 'f', decimals),
+ Number(root.to).toLocaleString(Qt.locale(), 'f', decimals),
+ Number(root.softFrom).toLocaleString(Qt.locale(), 'f', decimals),
+ Number(root.softTo).toLocaleString(Qt.locale(), 'f', decimals));
onSoftRangeActiveChanged: root.softRangeActive = softRangeActive
}
- Kis.SliderOverlay {
+ SliderOverlay {
id: sliderOverlay
property real value: parseSpinBoxContentItem.value
@@ -177,7 +178,7 @@ FocusScope {
exponentRatio: root.exponentRatio
}
- Kis.ParseSpinBoxContentItem {
+ ParseSpinBoxContentItem {
id: parseSpinBoxContentItem
anchors.top: parent.top
diff --git a/qmlmodules/components/qml/spinbox/ParseSpinBoxContentItem.qml b/qmlmodules/components/qml/spinbox/ParseSpinBoxContentItem.qml
index 1c7a4d62bd..31d9272878 100644
--- a/qmlmodules/components/qml/spinbox/ParseSpinBoxContentItem.qml
+++ b/qmlmodules/components/qml/spinbox/ParseSpinBoxContentItem.qml
@@ -6,7 +6,9 @@
import QtQml 2.15
import QtQuick 2.15
import QtQuick.Controls 2.15
-import org.krita.components 1.0 as Kis
+import "../textinput"
+import "../overlays"
+import org.krita.components 1.0
/*
\qmltype ParseSpinBoxContentItem
@@ -104,7 +106,7 @@ FocusScope {
onDecimalsChanged: textInput.contentsText = Number(root.value).toLocaleString(Qt.locale(), 'f', decimals);
- Kis.WarningOverlay {
+ WarningOverlay {
id: warningOverlay
anchors.fill: parent
clip: true
@@ -114,7 +116,7 @@ FocusScope {
warningSignAlignment: Qt.AlignRight
}
- Kis.TextInputWithPrefixAndSuffix {
+ TextInputWithPrefixAndSuffix {
id: textInput
property double parsedValue: 0.0
@@ -141,7 +143,7 @@ FocusScope {
}
}
- Kis.KisNumParser { id: numParser;}
+ KisNumParser { id: numParser;}
onContentsTextChanged: {
parsedValue = numParser.parseSimpleMathExpr(contentsText);