0
0
mirror of https://github.com/fralx/LimeReport.git synced 2025-03-20 17:23:47 +03:00
LimeReport/limereport/objectinspector/propertyItems/lrcontentpropitem.cpp
Андрей Лухнов 0fca7169d3 Define code style and format all source file using clang-format-14
except those placed in 3rdparty directories.
2024-09-19 21:09:38 +03:00

48 lines
1.8 KiB
C++

#include "lrcontentpropitem.h"
#include "editors/lrbuttonlineeditor.h"
#include "items/lrtextitemeditor.h"
#include "lrtextitem.h"
#include <QApplication>
namespace {
LimeReport::ObjectPropItem* createContentPropItem(QObject* object,
LimeReport::ObjectPropItem::ObjectsList* objects,
const QString& name, const QString& displayName,
const QVariant& data,
LimeReport::ObjectPropItem* parent, bool readonly)
{
return new LimeReport::ContentPropItem(object, objects, name, displayName, data, parent,
readonly);
}
bool VARIABLE_IS_NOT_USED registredContentProp
= LimeReport::ObjectPropFactory::instance().registerCreator(
LimeReport::APropIdent("content", "LimeReport::TextItem"), QObject::tr("content"),
createContentPropItem);
} // namespace
namespace LimeReport {
QWidget* ContentPropItem::createProperyEditor(QWidget* parent) const
{
return new ContentEditor(object(), object()->objectName() + "." + displayName(), parent);
}
void ContentEditor::editButtonClicked()
{
QDialog* dialog = new QDialog(QApplication::activeWindow());
dialog->setLayout(new QVBoxLayout());
dialog->layout()->setContentsMargins(1, 1, 1, 1);
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->setWindowTitle(propertyName());
QWidget* editor = dynamic_cast<BaseDesignIntf*>(m_object)->defaultEditor();
dialog->layout()->addWidget(editor);
dialog->resize(editor->size());
connect(editor, SIGNAL(destroyed()), dialog, SLOT(close()));
connect(editor, SIGNAL(destroyed()), this, SIGNAL(editingFinished()));
dialog->exec();
}
} // namespace LimeReport