0
0
mirror of https://github.com/fralx/LimeReport.git synced 2025-11-25 08:28:06 +03:00

Define code style and format all source file using clang-format-14

except those placed in 3rdparty directories.
This commit is contained in:
Андрей Лухнов
2024-09-04 17:31:16 +03:00
parent c5b9ac265d
commit 0fca7169d3
285 changed files with 19120 additions and 17875 deletions

View File

@@ -29,10 +29,11 @@
****************************************************************************/
#include "lrfonteditorwidget.h"
namespace LimeReport{
namespace LimeReport {
FontEditorWidget::FontEditorWidget(const QString& title, QWidget* parent)
:ItemEditorWidget(title, parent), m_ignoreSlots(false)
FontEditorWidget::FontEditorWidget(const QString& title, QWidget* parent):
ItemEditorWidget(title, parent),
m_ignoreSlots(false)
{
initEditor();
}
@@ -40,91 +41,107 @@ FontEditorWidget::FontEditorWidget(const QString& title, QWidget* parent)
void FontEditorWidget::setItemEvent(BaseDesignIntf* item)
{
QVariant font=item->property("font");
if (font.isValid()){
QVariant font = item->property("font");
if (font.isValid()) {
updateValues(font.value<QFont>());
setEnabled(true);
}
}
void FontEditorWidget::initEditor()
{
setIconSize(QSize(24,24));
setIconSize(QSize(24, 24));
setAllowedAreas(Qt::TopToolBarArea);
setFloatable(false);
m_fontNameEditor = new QFontComboBox(this);
m_fontNameEditor->setFontFilters(QFontComboBox::AllFonts);
connect(m_fontNameEditor,SIGNAL(currentFontChanged(QFont)),this,SLOT(slotFontChanged(QFont)));
connect(m_fontNameEditor, SIGNAL(currentFontChanged(QFont)), this,
SLOT(slotFontChanged(QFont)));
addWidget(m_fontNameEditor);
m_fontSizeModel.setStringList(QStringList()<<"6"<<"7"<<"8"<<"9"<<"10"<<"11"<<"12"<<"14"<<"16"<<"18"<<"20"<<"24"<<"28"<<"30"<<"36"<<"48"<<"64"<<"72");
m_fontSizeModel.setStringList(QStringList() << "6"
<< "7"
<< "8"
<< "9"
<< "10"
<< "11"
<< "12"
<< "14"
<< "16"
<< "18"
<< "20"
<< "24"
<< "28"
<< "30"
<< "36"
<< "48"
<< "64"
<< "72");
m_fontSizeEditor = new QComboBox(this);
m_fontSizeEditor->setModel(&m_fontSizeModel);
m_fontSizeEditor->setEditable(true);
#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 3)
connect(m_fontSizeEditor,SIGNAL(currentTextChanged(QString)),this,SLOT(slotFontSizeChanged(QString)));
connect(m_fontSizeEditor, SIGNAL(currentTextChanged(QString)), this,
SLOT(slotFontSizeChanged(QString)));
#else
connect(m_fontSizeEditor,SIGNAL(currentIndexChanged(QString)),this,SLOT(slotFontSizeChanged(QString)));
connect(m_fontSizeEditor, SIGNAL(currentIndexChanged(QString)), this,
SLOT(slotFontSizeChanged(QString)));
#endif
addWidget(m_fontSizeEditor);
addSeparator();
setEnabled(false);
m_fontBold = new QAction(tr("Font bold"),this);
m_fontBold = new QAction(tr("Font bold"), this);
m_fontBold->setIcon(QIcon(":/report/images/textBold"));
m_fontBold->setCheckable(true);
connect(m_fontBold,SIGNAL(toggled(bool)),this,SLOT(slotFontAttribsChanged(bool)));
connect(m_fontBold, SIGNAL(toggled(bool)), this, SLOT(slotFontAttribsChanged(bool)));
addAction(m_fontBold);
m_fontItalic = new QAction(tr("Font Italic"),this);
m_fontItalic = new QAction(tr("Font Italic"), this);
m_fontItalic->setIcon(QIcon(":/report/images/textItalic"));
m_fontItalic->setCheckable(true);
connect(m_fontItalic,SIGNAL(toggled(bool)),this,SLOT(slotFontAttribsChanged(bool)));
connect(m_fontItalic, SIGNAL(toggled(bool)), this, SLOT(slotFontAttribsChanged(bool)));
addAction(m_fontItalic);
m_fontUnderline = new QAction(tr("Font Underline"),this);
m_fontUnderline = new QAction(tr("Font Underline"), this);
m_fontUnderline->setIcon(QIcon(":/report/images/textUnderline"));
m_fontUnderline->setCheckable(true);
connect(m_fontUnderline,SIGNAL(toggled(bool)),this,SLOT(slotFontAttribsChanged(bool)));
connect(m_fontUnderline, SIGNAL(toggled(bool)), this, SLOT(slotFontAttribsChanged(bool)));
addAction(m_fontUnderline);
}
void FontEditorWidget::updateValues(const QFont& font)
{
m_ignoreSlots=true;
m_ignoreSlots = true;
m_fontNameEditor->setCurrentFont(font);
m_fontSizeEditor->setEditText(QString::number(font.pointSize()));
m_fontBold->setChecked(font.bold());
m_fontItalic->setChecked(font.italic());
m_fontUnderline->setChecked(font.underline());
m_ignoreSlots=false;
}
bool FontEditorWidget::ignoreSlots() const
{
return m_ignoreSlots;
m_ignoreSlots = false;
}
bool FontEditorWidget::ignoreSlots() const { return m_ignoreSlots; }
void FontEditorWidget::slotFontChanged(const QFont& /*font*/)
{
//if (page()) page()->setFont(font);
// if (page()) page()->setFont(font);
}
void FontEditorWidget::slotFontSizeChanged(const QString &value)
void FontEditorWidget::slotFontSizeChanged(const QString& value)
{
if (m_ignoreSlots) return;
if (m_ignoreSlots)
return;
m_resFont = fontNameEditor()->currentFont();
m_resFont.setPointSize(value.toInt());
}
void FontEditorWidget::slotFontAttribsChanged(bool)
{
if (m_ignoreSlots) return;
if (m_ignoreSlots)
return;
m_resFont = m_fontNameEditor->currentFont();
m_resFont.setPointSize(m_fontSizeEditor->currentText().toInt());
m_resFont.setBold(m_fontBold->isChecked());
@@ -132,16 +149,16 @@ void FontEditorWidget::slotFontAttribsChanged(bool)
m_resFont.setUnderline(m_fontUnderline->isChecked());
}
void FontEditorWidget::slotPropertyChanged(const QString &objectName, const QString &property, const QVariant& oldValue, const QVariant& newValue)
void FontEditorWidget::slotPropertyChanged(const QString& objectName, const QString& property,
const QVariant& oldValue, const QVariant& newValue)
{
Q_UNUSED(oldValue)
Q_UNUSED(newValue)
if (item()&&(item()->objectName()==objectName)&&(property=="font")){
if (item() && (item()->objectName() == objectName) && (property == "font")) {
updateValues(item()->property("font").value<QFont>());
}
}
void FontEditorWidgetForPage::slotFontChanged(const QFont& font)
{
if (!ignoreSlots())
@@ -150,7 +167,7 @@ void FontEditorWidgetForPage::slotFontChanged(const QFont& font)
void FontEditorWidgetForPage::slotFontSizeChanged(const QString& value)
{
if (!ignoreSlots()){
if (!ignoreSlots()) {
FontEditorWidget::slotFontSizeChanged(value);
m_page->setFont(resFont());
}
@@ -158,7 +175,7 @@ void FontEditorWidgetForPage::slotFontSizeChanged(const QString& value)
void FontEditorWidgetForPage::slotFontAttribsChanged(bool value)
{
if (!ignoreSlots()){
if (!ignoreSlots()) {
FontEditorWidget::slotFontAttribsChanged(value);
m_page->setFont(resFont());
}
@@ -167,18 +184,19 @@ void FontEditorWidgetForPage::slotFontAttribsChanged(bool value)
#ifdef HAVE_REPORT_DESIGNER
void FontEditorWidgetForDesigner::initEditor()
{
connect(m_reportEditor,SIGNAL(itemPropertyChanged(QString,QString,QVariant,QVariant)),
this,SLOT(slotPropertyChanged(QString,QString,QVariant,QVariant)));
connect(m_reportEditor, SIGNAL(itemPropertyChanged(QString, QString, QVariant, QVariant)), this,
SLOT(slotPropertyChanged(QString, QString, QVariant, QVariant)));
}
void FontEditorWidgetForDesigner::slotFontChanged(const QFont& font)
{
if (!ignoreSlots()) m_reportEditor->setFont(font);
if (!ignoreSlots())
m_reportEditor->setFont(font);
}
void FontEditorWidgetForDesigner::slotFontSizeChanged(const QString& value)
{
if (!ignoreSlots()){
if (!ignoreSlots()) {
FontEditorWidget::slotFontSizeChanged(value);
m_reportEditor->setFont(resFont());
}
@@ -186,7 +204,7 @@ void FontEditorWidgetForDesigner::slotFontSizeChanged(const QString& value)
void FontEditorWidgetForDesigner::slotFontAttribsChanged(bool value)
{
if (!ignoreSlots()){
if (!ignoreSlots()) {
FontEditorWidget::slotFontAttribsChanged(value);
m_reportEditor->setFont(resFont());
}
@@ -194,5 +212,4 @@ void FontEditorWidgetForDesigner::slotFontAttribsChanged(bool value)
#endif
} //namespace LimeReport
} // namespace LimeReport