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

Fix the tabbar and the down arrow on the font family selector.

Wolthera van Hövell tot Westerflier8f6dad5bd93d
diff --git a/plugins/dockers/textproperties/qml/FontResourceDropdown.qml b/plugins/dockers/textproperties/qml/FontResourceDropdown.qml
index 76968bcd20..bedc3e41ca 100644
--- a/plugins/dockers/textproperties/qml/FontResourceDropdown.qml
+++ b/plugins/dockers/textproperties/qml/FontResourceDropdown.qml
@@ -29,6 +29,7 @@ Button {
property alias fontFileName: textInput.text;
topPadding: 0;
bottomPadding: 0;
+ spacing: padding;
leftPadding: (familyCmb.mirrored ? padding + indicator.width + spacing : 0);
rightPadding: (!familyCmb.mirrored ? padding + indicator.width + spacing : 0);
@@ -101,12 +102,11 @@ Button {
indicator: Image {
id: imgIndicator
- x: familyCmb.mirrored ? familyCmb.padding : familyCmb.width - width - familyCmb.padding
- y: familyCmb.topPadding + (familyCmb.availableHeight - height) / 2
+ x: Math.round(familyCmb.mirrored ? familyCmb.padding : familyCmb.width - width - familyCmb.padding);
+ y: Math.round(familyCmb.topPadding + (familyCmb.availableHeight - height) / 2);
source: familyCmb.palette.button.hslLightness < 0.5? "qrc:///light_groupOpened.svg": "qrc:///dark_groupOpened.svg";
width: 12;
height: 12;
- fillMode: Image.Pad;
clip: true;
}
diff --git a/plugins/dockers/textproperties/qml/TextProperties.qml b/plugins/dockers/textproperties/qml/TextProperties.qml
index 3c3ab37922..9974d493eb 100644
--- a/plugins/dockers/textproperties/qml/TextProperties.qml
+++ b/plugins/dockers/textproperties/qml/TextProperties.qml
@@ -100,156 +100,166 @@ Control {
onCallPropertyVisibilityConfig: canvasObserver.callModalTextPropertyConfigDialog();
}
- ResourceView {
- id: presetView;
- resourceType: "css_styles";
+ ColumnLayout {
Layout.fillHeight: true;
Layout.fillWidth: true;
-
- signal applyPreset;
- onApplyPreset: {
- canvasObserver.applyPreset(modelWrapper.currentResource);
+ Item {
+ id: topPadding;
+ height: Math.floor(spacing/2);
+ Layout.fillWidth: true;
}
- resourceDelegate: ItemDelegate {
- id: presetDelegate;
- required property var model;
- property var meta: model.metadata;
- width: ListView.view.width;
- highlighted: presetView.highlightedIndex === model.index;
- property bool selected: presetView.modelWrapper.currentIndex === model.index;
- palette: presetView.palette;
- contentItem: KoShapeQtQuickLabel {
- implicitHeight: nameLabel.height * 4;
- padding: nameLabel.height;
- alignment: presetDelegate.meta.sample_align;
- scalingType: presetDelegate.meta.style_type === "paragraph"?
- KoShapeQtQuickLabel.FitWidth: KoShapeQtQuickLabel.Fit;
- svgData: presetDelegate.meta.sample_svg;
- foregroundColor: presetDelegate.highlighted? palette.highlightedText: palette.text;
+ ResourceView {
+ id: presetView;
+ resourceType: "css_styles";
+ Layout.fillHeight: true;
+ Layout.fillWidth: true;
- Label {
- id: nameLabel;
- palette: presetDelegate.palette;
- text: presetDelegate.model.name;
- anchors.top: parent.top;
- anchors.left: parent.left;
- anchors.right: parent.right;
- elide: Text.ElideRight;
- color: presetDelegate.highlighted? palette.highlightedText: palette.text;
- }
+ signal applyPreset;
+ onApplyPreset: {
+ canvasObserver.applyPreset(modelWrapper.currentResource);
+ }
- Row {
- anchors.bottom: parent.bottom;
- anchors.left: parent.left;
- anchors.right: parent.right;
- ToolButton {
- id: missingFamily;
- visible: typeof presetDelegate.meta.primary_font_family !== 'undefined'?
- presetDelegate.meta.primary_font_family !== ""
- && mainWindow.wwsFontFamilyName(presetDelegate.meta.primary_font_family, true) === "": false;
- icon.source: palette.window.hslLightness < 0.5? "qrc:///16_light_warning.svg": "qrc:///16_dark_warning.svg";
- icon.height: 8;
- icon.width: 8;
+ resourceDelegate: ItemDelegate {
+ id: presetDelegate;
+ required property var model;
+ property var meta: model.metadata;
+ width: ListView.view.width;
+ highlighted: presetView.highlightedIndex === model.index;
+ property bool selected: presetView.modelWrapper.currentIndex === model.index;
+ palette: presetView.palette;
+ contentItem: KoShapeQtQuickLabel {
+ implicitHeight: nameLabel.height * 4;
+ padding: nameLabel.height;
+ alignment: presetDelegate.meta.sample_align;
+ scalingType: presetDelegate.meta.style_type === "paragraph"?
+ KoShapeQtQuickLabel.FitWidth: KoShapeQtQuickLabel.Fit;
+ svgData: presetDelegate.meta.sample_svg;
+ foregroundColor: presetDelegate.highlighted? palette.highlightedText: palette.text;
+
+ Label {
+ id: nameLabel;
+ palette: presetDelegate.palette;
+ text: presetDelegate.model.name;
+ anchors.top: parent.top;
+ anchors.left: parent.left;
+ anchors.right: parent.right;
+ elide: Text.ElideRight;
+ color: presetDelegate.highlighted? palette.highlightedText: palette.text;
}
- }
- }
- background: Rectangle {
- color: presetDelegate.highlighted? presetDelegate.palette.highlight: "transparent";
- border.color: presetDelegate.selected? presetDelegate.palette.highlight: presetDelegate.palette.mid;
- border.width: presetDelegate.selected? 2: 1;
- }
- MouseArea {
- id: delegateMouseArea;
- acceptedButtons: Qt.RightButton | Qt.LeftButton;
- anchors.fill: parent;
- hoverEnabled: true;
- preventStealing: true;
- onClicked: {
- if (mouse.button === Qt.RightButton) {
- presetView.openContextMenu(mouse.x, mouse.y, parent.model.name, parent.model.index);
- } else {
- presetView.applyHighlightedIndex();
+ Row {
+ anchors.bottom: parent.bottom;
+ anchors.left: parent.left;
+ anchors.right: parent.right;
+ ToolButton {
+ id: missingFamily;
+ visible: typeof presetDelegate.meta.primary_font_family !== 'undefined'?
+ presetDelegate.meta.primary_font_family !== ""
+ && mainWindow.wwsFontFamilyName(presetDelegate.meta.primary_font_family, true) === "": false;
+ icon.source: palette.window.hslLightness < 0.5? "qrc:///16_light_warning.svg": "qrc:///16_dark_warning.svg";
+ icon.height: 8;
+ icon.width: 8;
+ }
}
}
- onDoubleClicked: {
- presetView.applyHighlightedIndex();
- presetView.applyPreset();
+ background: Rectangle {
+ color: presetDelegate.highlighted? presetDelegate.palette.highlight: "transparent";
+ border.color: presetDelegate.selected? presetDelegate.palette.highlight: presetDelegate.palette.mid;
+ border.width: presetDelegate.selected? 2: 1;
}
- onContainsMouseChanged: {
- if (containsMouse) {
- presetView.highlightedIndex = parent.model.index;
+
+ MouseArea {
+ id: delegateMouseArea;
+ acceptedButtons: Qt.RightButton | Qt.LeftButton;
+ anchors.fill: parent;
+ hoverEnabled: true;
+ preventStealing: true;
+ onClicked: {
+ if (mouse.button === Qt.RightButton) {
+ presetView.openContextMenu(mouse.x, mouse.y, parent.model.name, parent.model.index);
+ } else {
+ presetView.applyHighlightedIndex();
+ }
+ }
+ onDoubleClicked: {
+ presetView.applyHighlightedIndex();
+ presetView.applyPreset();
+ }
+ onContainsMouseChanged: {
+ if (containsMouse) {
+ presetView.highlightedIndex = parent.model.index;
+ }
}
- }
- readonly property string missingFontName : i18nc("%1 is name of a font family", "Font Family \"%1\" is missing on this machine. This style preset may not work correctly.", presetDelegate.meta.primary_font_family);
- Kis.ToolTipBase {
- text: (typeof presetDelegate.meta.description !== 'undefined'? presetDelegate.model.name + "\n" + presetDelegate.meta.description: presetDelegate.model.name) + (missingFamily.visible? "\n"+ delegateMouseArea.missingFontName: "");
- visible: delegateMouseArea.containsMouse;
- }
+ readonly property string missingFontName : i18nc("%1 is name of a font family", "Font Family \"%1\" is missing on this machine. This style preset may not work correctly.", presetDelegate.meta.primary_font_family);
+ Kis.ToolTipBase {
+ text: (typeof presetDelegate.meta.description !== 'undefined'? presetDelegate.model.name + "\n" + presetDelegate.meta.description: presetDelegate.model.name) + (missingFamily.visible? "\n"+ delegateMouseArea.missingFontName: "");
+ visible: delegateMouseArea.containsMouse;
+ }
+ }
}
- }
- additionalAddResourceRow: RowLayout {
- height: implicitHeight;
- width: parent.width;
- Layout.alignment: Qt.AlignRight;
+ additionalAddResourceRow: RowLayout {
+ height: implicitHeight;
+ width: parent.width;
+ Layout.alignment: Qt.AlignRight;
- Item {
- Layout.fillWidth: true;
- }
+ Item {
+ Layout.fillWidth: true;
+ }
- ToolButton {
- text: i18nc("@label:button", "Add Style Preset");
- display: AbstractButton.IconOnly;
- icon.source: "qrc:///light_list-add.svg";
- icon.color: palette.text;
- icon.width: 16;
- icon.height: 16;
- onClicked: canvasObserver.createNewPresetFromSettings();
- hoverEnabled: true;
- ToolTip.text: text;
- ToolTip.visible: hovered;
- ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval;
- }
- ToolButton {
- text: i18nc("@label:button", "Edit Style Preset");
- display: AbstractButton.IconOnly;
- icon.source: "qrc:///16_light_edit-rename.svg";
- icon.color: palette.text;
- icon.width: 16;
- icon.height: 16;
- onClicked: canvasObserver.editPreset(presetView.modelWrapper.currentResource);
- hoverEnabled: true;
- Kis.ThemedControl {
- id: editPalette;
+ ToolButton {
+ text: i18nc("@label:button", "Add Style Preset");
+ display: AbstractButton.IconOnly;
+ icon.source: "qrc:///light_list-add.svg";
+ icon.color: palette.text;
+ icon.width: 16;
+ icon.height: 16;
+ onClicked: canvasObserver.createNewPresetFromSettings();
+ hoverEnabled: true;
+ ToolTip.text: text;
+ ToolTip.visible: hovered;
+ ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval;
}
- palette: editPalette.palette;
+ ToolButton {
+ text: i18nc("@label:button", "Edit Style Preset");
+ display: AbstractButton.IconOnly;
+ icon.source: "qrc:///16_light_edit-rename.svg";
+ icon.color: palette.text;
+ icon.width: 16;
+ icon.height: 16;
+ onClicked: canvasObserver.editPreset(presetView.modelWrapper.currentResource);
+ hoverEnabled: true;
+ Kis.ThemedControl {
+ id: editPalette;
+ }
+ palette: editPalette.palette;
- enabled: presetView.modelWrapper.currentIndex >= 0;
- ToolTip.visible: hovered;
- ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval;
- ToolTip.text: text;
- }
- ToolButton {
- text: i18nc("@label:button", "Clone Style Preset");
- display: AbstractButton.IconOnly;
- icon.source: "qrc:///light_edit-copy.svg";
- icon.color: palette.text;
- icon.width: 16;
- icon.height: 16;
- onClicked: canvasObserver.cloneAndEditPreset(presetView.modelWrapper.currentResource);
- hoverEnabled: true;
- Kis.ThemedControl {
- id: cloneButtonPalette;
+ enabled: presetView.modelWrapper.currentIndex >= 0;
+ ToolTip.visible: hovered;
+ ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval;
+ ToolTip.text: text;
}
- palette: cloneButtonPalette.palette;
+ ToolButton {
+ text: i18nc("@label:button", "Clone Style Preset");
+ display: AbstractButton.IconOnly;
+ icon.source: "qrc:///light_edit-copy.svg";
+ icon.color: palette.text;
+ icon.width: 16;
+ icon.height: 16;
+ onClicked: canvasObserver.cloneAndEditPreset(presetView.modelWrapper.currentResource);
+ hoverEnabled: true;
+ Kis.ThemedControl {
+ id: cloneButtonPalette;
+ }
+ palette: cloneButtonPalette.palette;
- enabled: presetView.modelWrapper.currentIndex >= 0;
- ToolTip.visible: hovered;
- ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval;
- ToolTip.text: text;
+ enabled: presetView.modelWrapper.currentIndex >= 0;
+ ToolTip.visible: hovered;
+ ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval;
+ ToolTip.text: text;
+ }
}
}
}
diff --git a/plugins/dockers/textproperties/qml/TextPropertyBaseList.qml b/plugins/dockers/textproperties/qml/TextPropertyBaseList.qml
index 3480d4f169..da46f63bdc 100644
--- a/plugins/dockers/textproperties/qml/TextPropertyBaseList.qml
+++ b/plugins/dockers/textproperties/qml/TextPropertyBaseList.qml
@@ -129,6 +129,11 @@ ColumnLayout {
signal callPropertyVisibilityConfig;
+ Item {
+ id: topPadding;
+ height: Math.floor(spacing/2);
+ }
+
Frame {
id: frame;
Layout.fillHeight: true;
diff --git a/qmlmodules/components/qml/themedComponents/+Fusion/TabButtonBase.qml b/qmlmodules/components/qml/themedComponents/+Fusion/TabButtonBase.qml
index 267d924979..662e1ca257 100644
--- a/qmlmodules/components/qml/themedComponents/+Fusion/TabButtonBase.qml
+++ b/qmlmodules/components/qml/themedComponents/+Fusion/TabButtonBase.qml
@@ -12,32 +12,31 @@ import QtQuick.Controls 2.15
*/
TabButton {
id: control;
- bottomInset: -10;
clip: true;
- y: checked ? 0 : 2;
- height: implicitHeight + (checked ? 2 : 0);
+ padding: 2;
+ horizontalPadding: 4
+ spacing: 6
+ icon.width: 16
+ icon.height: 16
+
+ z: checked;
background:Rectangle {
readonly property bool checked: control.checked;
color: checked? control.palette.window: Qt.darker(parent.palette.window, 1.1);
border.color: Qt.darker(parent.palette.window, 1.4);
- radius: 1;
+ radius: 2;
+ y: checked ? 2 : 4;
+ height: control.height+5;
Rectangle {
x: 1; y: 1
width: parent.width - 2
height: parent.height - 2
- border.color: Qt.lighter(parent.color, 1.3);
- color: parent.color;
- radius: 2;
- }
- Rectangle {
- x: 2; y: 2
- width: parent.width - 4
- height: parent.height;
+ border.color: control.palette.window;
color: parent.color;
- radius: 3;
+ radius: parent.radius+1;
}
}
}