0
0
mirror of https://github.com/fralx/LimeReport.git synced 2025-11-25 00:18: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

@@ -28,38 +28,46 @@
* GNU General Public License for more details. *
****************************************************************************/
#include "lrsubitemparentpropitem.h"
#include "../objectinspector/editors/lrcomboboxeditor.h"
#include "lrbasedesignintf.h"
#include "lritemdesignintf.h"
#include "lrpagedesignintf.h"
#include "lrobjectpropitem.h"
#include "lrpagedesignintf.h"
namespace {
LimeReport::ObjectPropItem*
createLocationPropItem(QObject* object, LimeReport::ObjectPropItem::ObjectsList* objects,
const QString& name, const QString& displayName, const QVariant& data,
LimeReport::ObjectPropItem* parent, bool readonly)
{
return new LimeReport::ItemLocationPropItem(object, objects, name, displayName, data, parent,
readonly);
}
bool VARIABLE_IS_NOT_USED registred = LimeReport::ObjectPropFactory::instance().registerCreator(
LimeReport::APropIdent("itemLocation", "LimeReport::ItemDesignIntf"),
QObject::tr("itemLocation"), createLocationPropItem);
} // namespace
namespace{
LimeReport::ObjectPropItem * createLocationPropItem(
QObject *object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly)
{
return new LimeReport::ItemLocationPropItem(object, objects, name, displayName, data, parent, readonly);
}
bool VARIABLE_IS_NOT_USED registred = LimeReport::ObjectPropFactory::instance().registerCreator(
LimeReport::APropIdent("itemLocation","LimeReport::ItemDesignIntf"),QObject::tr("itemLocation"),createLocationPropItem
);
LimeReport::ItemLocationPropItem::ItemLocationPropItem(QObject* object, ObjectsList* objects,
const QString& name,
const QString& displayName,
const QVariant& value,
ObjectPropItem* parent, bool readonly):
LimeReport::ObjectPropItem(object, objects, name, displayName, value, parent, readonly)
{
m_locationMap.insert(tr("Band"), LimeReport::ItemDesignIntf::Band);
m_locationMap.insert(tr("Page"), LimeReport::ItemDesignIntf::Page);
}
LimeReport::ItemLocationPropItem::ItemLocationPropItem(QObject* object, ObjectsList* objects, const QString &name, const QString &displayName, const QVariant &value, ObjectPropItem* parent, bool readonly)
:LimeReport::ObjectPropItem(object, objects, name, displayName, value, parent, readonly){
m_locationMap.insert(tr("Band"),LimeReport::ItemDesignIntf::Band);
m_locationMap.insert(tr("Page"),LimeReport::ItemDesignIntf::Page);
}
QWidget * LimeReport::ItemLocationPropItem::createProperyEditor(QWidget *parent) const{
ComboBoxEditor *editor = new ComboBoxEditor(parent);
connect(editor,SIGNAL(currentIndexChanged(QString)),this,SLOT(slotLocationChanged(QString)));
LimeReport::BaseDesignIntf *item=dynamic_cast<LimeReport::BaseDesignIntf*>(object());
if (item){
QWidget* LimeReport::ItemLocationPropItem::createProperyEditor(QWidget* parent) const
{
ComboBoxEditor* editor = new ComboBoxEditor(parent);
connect(editor, SIGNAL(currentIndexChanged(QString)), this, SLOT(slotLocationChanged(QString)));
LimeReport::BaseDesignIntf* item = dynamic_cast<LimeReport::BaseDesignIntf*>(object());
if (item) {
QStringList locationTypes;
foreach(QString location,m_locationMap.keys()){
foreach (QString location, m_locationMap.keys()) {
locationTypes.append(location);
}
editor->addItems(locationTypes);
@@ -67,31 +75,43 @@ QWidget * LimeReport::ItemLocationPropItem::createProperyEditor(QWidget *parent)
return editor;
}
QString LimeReport::ItemLocationPropItem::displayValue() const{
return locationToString(static_cast<LimeReport::ItemDesignIntf::LocationType>(propertyValue().toInt()));
QString LimeReport::ItemLocationPropItem::displayValue() const
{
return locationToString(
static_cast<LimeReport::ItemDesignIntf::LocationType>(propertyValue().toInt()));
}
void LimeReport::ItemLocationPropItem::setPropertyEditorData(QWidget *propertyEditor, const QModelIndex &) const{
ComboBoxEditor *editor=qobject_cast<ComboBoxEditor *>(propertyEditor);
void LimeReport::ItemLocationPropItem::setPropertyEditorData(QWidget* propertyEditor,
const QModelIndex&) const
{
ComboBoxEditor* editor = qobject_cast<ComboBoxEditor*>(propertyEditor);
editor->setTextValue(locationToString(propertyValue().toInt()));
}
void LimeReport::ItemLocationPropItem::setModelData(QWidget *propertyEditor, QAbstractItemModel *model, const QModelIndex &index){
void LimeReport::ItemLocationPropItem::setModelData(QWidget* propertyEditor,
QAbstractItemModel* model,
const QModelIndex& index)
{
Q_UNUSED(propertyEditor)
model->setData(index,object()->property(propertyName().toLatin1()));
model->setData(index, object()->property(propertyName().toLatin1()));
setValueToObject(propertyName(), propertyValue());
}
QString LimeReport::ItemLocationPropItem::locationToString(LimeReport::ItemDesignIntf::LocationType location) const{
QString LimeReport::ItemLocationPropItem::locationToString(
LimeReport::ItemDesignIntf::LocationType location) const
{
return m_locationMap.key(location);
}
LimeReport::ItemDesignIntf::LocationType LimeReport::ItemLocationPropItem::stringToLocation(const QString &locationName){
LimeReport::ItemDesignIntf::LocationType
LimeReport::ItemLocationPropItem::stringToLocation(const QString& locationName)
{
return m_locationMap.value(locationName);
}
void LimeReport::ItemLocationPropItem::slotLocationChanged(const QString &text){
if ( locationToString(object()->property(propertyName().toLatin1()).toInt())!=text){
object()->setProperty(propertyName().toLatin1(),stringToLocation(text));
void LimeReport::ItemLocationPropItem::slotLocationChanged(const QString& text)
{
if (locationToString(object()->property(propertyName().toLatin1()).toInt()) != text) {
object()->setProperty(propertyName().toLatin1(), stringToLocation(text));
}
}