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,17 +29,19 @@
****************************************************************************/
#include "lrtextalignmenteditorwidget.h"
namespace LimeReport{
TextAlignmentEditorWidget::TextAlignmentEditorWidget(const QString& title, QWidget* parent)
:ItemEditorWidget(title, parent), m_textAttibutesIsChanging(false), m_flag(0)
namespace LimeReport {
TextAlignmentEditorWidget::TextAlignmentEditorWidget(const QString& title, QWidget* parent):
ItemEditorWidget(title, parent),
m_textAttibutesIsChanging(false),
m_flag(0)
{
initEditor();
}
void TextAlignmentEditorWidget::setItemEvent(BaseDesignIntf *item)
void TextAlignmentEditorWidget::setItemEvent(BaseDesignIntf* item)
{
QVariant align=item->property("alignment");
if (align.isValid()){
QVariant align = item->property("alignment");
if (align.isValid()) {
updateValues(Qt::Alignment(align.value<int>()));
setEnabled(true);
}
@@ -47,178 +49,197 @@ void TextAlignmentEditorWidget::setItemEvent(BaseDesignIntf *item)
void TextAlignmentEditorWidget::initEditor()
{
m_textAliginLeft = new QAction(tr("Text align left"),this);
m_textAliginLeft = new QAction(tr("Text align left"), this);
m_textAliginLeft->setIcon(QIcon(":/report/images/textAlignHLeft"));
m_textAliginLeft->setCheckable(true);
connect(m_textAliginLeft,SIGNAL(toggled(bool)),this,SLOT(slotTextHAttribsChanged(bool)));
connect(m_textAliginLeft, SIGNAL(toggled(bool)), this, SLOT(slotTextHAttribsChanged(bool)));
addAction(m_textAliginLeft);
m_textAliginHCenter = new QAction(tr("Text align center"),this);
m_textAliginHCenter = new QAction(tr("Text align center"), this);
m_textAliginHCenter->setIcon(QIcon(":/report/images/textAlignHCenter"));
m_textAliginHCenter->setCheckable(true);
connect(m_textAliginHCenter,SIGNAL(toggled(bool)),this,SLOT(slotTextHAttribsChanged(bool)));
connect(m_textAliginHCenter, SIGNAL(toggled(bool)), this, SLOT(slotTextHAttribsChanged(bool)));
addAction(m_textAliginHCenter);
m_textAliginRight = new QAction(tr("Text align right"),this);
m_textAliginRight = new QAction(tr("Text align right"), this);
m_textAliginRight->setIcon(QIcon(":/report/images/textAlignHRight"));
m_textAliginRight->setCheckable(true);
connect(m_textAliginRight,SIGNAL(toggled(bool)),this,SLOT(slotTextHAttribsChanged(bool)));
connect(m_textAliginRight, SIGNAL(toggled(bool)), this, SLOT(slotTextHAttribsChanged(bool)));
addAction(m_textAliginRight);
m_textAliginJustify = new QAction(tr("Text align justify"),this);
m_textAliginJustify = new QAction(tr("Text align justify"), this);
m_textAliginJustify->setIcon(QIcon(":/report/images/textAlignHJustify"));
m_textAliginJustify->setCheckable(true);
connect(m_textAliginJustify,SIGNAL(toggled(bool)),this,SLOT(slotTextHAttribsChanged(bool)));
connect(m_textAliginJustify, SIGNAL(toggled(bool)), this, SLOT(slotTextHAttribsChanged(bool)));
addAction(m_textAliginJustify);
addSeparator();
m_textAliginTop = new QAction(tr("Text align top"),this);
m_textAliginTop = new QAction(tr("Text align top"), this);
m_textAliginTop->setIcon(QIcon(":/report/images/textAlignVTop"));
m_textAliginTop->setCheckable(true);
connect(m_textAliginTop,SIGNAL(toggled(bool)),this,SLOT(slotTextVAttribsChanged(bool)));
connect(m_textAliginTop, SIGNAL(toggled(bool)), this, SLOT(slotTextVAttribsChanged(bool)));
addAction(m_textAliginTop);
m_textAliginVCenter = new QAction(tr("Text align center"),this);
m_textAliginVCenter = new QAction(tr("Text align center"), this);
m_textAliginVCenter->setIcon(QIcon(":/report/images/textAlignVCenter"));
m_textAliginVCenter->setCheckable(true);
connect(m_textAliginVCenter,SIGNAL(toggled(bool)),this,SLOT(slotTextVAttribsChanged(bool)));
connect(m_textAliginVCenter, SIGNAL(toggled(bool)), this, SLOT(slotTextVAttribsChanged(bool)));
addAction(m_textAliginVCenter);
m_textAliginBottom = new QAction(tr("Text align bottom"),this);
m_textAliginBottom = new QAction(tr("Text align bottom"), this);
m_textAliginBottom->setIcon(QIcon(":/report/images/textAlignVBottom"));
m_textAliginBottom->setCheckable(true);
connect(m_textAliginBottom,SIGNAL(toggled(bool)),this,SLOT(slotTextVAttribsChanged(bool)));
connect(m_textAliginBottom, SIGNAL(toggled(bool)), this, SLOT(slotTextVAttribsChanged(bool)));
addAction(m_textAliginBottom);
setEnabled(false);
}
void TextAlignmentEditorWidget::updateValues(const Qt::Alignment &align)
void TextAlignmentEditorWidget::updateValues(const Qt::Alignment& align)
{
m_textAttibutesIsChanging=true;
m_textAliginLeft->setChecked((align & Qt::AlignLeft)==Qt::AlignLeft);
m_textAliginRight->setChecked((align & Qt::AlignRight)==Qt::AlignRight);
m_textAliginHCenter->setChecked((align & Qt::AlignHCenter)==Qt::AlignHCenter);
m_textAliginJustify->setChecked((align & Qt::AlignJustify)==Qt::AlignJustify);
m_textAliginTop->setChecked((align & Qt::AlignTop)==Qt::AlignTop);
m_textAliginVCenter->setChecked((align & Qt::AlignVCenter)==Qt::AlignVCenter);
m_textAliginBottom->setChecked((align & Qt::AlignBottom)==Qt::AlignBottom);
m_textAttibutesIsChanging=false;
m_textAttibutesIsChanging = true;
m_textAliginLeft->setChecked((align & Qt::AlignLeft) == Qt::AlignLeft);
m_textAliginRight->setChecked((align & Qt::AlignRight) == Qt::AlignRight);
m_textAliginHCenter->setChecked((align & Qt::AlignHCenter) == Qt::AlignHCenter);
m_textAliginJustify->setChecked((align & Qt::AlignJustify) == Qt::AlignJustify);
m_textAliginTop->setChecked((align & Qt::AlignTop) == Qt::AlignTop);
m_textAliginVCenter->setChecked((align & Qt::AlignVCenter) == Qt::AlignVCenter);
m_textAliginBottom->setChecked((align & Qt::AlignBottom) == Qt::AlignBottom);
m_textAttibutesIsChanging = false;
}
Qt::Alignment TextAlignmentEditorWidget::createAlignment()
{
Qt::Alignment align = Qt::Alignment();
if (m_textAliginLeft->isChecked()) align |= Qt::AlignLeft;
if (m_textAliginHCenter->isChecked()) align |= Qt::AlignHCenter;
if (m_textAliginRight->isChecked()) align |= Qt::AlignRight;
if (m_textAliginJustify->isChecked()) align |= Qt::AlignJustify;
if (m_textAliginTop->isChecked()) align |= Qt::AlignTop;
if (m_textAliginVCenter->isChecked()) align |= Qt::AlignVCenter;
if (m_textAliginBottom->isChecked()) align |= Qt::AlignBottom;
if (m_textAliginLeft->isChecked())
align |= Qt::AlignLeft;
if (m_textAliginHCenter->isChecked())
align |= Qt::AlignHCenter;
if (m_textAliginRight->isChecked())
align |= Qt::AlignRight;
if (m_textAliginJustify->isChecked())
align |= Qt::AlignJustify;
if (m_textAliginTop->isChecked())
align |= Qt::AlignTop;
if (m_textAliginVCenter->isChecked())
align |= Qt::AlignVCenter;
if (m_textAliginBottom->isChecked())
align |= Qt::AlignBottom;
return align;
}
void TextAlignmentEditorWidget::slotTextHAttribsChanged(bool)
{
if (m_textAttibutesIsChanging) return;
if (m_textAttibutesIsChanging)
return;
m_textAttibutesIsChanging = true;
m_textAliginLeft->setChecked(sender()==m_textAliginLeft);
m_textAliginHCenter->setChecked(sender()==m_textAliginHCenter);
m_textAliginRight->setChecked(sender()==m_textAliginRight);
m_textAliginJustify->setChecked(sender()==m_textAliginJustify);
m_textAliginLeft->setChecked(sender() == m_textAliginLeft);
m_textAliginHCenter->setChecked(sender() == m_textAliginHCenter);
m_textAliginRight->setChecked(sender() == m_textAliginRight);
m_textAliginJustify->setChecked(sender() == m_textAliginJustify);
m_flag = 0;
if (sender()==m_textAliginLeft) m_flag |= Qt::AlignLeft;
if (sender()==m_textAliginHCenter) m_flag |= Qt::AlignHCenter;
if (sender()==m_textAliginRight) m_flag |= Qt::AlignRight;
if (sender()==m_textAliginJustify) m_flag |= Qt::AlignJustify;
if (sender() == m_textAliginLeft)
m_flag |= Qt::AlignLeft;
if (sender() == m_textAliginHCenter)
m_flag |= Qt::AlignHCenter;
if (sender() == m_textAliginRight)
m_flag |= Qt::AlignRight;
if (sender() == m_textAliginJustify)
m_flag |= Qt::AlignJustify;
m_textAttibutesIsChanging = false;
}
void TextAlignmentEditorWidget::slotTextVAttribsChanged(bool)
{
if (m_textAttibutesIsChanging) return;
if (m_textAttibutesIsChanging)
return;
m_textAttibutesIsChanging = true;
m_textAliginTop->setChecked(sender()==m_textAliginTop);
m_textAliginVCenter->setChecked(sender()==m_textAliginVCenter);
m_textAliginBottom->setChecked(sender()==m_textAliginBottom);
m_textAliginTop->setChecked(sender() == m_textAliginTop);
m_textAliginVCenter->setChecked(sender() == m_textAliginVCenter);
m_textAliginBottom->setChecked(sender() == m_textAliginBottom);
m_flag = 0;
if (sender()==m_textAliginTop) m_flag |= Qt::AlignTop;
if (sender()==m_textAliginVCenter) m_flag |= Qt::AlignVCenter;
if (sender()==m_textAliginBottom) m_flag |= Qt::AlignBottom;
if (sender() == m_textAliginTop)
m_flag |= Qt::AlignTop;
if (sender() == m_textAliginVCenter)
m_flag |= Qt::AlignVCenter;
if (sender() == m_textAliginBottom)
m_flag |= Qt::AlignBottom;
m_textAttibutesIsChanging = false;
}
void TextAlignmentEditorWidget::slotPropertyChanged(const QString &objectName, const QString &property, const QVariant &oldValue, const QVariant &newValue)
void TextAlignmentEditorWidget::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=="alignment")){
if (item() && (item()->objectName() == objectName) && (property == "alignment")) {
updateValues(Qt::Alignment(item()->property("alignment").value<int>()));
}
}
int TextAlignmentEditorWidget::flag() const
{
return m_flag;
}
int TextAlignmentEditorWidget::flag() const { return m_flag; }
void TextAlignmentEditorWidgetForPage::initEditor()
{
TextAlignmentEditorWidget::initEditor();
connect(m_page,SIGNAL(itemPropertyChanged(QString,QString,QVariant,QVariant)),
this,SLOT(slotPropertyChanged(QString,QString,QVariant,QVariant)));
connect(m_page, SIGNAL(itemPropertyChanged(QString, QString, QVariant, QVariant)), this,
SLOT(slotPropertyChanged(QString, QString, QVariant, QVariant)));
}
void TextAlignmentEditorWidgetForPage::slotTextHAttribsChanged(bool value)
{
TextAlignmentEditorWidget::slotTextHAttribsChanged(value);
if (m_textAttibutesIsChanging) return;
if (m_textAttibutesIsChanging)
return;
m_textAttibutesIsChanging = true;
m_page->changeSelectedGrpoupTextAlignPropperty(true,Qt::AlignmentFlag(flag()));
m_page->changeSelectedGrpoupTextAlignPropperty(true, Qt::AlignmentFlag(flag()));
m_textAttibutesIsChanging = false;
}
void TextAlignmentEditorWidgetForPage::slotTextVAttribsChanged(bool value)
{
TextAlignmentEditorWidget::slotTextVAttribsChanged(value);
if (m_textAttibutesIsChanging) return;
if (m_textAttibutesIsChanging)
return;
m_textAttibutesIsChanging = true;
m_page->changeSelectedGrpoupTextAlignPropperty(false,Qt::AlignmentFlag(flag()) );
m_page->changeSelectedGrpoupTextAlignPropperty(false, Qt::AlignmentFlag(flag()));
m_textAttibutesIsChanging = false;
}
#ifdef HAVE_REPORT_DESIGNER
void TextAlignmentEditorWidgetForDesigner::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 TextAlignmentEditorWidgetForDesigner::slotTextHAttribsChanged(bool value)
{
TextAlignmentEditorWidget::slotTextHAttribsChanged(value);
if (m_textAttibutesIsChanging) return;
if (m_textAttibutesIsChanging)
return;
m_textAttibutesIsChanging = true;
m_reportEditor->setTextAlign(true,Qt::AlignmentFlag(flag()));
m_reportEditor->setTextAlign(true, Qt::AlignmentFlag(flag()));
m_textAttibutesIsChanging = false;
}
void TextAlignmentEditorWidgetForDesigner::slotTextVAttribsChanged(bool value)
{
TextAlignmentEditorWidget::slotTextVAttribsChanged(value);
if (m_textAttibutesIsChanging) return;
if (m_textAttibutesIsChanging)
return;
m_textAttibutesIsChanging = true;
m_reportEditor->setTextAlign(false,Qt::AlignmentFlag(flag()));
m_reportEditor->setTextAlign(false, Qt::AlignmentFlag(flag()));
m_textAttibutesIsChanging = false;
}
#endif
} //namespace LimeReport
} // namespace LimeReport