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 make the qml resource delegates a little smaller.
Wolthera van Hövell tot Westerflier669e49ad6232
diff --git a/plugins/dockers/textproperties/qml/FontResourceDropdown.qml b/plugins/dockers/textproperties/qml/FontResourceDropdown.qmlindex dbdcb77258..da626cf3cc 100644--- a/plugins/dockers/textproperties/qml/FontResourceDropdown.qml+++ b/plugins/dockers/textproperties/qml/FontResourceDropdown.qml@@ -20,5 +20,5 @@ Kis.ResourcePopup {resourceCmb.activated();}}- view.preferredHeight: 300; // roughly 3.5 times the font delegate size;+ view.preferredHeight: 200; // roughly 3.5 times the font delegate size;}diff --git a/plugins/tools/svgtexttool/SvgTextToolOptions.qml b/plugins/tools/svgtexttool/SvgTextToolOptions.qmlindex be510c9b6a..2f5e3c4831 100644--- a/plugins/tools/svgtexttool/SvgTextToolOptions.qml+++ b/plugins/tools/svgtexttool/SvgTextToolOptions.qml@@ -88,12 +88,13 @@ Control {resourceDelegate: Kis.CssStylePresetDelegate {id: presetDelegate;resourceView: btnSelectCssStylePreset.view;+ preferredHeight: minimumHeight;onResourceLeftClicked: {btnSelectCssStylePreset.activated();}}- view.preferredHeight: 256; /// roughly 3x preset delegate size;+ view.preferredHeight: 120; /// roughly 3x preset delegate size;onResourceNameChanged: {manager.optionsModel.cssStylePresetName = btnSelectCssStylePreset.resourceName;diff --git a/qmlmodules/components/qml/resourceDelegates/CssStylePresetDelegate.qml b/qmlmodules/components/qml/resourceDelegates/CssStylePresetDelegate.qmlindex bcee141c58..66e759ede9 100644--- a/qmlmodules/components/qml/resourceDelegates/CssStylePresetDelegate.qml+++ b/qmlmodules/components/qml/resourceDelegates/CssStylePresetDelegate.qml@@ -5,6 +5,7 @@*/import QtQuick 2.15import QtQuick.Controls 2.15+import QtQuick.Layouts 1.15import org.krita.components 1.0 as Kis/**@@ -15,35 +16,23 @@ ResourceDelegateBase {property var meta: model.metadata;width: ListView.view.width;+ preferredHeight: minimumHeight * 3;+ minimumHeight: Math.max(missingFamily.implicitHeight, nameLabel.implicitHeight);Kis.FontFunctions {id: fontFunctions;}- contentItem: Kis.KoShapeQtQuickLabel {- implicitHeight: nameLabel.height * 4;- padding: nameLabel.height;- alignment: presetDelegate.meta.sample_align;- scalingType: presetDelegate.meta.style_type === "paragraph"?- Kis.KoShapeQtQuickLabel.FitWidth: Kis.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;- }-+ contentItem: GridLayout {+ id: mainGrid;+ implicitHeight: Math.max(presetDelegate.minimumHeight, presetDelegate.preferredHeight);+ columns: implicitHeight < (presetDelegate.minimumHeight*2)? 2: 1;Row {- anchors.bottom: parent.bottom;- anchors.left: parent.left;- anchors.right: parent.right;+ id: iconRow;+ Layout.fillWidth: true;+ Layout.maximumWidth: presetDelegate.width/mainGrid.columns;+ Layout.minimumHeight: implicitHeight;+ Layout.preferredHeight: implicitHeight;ToolButton {id: missingFamily;visible: typeof presetDelegate.meta.primary_font_family !== 'undefined'?@@ -53,8 +42,29 @@ ResourceDelegateBase {icon.height: 8;icon.width: 8;}+ Label {+ id: nameLabel;+ palette: presetDelegate.palette;+ text: presetDelegate.model.name;+ elide: Text.ElideRight;+ width: (iconRow.width - (missingFamily.implicitWidth+iconRow.spacing));+ color: presetDelegate.highlighted? palette.highlightedText: palette.text;+ }+ }+ Kis.KoShapeQtQuickLabel {+ id: styleSample;+ Layout.fillHeight: true;+ Layout.fillWidth: true;+ Layout.minimumHeight: presetDelegate.minimumHeight;+ Layout.maximumWidth: (mainGrid.columns == 1)? presetDelegate.width: Math.min(presetDelegate.width/mainGrid.columns, styleSample.height*(minimumRect.width/minimumRect.height));+ alignment: presetDelegate.meta.sample_align;+ scalingType: presetDelegate.meta.style_type === "paragraph"?+ Kis.KoShapeQtQuickLabel.FitWidth: Kis.KoShapeQtQuickLabel.Fit;+ svgData: presetDelegate.meta.sample_svg;+ foregroundColor: 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;diff --git a/qmlmodules/components/qml/resourceDelegates/FontFamilyDelegate.qml b/qmlmodules/components/qml/resourceDelegates/FontFamilyDelegate.qmlindex 31babf0d1a..c093774e3b 100644--- a/qmlmodules/components/qml/resourceDelegates/FontFamilyDelegate.qml+++ b/qmlmodules/components/qml/resourceDelegates/FontFamilyDelegate.qml@@ -29,6 +29,9 @@ ResourceDelegateBase {// TODO: change this to use the text locale, if possible.property string sample: "";+ preferredHeight: nameLabel.height*3;+ minimumHeight:nameLabel.height;+onMetadataChanged: {updateSample();}@@ -81,7 +84,7 @@ ResourceDelegateBase {property alias fontName: fontDelegateItem.fontName;- implicitHeight: nameLabel.height*4;+ implicitHeight: Math.max(fontDelegateItem.minimumHeight, fontDelegateItem.preferredHeight);Loader {anchors.fill: parent;diff --git a/qmlmodules/components/qml/resourceDelegates/ResourceDelegateBase.qml b/qmlmodules/components/qml/resourceDelegates/ResourceDelegateBase.qmlindex d13ea66a1c..e16756e911 100644--- a/qmlmodules/components/qml/resourceDelegates/ResourceDelegateBase.qml+++ b/qmlmodules/components/qml/resourceDelegates/ResourceDelegateBase.qml@@ -13,11 +13,14 @@ import org.krita.components 1.0 as Kisbase for KoResource delegates.*/ItemDelegate {+ id: control;/*\qmlProperty modelvalue automatically gained from the model and represents the model data.*/required property var model;+ property double preferredHeight;+ property double minimumHeight;/*\qmlProperty resourceViewthe resource view this is set on.@@ -36,4 +39,12 @@ ItemDelegate {property bool selected: resourceView.modelWrapper.currentIndex === model.index;palette: resourceView.palette;++ contentItem: Label {+ palette: control.palette;+ text: control.model.name;+ elide: Text.ElideRight;+ anchors.fill: parent;+ color: control.highlighted? palette.highlightedText: palette.text;+ }}