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

Small fixes, such as better layout and better handling of the model.

Wolthera van Hövell tot Westerflier4ea8885322bb
diff --git a/plugins/tools/svgtexttool/glyphpalette/GlyphPalette.qml b/plugins/tools/svgtexttool/glyphpalette/GlyphPalette.qml
index 85c542db16..b43aaaf500 100644
--- a/plugins/tools/svgtexttool/glyphpalette/GlyphPalette.qml
+++ b/plugins/tools/svgtexttool/glyphpalette/GlyphPalette.qml
@@ -87,14 +87,17 @@ Rectangle {
}
// Charmap.
- Item {
+ RowLayout {
+ Layout.fillHeight: true;
+ Layout.fillWidth: true;
+ spacing: 1;
ListView {
id: charMapFilter
- model: root.charMapFilterModel;
- anchors.top: parent.top;
- anchors.bottom: parent.bottom;
- anchors.left: parent.left;
- width: 100;
+ model: charMapFilterModel;
+ Layout.minimumWidth: 100;
+ Layout.maximumWidth: 200;
+ Layout.fillHeight: true;
+ Layout.fillWidth: true;
onCurrentIndexChanged: {
mainWindow.slotChangeFilter(currentIndex);
@@ -116,11 +119,9 @@ Rectangle {
model: root.charMapModel;
focus: true;
clip: true;
-
- anchors.top: parent.top;
- anchors.bottom: parent.bottom;
- anchors.left: charMapFilter.right;
- anchors.right: parent.right;
+ Layout.minimumWidth: 180;
+ Layout.fillHeight: true;
+ Layout.fillWidth: true;
cellWidth: (width - charMapScroll.implicitBackgroundWidth)/8;
cellHeight: cellWidth;
@@ -152,9 +153,11 @@ Rectangle {
height: charMap.cellHeight*3;
modal: true
focus: true
+ padding: 2;
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
GridView {
anchors.fill: parent;
+ clip: true;
cellWidth: (width - charMapAltGlyphsScroll.implicitBackgroundWidth)/8;
cellHeight: cellWidth;
diff --git a/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteDialog.cpp b/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteDialog.cpp
index 21a52e3ee8..c18d03e512 100644
--- a/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteDialog.cpp
+++ b/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteDialog.cpp
@@ -121,19 +121,23 @@ void GlyphPaletteDialog::setGlyphModelFromProperties(KoSvgTextProperties propert
void GlyphPaletteDialog::slotInsertRichText(int charRow, int glyphRow, bool replace)
{
if (m_quickWidget->rootObject()) {
- QModelIndex idx = glyphRow > -1? m_model->index(charRow, 0): m_charMapModel->index(charRow, 0);
+ QModelIndex idx = replace? m_model->index(charRow, 0): m_charMapModel->index(charRow, 0);
QString text;
KoSvgTextProperties props = m_lastUsedProperties;
- QStringList otf = props.property(KoSvgTextProperties::FontFeatureSettingsId).value<QStringList>();
- if (glyphRow > -1) {
+ QStringList otf;
+ if (replace) {
idx = m_model->index(glyphRow, 0, idx);
text = m_model->data(idx, Qt::DisplayRole).toString();
otf.append(m_model->data(idx, KoFontGlyphModel::OpenTypeFeatures).value<QStringList>());
} else {
+ idx = m_charMapModel->index(glyphRow, 0, idx);
text = m_charMapModel->data(idx, Qt::DisplayRole).toString();
+ otf.append(m_charMapModel->data(idx, KoFontGlyphModel::OpenTypeFeatures).value<QStringList>());
}
KoSvgTextShape *richText = new KoSvgTextShape();
- props.setProperty(KoSvgTextProperties::FontFeatureSettingsId, otf);
+ if (!otf.isEmpty()) {
+ props.setProperty(KoSvgTextProperties::FontFeatureSettingsId, otf);
+ }
richText->setPropertiesAtPos(-1, props);
richText->insertText(0, text);
diff --git a/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteProxyModel.cpp b/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteProxyModel.cpp
index 76882d0595..0bb818392a 100644
--- a/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteProxyModel.cpp
+++ b/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteProxyModel.cpp
@@ -44,6 +44,7 @@ void GlyphPaletteProxyModel::setFilter(int filter)
bool GlyphPaletteProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
{
+ if (sourceParent.isValid()) return true;
QModelIndex idx = sourceModel()->index(sourceRow, 0, sourceParent);
QString main = sourceModel()->data(idx).toString();
QChar::Script script = main.isEmpty()? QChar::Script_Unknown :main.front().script();