New option Font size increment.
Add value to point size of base font. --HG-- branch : feature
This commit is contained in:
parent
0c0719114c
commit
4d58e05f3e
|
@ -222,6 +222,7 @@ struct VLabelTemplateLine
|
||||||
bool bold;
|
bool bold;
|
||||||
bool italic;
|
bool italic;
|
||||||
int alignment;
|
int alignment;
|
||||||
|
int fontSizeIncrement;
|
||||||
};
|
};
|
||||||
|
|
||||||
QT_WARNING_POP
|
QT_WARNING_POP
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
<xs:attribute name="bold" type="xs:boolean"/>
|
<xs:attribute name="bold" type="xs:boolean"/>
|
||||||
<xs:attribute name="italic" type="xs:boolean"/>
|
<xs:attribute name="italic" type="xs:boolean"/>
|
||||||
<xs:attribute name="alignment" type="alignmentType"/>
|
<xs:attribute name="alignment" type="alignmentType"/>
|
||||||
|
<xs:attribute name="sfIncrement" type="xs:unsignedInt"/>
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
</xs:sequence>
|
</xs:sequence>
|
||||||
|
|
|
@ -102,6 +102,7 @@
|
||||||
<xs:attribute name="bold" type="xs:boolean"/>
|
<xs:attribute name="bold" type="xs:boolean"/>
|
||||||
<xs:attribute name="italic" type="xs:boolean"/>
|
<xs:attribute name="italic" type="xs:boolean"/>
|
||||||
<xs:attribute name="alignment" type="alignmentType"/>
|
<xs:attribute name="alignment" type="alignmentType"/>
|
||||||
|
<xs:attribute name="sfIncrement" type="xs:unsignedInt"/>
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
</xs:sequence>
|
</xs:sequence>
|
||||||
|
|
|
@ -183,6 +183,7 @@ const QString VDomDocument::AttrText = QStringLiteral("text");
|
||||||
const QString VDomDocument::AttrBold = QStringLiteral("bold");
|
const QString VDomDocument::AttrBold = QStringLiteral("bold");
|
||||||
const QString VDomDocument::AttrItalic = QStringLiteral("italic");
|
const QString VDomDocument::AttrItalic = QStringLiteral("italic");
|
||||||
const QString VDomDocument::AttrAlignment = QStringLiteral("alignment");
|
const QString VDomDocument::AttrAlignment = QStringLiteral("alignment");
|
||||||
|
const QString VDomDocument::AttrFSIncrement = QStringLiteral("sfIncrement");
|
||||||
|
|
||||||
const QString VDomDocument::TagVersion = QStringLiteral("version");
|
const QString VDomDocument::TagVersion = QStringLiteral("version");
|
||||||
const QString VDomDocument::TagUnit = QStringLiteral("unit");
|
const QString VDomDocument::TagUnit = QStringLiteral("unit");
|
||||||
|
@ -928,6 +929,7 @@ QVector<VLabelTemplateLine> VDomDocument::GetLabelTemplate(const QDomElement &el
|
||||||
line.bold = GetParametrBool(tagLine, AttrBold, falseStr);
|
line.bold = GetParametrBool(tagLine, AttrBold, falseStr);
|
||||||
line.italic = GetParametrBool(tagLine, AttrItalic, falseStr);
|
line.italic = GetParametrBool(tagLine, AttrItalic, falseStr);
|
||||||
line.alignment = GetParametrUInt(tagLine, AttrAlignment, "0");
|
line.alignment = GetParametrUInt(tagLine, AttrAlignment, "0");
|
||||||
|
line.fontSizeIncrement = GetParametrUInt(tagLine, AttrFSIncrement, "0");
|
||||||
lines.append(line);
|
lines.append(line);
|
||||||
}
|
}
|
||||||
tagLine = tagLine.nextSiblingElement(TagLine);
|
tagLine = tagLine.nextSiblingElement(TagLine);
|
||||||
|
@ -950,6 +952,7 @@ void VDomDocument::SetLabelTemplate(QDomElement &element, const QVector<VLabelTe
|
||||||
SetAttribute(tagLine, AttrBold, lines.at(i).bold);
|
SetAttribute(tagLine, AttrBold, lines.at(i).bold);
|
||||||
SetAttribute(tagLine, AttrItalic, lines.at(i).italic);
|
SetAttribute(tagLine, AttrItalic, lines.at(i).italic);
|
||||||
SetAttribute(tagLine, AttrAlignment, lines.at(i).alignment);
|
SetAttribute(tagLine, AttrAlignment, lines.at(i).alignment);
|
||||||
|
SetAttribute(tagLine, AttrFSIncrement, lines.at(i).fontSizeIncrement);
|
||||||
|
|
||||||
element.appendChild(tagLine);
|
element.appendChild(tagLine);
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,6 +87,7 @@ public:
|
||||||
static const QString AttrBold;
|
static const QString AttrBold;
|
||||||
static const QString AttrItalic;
|
static const QString AttrItalic;
|
||||||
static const QString AttrAlignment;
|
static const QString AttrAlignment;
|
||||||
|
static const QString AttrFSIncrement;
|
||||||
|
|
||||||
static const QString TagVersion;
|
static const QString TagVersion;
|
||||||
static const QString TagUnit;
|
static const QString TagUnit;
|
||||||
|
|
|
@ -122,7 +122,7 @@ QList<TextLine> PrepareLines(const QVector<VLabelTemplateLine> &lines)
|
||||||
TextLine tl;
|
TextLine tl;
|
||||||
tl.m_qsText = lines.at(i).line;
|
tl.m_qsText = lines.at(i).line;
|
||||||
tl.m_eAlign = static_cast<Qt::Alignment>(lines.at(i).alignment);
|
tl.m_eAlign = static_cast<Qt::Alignment>(lines.at(i).alignment);
|
||||||
tl.m_iFontSize = 0;
|
tl.m_iFontSize = lines.at(i).fontSizeIncrement;
|
||||||
tl.bold = lines.at(i).bold;
|
tl.bold = lines.at(i).bold;
|
||||||
tl.italic = lines.at(i).italic;
|
tl.italic = lines.at(i).italic;
|
||||||
|
|
||||||
|
|
|
@ -66,6 +66,8 @@ DialogEditLabel::DialogEditLabel(VAbstractPattern *doc, QWidget *parent)
|
||||||
connect(ui->toolButtonNewLabel, &QToolButton::clicked, this, &DialogEditLabel::NewTemplate);
|
connect(ui->toolButtonNewLabel, &QToolButton::clicked, this, &DialogEditLabel::NewTemplate);
|
||||||
connect(ui->toolButtonExportLabel, &QToolButton::clicked, this, &DialogEditLabel::ExportTemplate);
|
connect(ui->toolButtonExportLabel, &QToolButton::clicked, this, &DialogEditLabel::ExportTemplate);
|
||||||
connect(ui->toolButtonImportLabel, &QToolButton::clicked, this, &DialogEditLabel::ImportTemplate);
|
connect(ui->toolButtonImportLabel, &QToolButton::clicked, this, &DialogEditLabel::ImportTemplate);
|
||||||
|
connect(ui->spinBoxFontSize, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this,
|
||||||
|
&DialogEditLabel::SaveAdditionalFontSize);
|
||||||
|
|
||||||
InitPlaceholders();
|
InitPlaceholders();
|
||||||
InitPlaceholdersMenu();
|
InitPlaceholdersMenu();
|
||||||
|
@ -129,6 +131,10 @@ void DialogEditLabel::ShowLineDetails()
|
||||||
ui->toolButtonTextLeft->blockSignals(false);
|
ui->toolButtonTextLeft->blockSignals(false);
|
||||||
ui->toolButtonTextCenter->blockSignals(false);
|
ui->toolButtonTextCenter->blockSignals(false);
|
||||||
ui->toolButtonTextRight->blockSignals(false);
|
ui->toolButtonTextRight->blockSignals(false);
|
||||||
|
|
||||||
|
ui->spinBoxFontSize->blockSignals(true);
|
||||||
|
ui->spinBoxFontSize->setValue(line->data(Qt::UserRole).toInt());
|
||||||
|
ui->spinBoxFontSize->blockSignals(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -397,6 +403,19 @@ void DialogEditLabel::TabChanged(int index)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogEditLabel::SaveAdditionalFontSize(int i)
|
||||||
|
{
|
||||||
|
QListWidgetItem *curLine = ui->listWidgetEdit->currentItem();
|
||||||
|
if (curLine)
|
||||||
|
{
|
||||||
|
QFont lineFont = curLine->font();
|
||||||
|
lineFont.setPointSize(lineFont.pointSize() - curLine->data(Qt::UserRole).toInt() + i);
|
||||||
|
curLine->setFont(lineFont);
|
||||||
|
curLine->setData(Qt::UserRole, i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogEditLabel::SetupControls()
|
void DialogEditLabel::SetupControls()
|
||||||
{
|
{
|
||||||
|
@ -422,6 +441,7 @@ void DialogEditLabel::SetupControls()
|
||||||
ui->toolButtonNewLabel->setEnabled(enabled);
|
ui->toolButtonNewLabel->setEnabled(enabled);
|
||||||
ui->toolButtonExportLabel->setEnabled(enabled);
|
ui->toolButtonExportLabel->setEnabled(enabled);
|
||||||
ui->lineEditLine->setEnabled(enabled);
|
ui->lineEditLine->setEnabled(enabled);
|
||||||
|
ui->spinBoxFontSize->setEnabled(enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -503,6 +523,7 @@ QVector<VLabelTemplateLine> DialogEditLabel::GetTemplate() const
|
||||||
VLabelTemplateLine line;
|
VLabelTemplateLine line;
|
||||||
line.line = qApp->TrVars()->PlaceholderFromUserText(lineItem->text());
|
line.line = qApp->TrVars()->PlaceholderFromUserText(lineItem->text());
|
||||||
line.alignment = lineItem->textAlignment();
|
line.alignment = lineItem->textAlignment();
|
||||||
|
line.fontSizeIncrement = lineItem->data(Qt::UserRole).toInt();
|
||||||
|
|
||||||
const QFont font = lineItem->font();
|
const QFont font = lineItem->font();
|
||||||
line.bold = font.bold();
|
line.bold = font.bold();
|
||||||
|
@ -527,10 +548,12 @@ void DialogEditLabel::SetTemplate(const QVector<VLabelTemplateLine> &lines)
|
||||||
{
|
{
|
||||||
QListWidgetItem *item = new QListWidgetItem(qApp->TrVars()->PlaceholderToUserText(lines.at(i).line));
|
QListWidgetItem *item = new QListWidgetItem(qApp->TrVars()->PlaceholderToUserText(lines.at(i).line));
|
||||||
item->setTextAlignment(lines.at(i).alignment);
|
item->setTextAlignment(lines.at(i).alignment);
|
||||||
|
item->setData(Qt::UserRole, lines.at(i).fontSizeIncrement);
|
||||||
|
|
||||||
QFont font = item->font();
|
QFont font = item->font();
|
||||||
font.setBold(lines.at(i).bold);
|
font.setBold(lines.at(i).bold);
|
||||||
font.setItalic(lines.at(i).italic);
|
font.setItalic(lines.at(i).italic);
|
||||||
|
font.setPointSize(font.pointSize() + lines.at(i).fontSizeIncrement);
|
||||||
item->setFont(font);
|
item->setFont(font);
|
||||||
|
|
||||||
ui->listWidgetEdit->insertItem(++row, item);
|
ui->listWidgetEdit->insertItem(++row, item);
|
||||||
|
@ -555,10 +578,12 @@ void DialogEditLabel::InitPreviewLines(const QVector<VLabelTemplateLine> &lines)
|
||||||
{
|
{
|
||||||
QListWidgetItem *item = new QListWidgetItem(ReplacePlaceholders(lines.at(i).line));
|
QListWidgetItem *item = new QListWidgetItem(ReplacePlaceholders(lines.at(i).line));
|
||||||
item->setTextAlignment(lines.at(i).alignment);
|
item->setTextAlignment(lines.at(i).alignment);
|
||||||
|
item->setData(Qt::UserRole, lines.at(i).fontSizeIncrement);
|
||||||
|
|
||||||
QFont font = item->font();
|
QFont font = item->font();
|
||||||
font.setBold(lines.at(i).bold);
|
font.setBold(lines.at(i).bold);
|
||||||
font.setItalic(lines.at(i).italic);
|
font.setItalic(lines.at(i).italic);
|
||||||
|
font.setPointSize(font.pointSize() + lines.at(i).fontSizeIncrement);
|
||||||
item->setFont(font);
|
item->setFont(font);
|
||||||
|
|
||||||
ui->listWidgetPreview->insertItem(++row, item);
|
ui->listWidgetPreview->insertItem(++row, item);
|
||||||
|
|
|
@ -64,6 +64,7 @@ private slots:
|
||||||
void ImportTemplate();
|
void ImportTemplate();
|
||||||
void InsertPlaceholder();
|
void InsertPlaceholder();
|
||||||
void TabChanged(int index);
|
void TabChanged(int index);
|
||||||
|
void SaveAdditionalFontSize(int i);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(DialogEditLabel)
|
Q_DISABLE_COPY(DialogEditLabel)
|
||||||
|
|
|
@ -237,6 +237,19 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSpinBox" name="spinBoxFontSize">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Additional font size. Use to make a line bigger.</string>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>25</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer_5">
|
<spacer name="horizontalSpacer_5">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
|
Loading…
Reference in New Issue
Block a user