Allow user to setup font family for piece labels.
--HG-- branch : feature
This commit is contained in:
parent
018007e87b
commit
275338da4b
|
@ -55,6 +55,7 @@ PreferencesPatternPage::PreferencesPatternPage(QWidget *parent)
|
||||||
ui->forbidFlippingCheck->setChecked(qApp->ValentinaSettings()->GetForbidWorkpieceFlipping());
|
ui->forbidFlippingCheck->setChecked(qApp->ValentinaSettings()->GetForbidWorkpieceFlipping());
|
||||||
ui->doublePassmarkCheck->setChecked(qApp->ValentinaSettings()->IsDoublePassmark());
|
ui->doublePassmarkCheck->setChecked(qApp->ValentinaSettings()->IsDoublePassmark());
|
||||||
ui->checkBoxHideMainPath->setChecked(qApp->ValentinaSettings()->IsHideMainPath());
|
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->SetForbidWorkpieceFlipping(ui->forbidFlippingCheck->isChecked());
|
||||||
settings->SetHideMainPath(ui->checkBoxHideMainPath->isChecked());
|
settings->SetHideMainPath(ui->checkBoxHideMainPath->isChecked());
|
||||||
|
qApp->ValentinaSettings()->SetLabelFont(ui->fontComboBoxLabelFont->currentFont());
|
||||||
|
|
||||||
if (settings->IsDoublePassmark() != ui->doublePassmarkCheck->isChecked())
|
if (settings->IsDoublePassmark() != ui->doublePassmarkCheck->isChecked())
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>327</width>
|
<width>381</width>
|
||||||
<height>414</height>
|
<height>444</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -133,6 +133,20 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>Label font:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QFontComboBox" name="fontComboBoxLabelFont"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -4350,6 +4350,7 @@ void MainWindow::Preferences()
|
||||||
connect(dlg.data(), &DialogPreferences::UpdateProperties, toolOptions,
|
connect(dlg.data(), &DialogPreferences::UpdateProperties, toolOptions,
|
||||||
&VToolOptionsPropertyBrowser::RefreshOptions);
|
&VToolOptionsPropertyBrowser::RefreshOptions);
|
||||||
connect(dlg.data(), &DialogPreferences::UpdateProperties, this, &MainWindow::ToolBarStyles);
|
connect(dlg.data(), &DialogPreferences::UpdateProperties, this, &MainWindow::ToolBarStyles);
|
||||||
|
connect(dlg.data(), &DialogPreferences::UpdateProperties, this, &MainWindow::RefreshDetailsLabel);
|
||||||
QGuiApplication::restoreOverrideCursor();
|
QGuiApplication::restoreOverrideCursor();
|
||||||
|
|
||||||
if (guard->exec() == QDialog::Accepted)
|
if (guard->exec() == QDialog::Accepted)
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
#include "../vpatterndb/floatItemData/vpatternlabeldata.h"
|
#include "../vpatterndb/floatItemData/vpatternlabeldata.h"
|
||||||
#include "../vpatterndb/floatItemData/vgrainlinedata.h"
|
#include "../vpatterndb/floatItemData/vgrainlinedata.h"
|
||||||
#include "../vtools/tools/vabstracttool.h"
|
#include "../vtools/tools/vabstracttool.h"
|
||||||
|
#include "../vtools/tools/vtoolseamallowance.h"
|
||||||
|
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
|
@ -528,6 +529,25 @@ void MainWindowsNoGUI::PrintTiled()
|
||||||
LayoutPrint();
|
LayoutPrint();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief RefreshDetailsLabel call to ecalculate piece labels. For example after changing a font.
|
||||||
|
*/
|
||||||
|
void MainWindowsNoGUI::RefreshDetailsLabel()
|
||||||
|
{
|
||||||
|
const QHash<quint32, VPiece> *list = pattern->DataPieces();
|
||||||
|
QHash<quint32, VPiece>::const_iterator i = list->constBegin();
|
||||||
|
while (i != list->constEnd())
|
||||||
|
{
|
||||||
|
if (VToolSeamAllowance *tool = qobject_cast<VToolSeamAllowance*>(VAbstractPattern::getTool(i.key())))
|
||||||
|
{
|
||||||
|
tool->UpdatePatternInfo();
|
||||||
|
tool->UpdateDetailLabel();
|
||||||
|
}
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void MainWindowsNoGUI::PrepareDetailsForLayout(const QHash<quint32, VPiece> *details)
|
void MainWindowsNoGUI::PrepareDetailsForLayout(const QHash<quint32, VPiece> *details)
|
||||||
{
|
{
|
||||||
|
|
|
@ -55,6 +55,7 @@ public slots:
|
||||||
void PrintPreviewTiled();
|
void PrintPreviewTiled();
|
||||||
void PrintOrigin();
|
void PrintOrigin();
|
||||||
void PrintTiled();
|
void PrintTiled();
|
||||||
|
void RefreshDetailsLabel();
|
||||||
protected:
|
protected:
|
||||||
QVector<VLayoutPiece> listDetails;
|
QVector<VLayoutPiece> listDetails;
|
||||||
|
|
||||||
|
|
|
@ -385,14 +385,15 @@ VLayoutPiece VLayoutPiece::Create(const VPiece &piece, const VContainer *pattern
|
||||||
const VPieceLabelData& data = piece.GetPatternPieceData();
|
const VPieceLabelData& data = piece.GetPatternPieceData();
|
||||||
if (data.IsVisible() == true)
|
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();
|
const VPatternLabelData& geom = piece.GetPatternInfo();
|
||||||
if (geom.IsVisible() == true)
|
if (geom.IsVisible() == true)
|
||||||
{
|
{
|
||||||
VAbstractPattern* pDoc = qApp->getCurrentDocument();
|
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();
|
const VGrainlineData& grainlineGeom = piece.GetGrainlineGeometry();
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
#include <QTextCodec>
|
#include <QTextCodec>
|
||||||
|
#include <QFont>
|
||||||
|
|
||||||
#include "../vmisc/def.h"
|
#include "../vmisc/def.h"
|
||||||
#include "../vmisc/vmath.h"
|
#include "../vmisc/vmath.h"
|
||||||
|
@ -64,6 +65,7 @@ const QString settingPatternUndo = QStringLiteral("pattern/undo");
|
||||||
const QString settingPatternForbidFlipping = QStringLiteral("pattern/forbidFlipping");
|
const QString settingPatternForbidFlipping = QStringLiteral("pattern/forbidFlipping");
|
||||||
const QString settingPatternHideMainPath = QStringLiteral("pattern/hideMainPath");
|
const QString settingPatternHideMainPath = QStringLiteral("pattern/hideMainPath");
|
||||||
const QString settingDoublePassmark = QStringLiteral("pattern/doublePassmark");
|
const QString settingDoublePassmark = QStringLiteral("pattern/doublePassmark");
|
||||||
|
const QString settingLabelFont = QStringLiteral("pattern/labelFont");
|
||||||
|
|
||||||
const QString settingGeneralRecentFileList = QStringLiteral("recentFileList");
|
const QString settingGeneralRecentFileList = QStringLiteral("recentFileList");
|
||||||
const QString settingGeneralRestoreFileList = QStringLiteral("restoreFileList");
|
const QString settingGeneralRestoreFileList = QStringLiteral("restoreFileList");
|
||||||
|
@ -755,3 +757,15 @@ QChar VCommonSettings::GetDefCSVSeparator() const
|
||||||
{
|
{
|
||||||
return QChar(',');
|
return QChar(',');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QFont VCommonSettings::GetLabelFont() const
|
||||||
|
{
|
||||||
|
return qvariant_cast<QFont>(value(settingLabelFont, QApplication::font()));
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VCommonSettings::SetLabelFont(const QFont &f)
|
||||||
|
{
|
||||||
|
setValue(settingLabelFont, f);
|
||||||
|
}
|
||||||
|
|
|
@ -157,6 +157,9 @@ public:
|
||||||
QChar GetCSVSeparator() const;
|
QChar GetCSVSeparator() const;
|
||||||
QChar GetDefCSVSeparator() const;
|
QChar GetDefCSVSeparator() const;
|
||||||
|
|
||||||
|
QFont GetLabelFont() const;
|
||||||
|
void SetLabelFont(const QFont &f);
|
||||||
|
|
||||||
#if !defined(Q_OS_WIN)
|
#if !defined(Q_OS_WIN)
|
||||||
static const QString unixStandardSharePath;
|
static const QString unixStandardSharePath;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1557,7 +1557,7 @@ bool VToolSeamAllowance::PrepareLabelData(const VPatternLabelData &labelData, VT
|
||||||
}
|
}
|
||||||
labelItem->SetMoveType(type);
|
labelItem->SetMoveType(type);
|
||||||
|
|
||||||
QFont fnt = QApplication::font();
|
QFont fnt = qApp->Settings()->GetLabelFont();
|
||||||
{
|
{
|
||||||
const int iFS = labelData.GetFontSize();
|
const int iFS = labelData.GetFontSize();
|
||||||
iFS < MIN_FONT_SIZE ? fnt.setPixelSize(MIN_FONT_SIZE) : fnt.setPixelSize(iFS);
|
iFS < MIN_FONT_SIZE ? fnt.setPixelSize(MIN_FONT_SIZE) : fnt.setPixelSize(iFS);
|
||||||
|
|
|
@ -105,9 +105,9 @@ public slots:
|
||||||
virtual void UpdateAll();
|
virtual void UpdateAll();
|
||||||
virtual void retranslateUi();
|
virtual void retranslateUi();
|
||||||
void Highlight(quint32 id);
|
void Highlight(quint32 id);
|
||||||
protected slots:
|
|
||||||
void UpdateDetailLabel();
|
void UpdateDetailLabel();
|
||||||
void UpdatePatternInfo();
|
void UpdatePatternInfo();
|
||||||
|
protected slots:
|
||||||
void UpdateGrainline();
|
void UpdateGrainline();
|
||||||
void SaveMoveDetail(const QPointF &ptPos);
|
void SaveMoveDetail(const QPointF &ptPos);
|
||||||
void SaveResizeDetail(qreal dLabelW, int iFontSize);
|
void SaveResizeDetail(qreal dLabelW, int iFontSize);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user