diff --git a/src/app/valentina/dialogs/configpages/preferencespatternpage.cpp b/src/app/valentina/dialogs/configpages/preferencespatternpage.cpp
index 16c3a19fc..466fa93a9 100644
--- a/src/app/valentina/dialogs/configpages/preferencespatternpage.cpp
+++ b/src/app/valentina/dialogs/configpages/preferencespatternpage.cpp
@@ -55,6 +55,7 @@ PreferencesPatternPage::PreferencesPatternPage(QWidget *parent)
ui->forbidFlippingCheck->setChecked(qApp->ValentinaSettings()->GetForbidWorkpieceFlipping());
ui->doublePassmarkCheck->setChecked(qApp->ValentinaSettings()->IsDoublePassmark());
ui->checkBoxHideMainPath->setChecked(qApp->ValentinaSettings()->IsHideMainPath());
+ ui->fontComboBoxLabelFont->setCurrentFont(qApp->ValentinaSettings()->GetLabelFont());
}
//---------------------------------------------------------------------------------------------------------------------
@@ -81,6 +82,7 @@ void PreferencesPatternPage::Apply()
settings->SetForbidWorkpieceFlipping(ui->forbidFlippingCheck->isChecked());
settings->SetHideMainPath(ui->checkBoxHideMainPath->isChecked());
+ qApp->ValentinaSettings()->SetLabelFont(ui->fontComboBoxLabelFont->currentFont());
if (settings->IsDoublePassmark() != ui->doublePassmarkCheck->isChecked())
{
diff --git a/src/app/valentina/dialogs/configpages/preferencespatternpage.ui b/src/app/valentina/dialogs/configpages/preferencespatternpage.ui
index 403b37069..b4faae357 100644
--- a/src/app/valentina/dialogs/configpages/preferencespatternpage.ui
+++ b/src/app/valentina/dialogs/configpages/preferencespatternpage.ui
@@ -6,8 +6,8 @@
0
0
- 327
- 414
+ 381
+ 444
@@ -133,6 +133,20 @@
+ -
+
+
-
+
+
+ Label font:
+
+
+
+ -
+
+
+
+
diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp
index 4378d906e..7f1d2b2b7 100644
--- a/src/app/valentina/mainwindow.cpp
+++ b/src/app/valentina/mainwindow.cpp
@@ -4350,6 +4350,7 @@ void MainWindow::Preferences()
connect(dlg.data(), &DialogPreferences::UpdateProperties, toolOptions,
&VToolOptionsPropertyBrowser::RefreshOptions);
connect(dlg.data(), &DialogPreferences::UpdateProperties, this, &MainWindow::ToolBarStyles);
+ connect(dlg.data(), &DialogPreferences::UpdateProperties, this, &MainWindow::RefreshDetailsLabel);
QGuiApplication::restoreOverrideCursor();
if (guard->exec() == QDialog::Accepted)
diff --git a/src/app/valentina/mainwindowsnogui.cpp b/src/app/valentina/mainwindowsnogui.cpp
index 44316bebc..70d38a921 100644
--- a/src/app/valentina/mainwindowsnogui.cpp
+++ b/src/app/valentina/mainwindowsnogui.cpp
@@ -41,6 +41,7 @@
#include "../vpatterndb/floatItemData/vpatternlabeldata.h"
#include "../vpatterndb/floatItemData/vgrainlinedata.h"
#include "../vtools/tools/vabstracttool.h"
+#include "../vtools/tools/vtoolseamallowance.h"
#include
#include
@@ -528,6 +529,25 @@ void MainWindowsNoGUI::PrintTiled()
LayoutPrint();
}
+//---------------------------------------------------------------------------------------------------------------------
+/**
+ * @brief RefreshDetailsLabel call to ecalculate piece labels. For example after changing a font.
+ */
+void MainWindowsNoGUI::RefreshDetailsLabel()
+{
+ const QHash *list = pattern->DataPieces();
+ QHash::const_iterator i = list->constBegin();
+ while (i != list->constEnd())
+ {
+ if (VToolSeamAllowance *tool = qobject_cast(VAbstractPattern::getTool(i.key())))
+ {
+ tool->UpdatePatternInfo();
+ tool->UpdateDetailLabel();
+ }
+ ++i;
+ }
+}
+
//---------------------------------------------------------------------------------------------------------------------
void MainWindowsNoGUI::PrepareDetailsForLayout(const QHash *details)
{
diff --git a/src/app/valentina/mainwindowsnogui.h b/src/app/valentina/mainwindowsnogui.h
index c5406318a..0bfba5c03 100644
--- a/src/app/valentina/mainwindowsnogui.h
+++ b/src/app/valentina/mainwindowsnogui.h
@@ -55,6 +55,7 @@ public slots:
void PrintPreviewTiled();
void PrintOrigin();
void PrintTiled();
+ void RefreshDetailsLabel();
protected:
QVector listDetails;
diff --git a/src/libs/vlayout/vlayoutpiece.cpp b/src/libs/vlayout/vlayoutpiece.cpp
index 8d1b5c65d..fc5260f59 100644
--- a/src/libs/vlayout/vlayoutpiece.cpp
+++ b/src/libs/vlayout/vlayoutpiece.cpp
@@ -385,14 +385,15 @@ VLayoutPiece VLayoutPiece::Create(const VPiece &piece, const VContainer *pattern
const VPieceLabelData& data = piece.GetPatternPieceData();
if (data.IsVisible() == true)
{
- det.SetDetail(piece.GetName(), data, QApplication::font(), pattern);
+ det.SetDetail(piece.GetName(), data, qApp->Settings()->GetLabelFont(), pattern);
}
const VPatternLabelData& geom = piece.GetPatternInfo();
if (geom.IsVisible() == true)
{
VAbstractPattern* pDoc = qApp->getCurrentDocument();
- det.SetPatternInfo(pDoc, geom, QApplication::font(), VContainer::size(), VContainer::height(), pattern);
+ det.SetPatternInfo(pDoc, geom, qApp->Settings()->GetLabelFont(), VContainer::size(), VContainer::height(),
+ pattern);
}
const VGrainlineData& grainlineGeom = piece.GetGrainlineGeometry();
diff --git a/src/libs/vmisc/vcommonsettings.cpp b/src/libs/vmisc/vcommonsettings.cpp
index faf22e74c..7605ef831 100644
--- a/src/libs/vmisc/vcommonsettings.cpp
+++ b/src/libs/vmisc/vcommonsettings.cpp
@@ -39,6 +39,7 @@
#include
#include
#include
+#include
#include "../vmisc/def.h"
#include "../vmisc/vmath.h"
@@ -64,6 +65,7 @@ const QString settingPatternUndo = QStringLiteral("pattern/undo");
const QString settingPatternForbidFlipping = QStringLiteral("pattern/forbidFlipping");
const QString settingPatternHideMainPath = QStringLiteral("pattern/hideMainPath");
const QString settingDoublePassmark = QStringLiteral("pattern/doublePassmark");
+const QString settingLabelFont = QStringLiteral("pattern/labelFont");
const QString settingGeneralRecentFileList = QStringLiteral("recentFileList");
const QString settingGeneralRestoreFileList = QStringLiteral("restoreFileList");
@@ -755,3 +757,15 @@ QChar VCommonSettings::GetDefCSVSeparator() const
{
return QChar(',');
}
+
+//---------------------------------------------------------------------------------------------------------------------
+QFont VCommonSettings::GetLabelFont() const
+{
+ return qvariant_cast(value(settingLabelFont, QApplication::font()));
+}
+
+//---------------------------------------------------------------------------------------------------------------------
+void VCommonSettings::SetLabelFont(const QFont &f)
+{
+ setValue(settingLabelFont, f);
+}
diff --git a/src/libs/vmisc/vcommonsettings.h b/src/libs/vmisc/vcommonsettings.h
index 1770bebaa..88d94397b 100644
--- a/src/libs/vmisc/vcommonsettings.h
+++ b/src/libs/vmisc/vcommonsettings.h
@@ -157,6 +157,9 @@ public:
QChar GetCSVSeparator() const;
QChar GetDefCSVSeparator() const;
+ QFont GetLabelFont() const;
+ void SetLabelFont(const QFont &f);
+
#if !defined(Q_OS_WIN)
static const QString unixStandardSharePath;
#endif
diff --git a/src/libs/vtools/tools/vtoolseamallowance.cpp b/src/libs/vtools/tools/vtoolseamallowance.cpp
index db4aad286..0a80c7071 100644
--- a/src/libs/vtools/tools/vtoolseamallowance.cpp
+++ b/src/libs/vtools/tools/vtoolseamallowance.cpp
@@ -1557,7 +1557,7 @@ bool VToolSeamAllowance::PrepareLabelData(const VPatternLabelData &labelData, VT
}
labelItem->SetMoveType(type);
- QFont fnt = QApplication::font();
+ QFont fnt = qApp->Settings()->GetLabelFont();
{
const int iFS = labelData.GetFontSize();
iFS < MIN_FONT_SIZE ? fnt.setPixelSize(MIN_FONT_SIZE) : fnt.setPixelSize(iFS);
diff --git a/src/libs/vtools/tools/vtoolseamallowance.h b/src/libs/vtools/tools/vtoolseamallowance.h
index 9b7b5ad82..f8375705e 100644
--- a/src/libs/vtools/tools/vtoolseamallowance.h
+++ b/src/libs/vtools/tools/vtoolseamallowance.h
@@ -105,9 +105,9 @@ public slots:
virtual void UpdateAll();
virtual void retranslateUi();
void Highlight(quint32 id);
+ void UpdateDetailLabel();
+ void UpdatePatternInfo();
protected slots:
- void UpdateDetailLabel();
- void UpdatePatternInfo();
void UpdateGrainline();
void SaveMoveDetail(const QPointF &ptPos);
void SaveResizeDetail(qreal dLabelW, int iFontSize);