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:
@@ -7,45 +7,59 @@
|
||||
#include <lrreportengine_p.h>
|
||||
|
||||
namespace {
|
||||
LimeReport::ObjectPropItem * createYAxisPropItem(
|
||||
QObject *object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly)
|
||||
LimeReport::ObjectPropItem* createYAxisPropItem(QObject* object,
|
||||
LimeReport::ObjectPropItem::ObjectsList* objects,
|
||||
const QString& name, const QString& displayName,
|
||||
const QVariant& data,
|
||||
LimeReport::ObjectPropItem* parent, bool readonly)
|
||||
{
|
||||
return new LimeReport::AxisPropItem(object, objects, name, displayName, data, parent, readonly, false);
|
||||
return new LimeReport::AxisPropItem(object, objects, name, displayName, data, parent, readonly,
|
||||
false);
|
||||
}
|
||||
|
||||
LimeReport::ObjectPropItem * createXAxisPropItem(
|
||||
QObject *object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly)
|
||||
LimeReport::ObjectPropItem* createXAxisPropItem(QObject* object,
|
||||
LimeReport::ObjectPropItem::ObjectsList* objects,
|
||||
const QString& name, const QString& displayName,
|
||||
const QVariant& data,
|
||||
LimeReport::ObjectPropItem* parent, bool readonly)
|
||||
{
|
||||
return new LimeReport::AxisPropItem(object, objects, name, displayName, data, parent, readonly, true);
|
||||
}
|
||||
bool VARIABLE_IS_NOT_USED registredXAxisProp = LimeReport::ObjectPropFactory::instance().registerCreator(LimeReport::APropIdent("xAxisSettings", "LimeReport::ChartItem"), QObject::tr("X axis"), createXAxisPropItem);
|
||||
bool VARIABLE_IS_NOT_USED registredYAxisProp = LimeReport::ObjectPropFactory::instance().registerCreator(LimeReport::APropIdent("yAxisSettings", "LimeReport::ChartItem"), QObject::tr("Y axis"), createYAxisPropItem);
|
||||
return new LimeReport::AxisPropItem(object, objects, name, displayName, data, parent, readonly,
|
||||
true);
|
||||
}
|
||||
bool VARIABLE_IS_NOT_USED registredXAxisProp
|
||||
= LimeReport::ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("xAxisSettings", "LimeReport::ChartItem"), QObject::tr("X axis"),
|
||||
createXAxisPropItem);
|
||||
bool VARIABLE_IS_NOT_USED registredYAxisProp
|
||||
= LimeReport::ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("yAxisSettings", "LimeReport::ChartItem"), QObject::tr("Y axis"),
|
||||
createYAxisPropItem);
|
||||
} // namespace
|
||||
|
||||
namespace LimeReport {
|
||||
|
||||
QWidget *AxisPropItem::createProperyEditor(QWidget *parent) const
|
||||
QWidget* AxisPropItem::createProperyEditor(QWidget* parent) const
|
||||
{
|
||||
return new AxisPropEditor(qobject_cast<ChartItem*>(object()), m_isXAxis, parent);
|
||||
}
|
||||
|
||||
QString AxisPropItem::displayValue() const
|
||||
{
|
||||
return QObject::tr("Axis");
|
||||
}
|
||||
QString AxisPropItem::displayValue() const { return QObject::tr("Axis"); }
|
||||
|
||||
AxisPropEditor::AxisPropEditor(ChartItem *chart, bool isXAxis, QWidget *parent)
|
||||
: QWidget(parent), m_button(new QPushButton(this)), m_chart(chart), m_isXAxis(isXAxis)
|
||||
AxisPropEditor::AxisPropEditor(ChartItem* chart, bool isXAxis, QWidget* parent):
|
||||
QWidget(parent),
|
||||
m_button(new QPushButton(this)),
|
||||
m_chart(chart),
|
||||
m_isXAxis(isXAxis)
|
||||
{
|
||||
m_button->setText("...");
|
||||
QHBoxLayout* layout = new QHBoxLayout(this);
|
||||
layout->addWidget(m_button);
|
||||
layout->setSpacing(1);
|
||||
layout->setContentsMargins(1,0,1,1);
|
||||
layout->setContentsMargins(1, 0, 1, 1);
|
||||
setLayout(layout);
|
||||
setFocusProxy(m_button);
|
||||
setAutoFillBackground(true);
|
||||
connect(m_button,SIGNAL(clicked()),this,SLOT(slotButtonClicked()));
|
||||
connect(m_button, SIGNAL(clicked()), this, SLOT(slotButtonClicked()));
|
||||
}
|
||||
|
||||
void AxisPropEditor::slotButtonClicked()
|
||||
@@ -54,4 +68,4 @@ void AxisPropEditor::slotButtonClicked()
|
||||
emit editingFinished();
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace LimeReport
|
||||
|
||||
@@ -1,37 +1,41 @@
|
||||
#ifndef AXISPROPITEM_H
|
||||
#define AXISPROPITEM_H
|
||||
|
||||
#include <QPushButton>
|
||||
#include <QHBoxLayout>
|
||||
#include <lrobjectpropitem.h>
|
||||
#include <lrchartitem.h>
|
||||
#include <QPushButton>
|
||||
|
||||
#include <lrchartitem.h>
|
||||
#include <lrobjectpropitem.h>
|
||||
|
||||
namespace LimeReport {
|
||||
|
||||
class AxisPropEditor : public QWidget
|
||||
{
|
||||
class AxisPropEditor: public QWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
AxisPropEditor(ChartItem* chart, bool isXAxis, QWidget *parent = 0);
|
||||
AxisPropEditor(ChartItem* chart, bool isXAxis, QWidget* parent = 0);
|
||||
signals:
|
||||
void editingFinished();
|
||||
private slots:
|
||||
void slotButtonClicked();
|
||||
|
||||
private:
|
||||
QPushButton* m_button;
|
||||
ChartItem* m_chart;
|
||||
bool m_isXAxis;
|
||||
};
|
||||
|
||||
class AxisPropItem: public LimeReport::ObjectPropItem
|
||||
{
|
||||
class AxisPropItem: public LimeReport::ObjectPropItem {
|
||||
Q_OBJECT
|
||||
public:
|
||||
AxisPropItem():ObjectPropItem(){}
|
||||
AxisPropItem(QObject* object, ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& value, ObjectPropItem* parent, bool readonly, bool isXAxis)
|
||||
:ObjectPropItem(object, objects, name, displayName, value, parent, readonly), m_isXAxis(isXAxis){}
|
||||
QWidget* createProperyEditor(QWidget *parent) const;
|
||||
AxisPropItem(): ObjectPropItem() { }
|
||||
AxisPropItem(QObject* object, ObjectsList* objects, const QString& name,
|
||||
const QString& displayName, const QVariant& value, ObjectPropItem* parent,
|
||||
bool readonly, bool isXAxis):
|
||||
ObjectPropItem(object, objects, name, displayName, value, parent, readonly),
|
||||
m_isXAxis(isXAxis)
|
||||
{
|
||||
}
|
||||
QWidget* createProperyEditor(QWidget* parent) const;
|
||||
QString displayValue() const;
|
||||
|
||||
private:
|
||||
|
||||
@@ -28,46 +28,53 @@
|
||||
* GNU General Public License for more details. *
|
||||
****************************************************************************/
|
||||
#include "lrboolpropitem.h"
|
||||
#include "lrobjectpropitem.h"
|
||||
#include <QPainter>
|
||||
#include <QStylePainter>
|
||||
#include <QApplication>
|
||||
#include <QBitmap>
|
||||
|
||||
#include "../editors/lrcheckboxeditor.h"
|
||||
#include "lrobjectpropitem.h"
|
||||
|
||||
namespace{
|
||||
LimeReport::ObjectPropItem * createBoolPropItem(
|
||||
QObject *object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly)
|
||||
{
|
||||
return new LimeReport::BoolPropItem(object, objects, name, displayName, data, parent, readonly);
|
||||
}
|
||||
bool VARIABLE_IS_NOT_USED registred = LimeReport::ObjectPropFactory::instance().registerCreator(LimeReport::APropIdent("bool",""),QObject::tr("bool"),createBoolPropItem);
|
||||
#include <QApplication>
|
||||
#include <QBitmap>
|
||||
#include <QPainter>
|
||||
#include <QStylePainter>
|
||||
|
||||
namespace {
|
||||
LimeReport::ObjectPropItem* createBoolPropItem(QObject* object,
|
||||
LimeReport::ObjectPropItem::ObjectsList* objects,
|
||||
const QString& name, const QString& displayName,
|
||||
const QVariant& data,
|
||||
LimeReport::ObjectPropItem* parent, bool readonly)
|
||||
{
|
||||
return new LimeReport::BoolPropItem(object, objects, name, displayName, data, parent, readonly);
|
||||
}
|
||||
bool VARIABLE_IS_NOT_USED registred = LimeReport::ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("bool", ""), QObject::tr("bool"), createBoolPropItem);
|
||||
} // namespace
|
||||
|
||||
namespace LimeReport {
|
||||
|
||||
QWidget *BoolPropItem::createProperyEditor(QWidget *parent) const
|
||||
QWidget* BoolPropItem::createProperyEditor(QWidget* parent) const
|
||||
{
|
||||
CheckBoxEditor *editor= new CheckBoxEditor(parent);
|
||||
CheckBoxEditor* editor = new CheckBoxEditor(parent);
|
||||
return editor;
|
||||
}
|
||||
|
||||
void BoolPropItem::setPropertyEditorData(QWidget *propertyEditor, const QModelIndex &) const
|
||||
void BoolPropItem::setPropertyEditorData(QWidget* propertyEditor, const QModelIndex&) const
|
||||
{
|
||||
CheckBoxEditor *editor =qobject_cast<CheckBoxEditor *>(propertyEditor);
|
||||
CheckBoxEditor* editor = qobject_cast<CheckBoxEditor*>(propertyEditor);
|
||||
editor->setEditing(true);
|
||||
editor->setChecked(propertyValue().toBool());
|
||||
editor->setEditing(false);
|
||||
}
|
||||
|
||||
void BoolPropItem::setModelData(QWidget *propertyEditor, QAbstractItemModel *model, const QModelIndex &index)
|
||||
void BoolPropItem::setModelData(QWidget* propertyEditor, QAbstractItemModel* model,
|
||||
const QModelIndex& index)
|
||||
{
|
||||
model->setData(index,qobject_cast<CheckBoxEditor*>(propertyEditor)->isChecked());
|
||||
setValueToObject(propertyName(),propertyValue());
|
||||
model->setData(index, qobject_cast<CheckBoxEditor*>(propertyEditor)->isChecked());
|
||||
setValueToObject(propertyName(), propertyValue());
|
||||
}
|
||||
|
||||
QPixmap BoolPropItem::getIndicatorImage(const StyleOptionViewItem &option){
|
||||
QPixmap BoolPropItem::getIndicatorImage(const StyleOptionViewItem& option)
|
||||
{
|
||||
QStyleOptionButton so;
|
||||
so.state = option.state;
|
||||
if (!isValueReadonly())
|
||||
@@ -75,34 +82,35 @@ QPixmap BoolPropItem::getIndicatorImage(const StyleOptionViewItem &option){
|
||||
else
|
||||
so.state &= ~QStyle::State_Enabled;
|
||||
so.state |= propertyValue().toBool() ? QStyle::State_On : QStyle::State_Off;
|
||||
so.rect = QRect(0,0,
|
||||
QApplication::style()->pixelMetric(QStyle::PM_IndicatorWidth),
|
||||
so.rect = QRect(0, 0, QApplication::style()->pixelMetric(QStyle::PM_IndicatorWidth),
|
||||
QApplication::style()->pixelMetric(QStyle::PM_IndicatorHeight));
|
||||
|
||||
QPixmap pixmap(so.rect.width(),so.rect.height());
|
||||
QPixmap pixmap(so.rect.width(), so.rect.height());
|
||||
pixmap.fill(Qt::transparent);
|
||||
QPainter p(&pixmap);
|
||||
option.widget->style()->drawPrimitive(QStyle::PE_IndicatorItemViewItemCheck,&so, &p);
|
||||
option.widget->style()->drawPrimitive(QStyle::PE_IndicatorItemViewItemCheck, &so, &p);
|
||||
return pixmap;
|
||||
}
|
||||
|
||||
bool BoolPropItem::paint(QPainter *painter, const StyleOptionViewItem &option, const QModelIndex &index)
|
||||
bool BoolPropItem::paint(QPainter* painter, const StyleOptionViewItem& option,
|
||||
const QModelIndex& index)
|
||||
{
|
||||
|
||||
QStyle* style = option.widget ? option.widget->style() : QApplication::style();
|
||||
|
||||
if (index.column()==1){
|
||||
int border = (option.rect.height() - style->pixelMetric(QStyle::PM_IndicatorWidth))/2;
|
||||
// QStyleOptionButton so;
|
||||
// so.rect = option.rect.adjusted(border,border,0,-border);
|
||||
// so.rect.setWidth(style->pixelMetric(QStyle::PM_IndicatorWidth));
|
||||
// so.rect.setHeight(style->pixelMetric(QStyle::PM_IndicatorHeight));
|
||||
// so.state |= propertyValue().toBool() ? QStyle::State_On : QStyle::State_Off;
|
||||
// style->drawPrimitive(QStyle::PE_IndicatorItemViewItemCheck,&so,painter);
|
||||
painter->drawPixmap(option.rect.x()+border,option.rect.y()+border, getIndicatorImage(option));
|
||||
if (index.column() == 1) {
|
||||
int border = (option.rect.height() - style->pixelMetric(QStyle::PM_IndicatorWidth)) / 2;
|
||||
// QStyleOptionButton so;
|
||||
// so.rect = option.rect.adjusted(border,border,0,-border);
|
||||
// so.rect.setWidth(style->pixelMetric(QStyle::PM_IndicatorWidth));
|
||||
// so.rect.setHeight(style->pixelMetric(QStyle::PM_IndicatorHeight));
|
||||
// so.state |= propertyValue().toBool() ? QStyle::State_On : QStyle::State_Off;
|
||||
// style->drawPrimitive(QStyle::PE_IndicatorItemViewItemCheck,&so,painter);
|
||||
painter->drawPixmap(option.rect.x() + border, option.rect.y() + border,
|
||||
getIndicatorImage(option));
|
||||
return true;
|
||||
} else return false;
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace LimeReport
|
||||
|
||||
|
||||
@@ -33,20 +33,25 @@
|
||||
#include "lrobjectpropitem.h"
|
||||
|
||||
namespace LimeReport {
|
||||
class BoolPropItem : public ObjectPropItem
|
||||
{
|
||||
class BoolPropItem: public ObjectPropItem {
|
||||
Q_OBJECT
|
||||
public:
|
||||
BoolPropItem():ObjectPropItem(){}
|
||||
BoolPropItem(QObject* object, ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& value, ObjectPropItem* parent, bool readonly)
|
||||
:ObjectPropItem(object, objects, name, displayName, value, parent, readonly){}
|
||||
virtual QString displayValue() const {return "";}
|
||||
virtual QWidget* createProperyEditor(QWidget *parent) const;
|
||||
virtual void setPropertyEditorData(QWidget * propertyEditor, const QModelIndex &) const;
|
||||
virtual void setModelData(QWidget * propertyEditor, QAbstractItemModel * model, const QModelIndex & index);
|
||||
bool paint(QPainter *painter, const StyleOptionViewItem &option, const QModelIndex &index);
|
||||
BoolPropItem(): ObjectPropItem() { }
|
||||
BoolPropItem(QObject* object, ObjectsList* objects, const QString& name,
|
||||
const QString& displayName, const QVariant& value, ObjectPropItem* parent,
|
||||
bool readonly):
|
||||
ObjectPropItem(object, objects, name, displayName, value, parent, readonly)
|
||||
{
|
||||
}
|
||||
virtual QString displayValue() const { return ""; }
|
||||
virtual QWidget* createProperyEditor(QWidget* parent) const;
|
||||
virtual void setPropertyEditorData(QWidget* propertyEditor, const QModelIndex&) const;
|
||||
virtual void setModelData(QWidget* propertyEditor, QAbstractItemModel* model,
|
||||
const QModelIndex& index);
|
||||
bool paint(QPainter* painter, const StyleOptionViewItem& option, const QModelIndex& index);
|
||||
|
||||
protected:
|
||||
QPixmap getIndicatorImage(const StyleOptionViewItem &option);
|
||||
QPixmap getIndicatorImage(const StyleOptionViewItem& option);
|
||||
};
|
||||
} // namespace LimeReport
|
||||
|
||||
|
||||
@@ -28,60 +28,72 @@
|
||||
* GNU General Public License for more details. *
|
||||
****************************************************************************/
|
||||
#include "lrcolorpropitem.h"
|
||||
#include "lrglobal.h"
|
||||
|
||||
#include "editors/lrcoloreditor.h"
|
||||
#include <QPainter>
|
||||
#include "lrglobal.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QPainter>
|
||||
|
||||
namespace{
|
||||
LimeReport::ObjectPropItem * createColorPropItem(
|
||||
QObject *object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly)
|
||||
{
|
||||
return new LimeReport::ColorPropItem(object, objects, name, displayName, data, parent, readonly);
|
||||
}
|
||||
bool VARIABLE_IS_NOT_USED registredColorProp = LimeReport::ObjectPropFactory::instance().registerCreator(LimeReport::APropIdent("QColor",""),QObject::tr("QColor"),createColorPropItem);
|
||||
}
|
||||
|
||||
namespace LimeReport{
|
||||
|
||||
void ColorPropItem::setPropertyEditorData(QWidget *propertyEditor, const QModelIndex &) const
|
||||
namespace {
|
||||
LimeReport::ObjectPropItem* createColorPropItem(QObject* object,
|
||||
LimeReport::ObjectPropItem::ObjectsList* objects,
|
||||
const QString& name, const QString& displayName,
|
||||
const QVariant& data,
|
||||
LimeReport::ObjectPropItem* parent, bool readonly)
|
||||
{
|
||||
ColorEditor *editor =qobject_cast<ColorEditor*>(propertyEditor);
|
||||
return new LimeReport::ColorPropItem(object, objects, name, displayName, data, parent,
|
||||
readonly);
|
||||
}
|
||||
bool VARIABLE_IS_NOT_USED registredColorProp
|
||||
= LimeReport::ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("QColor", ""), QObject::tr("QColor"), createColorPropItem);
|
||||
} // namespace
|
||||
|
||||
namespace LimeReport {
|
||||
|
||||
void ColorPropItem::setPropertyEditorData(QWidget* propertyEditor, const QModelIndex&) const
|
||||
{
|
||||
ColorEditor* editor = qobject_cast<ColorEditor*>(propertyEditor);
|
||||
editor->setColor(propertyValue().value<QColor>());
|
||||
}
|
||||
|
||||
void ColorPropItem::setModelData(QWidget *propertyEditor, QAbstractItemModel *model, const QModelIndex &index)
|
||||
void ColorPropItem::setModelData(QWidget* propertyEditor, QAbstractItemModel* model,
|
||||
const QModelIndex& index)
|
||||
{
|
||||
model->setData(index,qobject_cast<ColorEditor*>(propertyEditor)->color());
|
||||
setValueToObject(propertyName(),propertyValue());
|
||||
model->setData(index, qobject_cast<ColorEditor*>(propertyEditor)->color());
|
||||
setValueToObject(propertyName(), propertyValue());
|
||||
}
|
||||
|
||||
bool ColorPropItem::paint(QPainter *painter, const StyleOptionViewItem &option, const QModelIndex &index)
|
||||
bool ColorPropItem::paint(QPainter* painter, const StyleOptionViewItem& option,
|
||||
const QModelIndex& index)
|
||||
{
|
||||
if (index.column()==1){
|
||||
if (index.column() == 1) {
|
||||
painter->save();
|
||||
|
||||
QStyle* style = option.widget ? option.widget->style() : QApplication::style();
|
||||
QPen pen;
|
||||
QColor penColor = isColorDark(propertyValue().value<QColor>()) ? Qt::transparent : Qt::darkGray;
|
||||
QColor penColor
|
||||
= isColorDark(propertyValue().value<QColor>()) ? Qt::transparent : Qt::darkGray;
|
||||
pen.setColor(penColor);
|
||||
painter->setPen(pen);
|
||||
painter->setBrush(propertyValue().value<QColor>());
|
||||
int border = (option.rect.height() - style->pixelMetric(QStyle::PM_IndicatorWidth))/2;
|
||||
int border = (option.rect.height() - style->pixelMetric(QStyle::PM_IndicatorWidth)) / 2;
|
||||
|
||||
QRect rect(option.rect.x()+border,option.rect.y()+border,
|
||||
QRect rect(option.rect.x() + border, option.rect.y() + border,
|
||||
style->pixelMetric(QStyle::PM_IndicatorWidth),
|
||||
style->pixelMetric(QStyle::PM_IndicatorWidth));
|
||||
painter->drawRect(rect);
|
||||
|
||||
painter->restore();
|
||||
return true;
|
||||
} else return false;
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
|
||||
QWidget *ColorPropItem::createProperyEditor(QWidget *parent) const
|
||||
QWidget* ColorPropItem::createProperyEditor(QWidget* parent) const
|
||||
{
|
||||
return new ColorEditor(parent);
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace LimeReport
|
||||
|
||||
@@ -32,20 +32,23 @@
|
||||
|
||||
#include "lrobjectpropitem.h"
|
||||
|
||||
namespace LimeReport{
|
||||
namespace LimeReport {
|
||||
|
||||
class ColorPropItem : public ObjectPropItem
|
||||
{
|
||||
class ColorPropItem: public ObjectPropItem {
|
||||
Q_OBJECT
|
||||
public:
|
||||
ColorPropItem():ObjectPropItem(){}
|
||||
ColorPropItem(QObject* object, ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& value,ObjectPropItem* parent, bool readonly)
|
||||
:ObjectPropItem(object, objects, name, displayName, value, parent, readonly){}
|
||||
QWidget* createProperyEditor(QWidget *parent) const;
|
||||
void setPropertyEditorData(QWidget *propertyEditor, const QModelIndex &) const;
|
||||
void setModelData(QWidget *propertyEditor, QAbstractItemModel *model, const QModelIndex &index);
|
||||
bool paint(QPainter *painter, const StyleOptionViewItem &option, const QModelIndex &index);
|
||||
ColorPropItem(): ObjectPropItem() { }
|
||||
ColorPropItem(QObject* object, ObjectsList* objects, const QString& name,
|
||||
const QString& displayName, const QVariant& value, ObjectPropItem* parent,
|
||||
bool readonly):
|
||||
ObjectPropItem(object, objects, name, displayName, value, parent, readonly)
|
||||
{
|
||||
}
|
||||
QWidget* createProperyEditor(QWidget* parent) const;
|
||||
void setPropertyEditorData(QWidget* propertyEditor, const QModelIndex&) const;
|
||||
void setModelData(QWidget* propertyEditor, QAbstractItemModel* model, const QModelIndex& index);
|
||||
bool paint(QPainter* painter, const StyleOptionViewItem& option, const QModelIndex& index);
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace LimeReport
|
||||
#endif // LRCOLORPROPITEM_H
|
||||
|
||||
@@ -1,38 +1,47 @@
|
||||
#include "lrcontentpropitem.h"
|
||||
#include "lrtextitem.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 {
|
||||
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
|
||||
QWidget* ContentPropItem::createProperyEditor(QWidget* parent) const
|
||||
{
|
||||
return new ContentEditor(object(), object()->objectName()+"."+displayName(), parent);
|
||||
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->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()));
|
||||
connect(editor, SIGNAL(destroyed()), dialog, SLOT(close()));
|
||||
connect(editor, SIGNAL(destroyed()), this, SIGNAL(editingFinished()));
|
||||
dialog->exec();
|
||||
}
|
||||
|
||||
} //namespace LimeReport
|
||||
} // namespace LimeReport
|
||||
|
||||
@@ -6,24 +6,32 @@
|
||||
|
||||
namespace LimeReport {
|
||||
|
||||
class ContentEditor : public ButtonLineEditor{
|
||||
class ContentEditor: public ButtonLineEditor {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ContentEditor(QObject* object, const QString& propertyName,QWidget *parent = 0)
|
||||
:ButtonLineEditor(propertyName,parent), m_object(object){}
|
||||
explicit ContentEditor(QObject* object, const QString& propertyName, QWidget* parent = 0):
|
||||
ButtonLineEditor(propertyName, parent),
|
||||
m_object(object)
|
||||
{
|
||||
}
|
||||
public slots:
|
||||
void editButtonClicked();
|
||||
|
||||
private:
|
||||
QObject* m_object;
|
||||
};
|
||||
|
||||
class ContentPropItem : public StringPropItem{
|
||||
class ContentPropItem: public StringPropItem {
|
||||
Q_OBJECT
|
||||
public:
|
||||
ContentPropItem():StringPropItem(){}
|
||||
ContentPropItem(QObject* object, ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& value, ObjectPropItem* parent, bool readonly)
|
||||
:StringPropItem(object, objects, name, displayName, value, parent, readonly){}
|
||||
QWidget* createProperyEditor(QWidget *parent) const;
|
||||
ContentPropItem(): StringPropItem() { }
|
||||
ContentPropItem(QObject* object, ObjectsList* objects, const QString& name,
|
||||
const QString& displayName, const QVariant& value, ObjectPropItem* parent,
|
||||
bool readonly):
|
||||
StringPropItem(object, objects, name, displayName, value, parent, readonly)
|
||||
{
|
||||
}
|
||||
QWidget* createProperyEditor(QWidget* parent) const;
|
||||
};
|
||||
|
||||
} // namespace LimeReport
|
||||
|
||||
@@ -28,98 +28,125 @@
|
||||
* GNU General Public License for more details. *
|
||||
****************************************************************************/
|
||||
#include "lrdatasourcepropitem.h"
|
||||
#include "lrobjectpropitem.h"
|
||||
#include "lrbasedesignintf.h"
|
||||
#include "lrreportengine_p.h"
|
||||
|
||||
#include "../editors/lrcomboboxeditor.h"
|
||||
#include "lrbasedesignintf.h"
|
||||
#include "lrobjectpropitem.h"
|
||||
#include "lrreportengine_p.h"
|
||||
|
||||
#include <QComboBox>
|
||||
|
||||
namespace{
|
||||
LimeReport::ObjectPropItem * createDatasourcePropItem(
|
||||
QObject *object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly)
|
||||
{
|
||||
return new LimeReport::DatasourcePropItem(object, objects, name, displayName, data, parent, readonly);
|
||||
}
|
||||
|
||||
LimeReport::ObjectPropItem* createFieldPropItem(QObject *object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly){
|
||||
return new LimeReport::FieldPropItem(object, objects, name, displayName, data, parent, readonly);
|
||||
}
|
||||
|
||||
bool VARIABLE_IS_NOT_USED registredDatasouceProp = LimeReport::ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("datasource","LimeReport::DataBandDesignIntf"),QObject::tr("datasource"),createDatasourcePropItem
|
||||
);
|
||||
|
||||
bool VARIABLE_IS_NOT_USED registredImageDatasouceProp = LimeReport::ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("datasource","LimeReport::ImageItem"),QObject::tr("datasource"),createDatasourcePropItem
|
||||
);
|
||||
|
||||
bool VARIABLE_IS_NOT_USED registredImageFieldProp = LimeReport::ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("field","LimeReport::ImageItem"),QObject::tr("field"),createFieldPropItem
|
||||
);
|
||||
|
||||
bool VARIABLE_IS_NOT_USED registredChartDatasouceProp = LimeReport::ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("datasource","LimeReport::ChartItem"),QObject::tr("datasource"),createDatasourcePropItem
|
||||
);
|
||||
|
||||
bool VARIABLE_IS_NOT_USED registredBarcodeDatasouceProp = LimeReport::ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("datasource","LimeReport::BarcodeItem"),QObject::tr("datasource"),createDatasourcePropItem
|
||||
);
|
||||
|
||||
bool VARIABLE_IS_NOT_USED registredBarcodeFieldProp = LimeReport::ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("field","LimeReport::BarcodeItem"),QObject::tr("field"),createFieldPropItem
|
||||
);
|
||||
|
||||
bool VARIABLE_IS_NOT_USED registredSVGItemDatasouceProp = LimeReport::ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("datasource","LimeReport::SVGItem"),QObject::tr("datasource"),createDatasourcePropItem
|
||||
);
|
||||
|
||||
bool VARIABLE_IS_NOT_USED registredSVGFieldProp = LimeReport::ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("field","LimeReport::SVGItem"),QObject::tr("field"),createFieldPropItem
|
||||
);
|
||||
namespace {
|
||||
LimeReport::ObjectPropItem*
|
||||
createDatasourcePropItem(QObject* object, LimeReport::ObjectPropItem::ObjectsList* objects,
|
||||
const QString& name, const QString& displayName, const QVariant& data,
|
||||
LimeReport::ObjectPropItem* parent, bool readonly)
|
||||
{
|
||||
return new LimeReport::DatasourcePropItem(object, objects, name, displayName, data, parent,
|
||||
readonly);
|
||||
}
|
||||
|
||||
QWidget* LimeReport::DatasourcePropItem::createProperyEditor(QWidget *parent) const{
|
||||
ComboBoxEditor *editor = new ComboBoxEditor(parent,true);
|
||||
LimeReport::ObjectPropItem* createFieldPropItem(QObject* object,
|
||||
LimeReport::ObjectPropItem::ObjectsList* objects,
|
||||
const QString& name, const QString& displayName,
|
||||
const QVariant& data,
|
||||
LimeReport::ObjectPropItem* parent, bool readonly)
|
||||
{
|
||||
return new LimeReport::FieldPropItem(object, objects, name, displayName, data, parent,
|
||||
readonly);
|
||||
}
|
||||
|
||||
bool VARIABLE_IS_NOT_USED registredDatasouceProp
|
||||
= LimeReport::ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("datasource", "LimeReport::DataBandDesignIntf"),
|
||||
QObject::tr("datasource"), createDatasourcePropItem);
|
||||
|
||||
bool VARIABLE_IS_NOT_USED registredImageDatasouceProp
|
||||
= LimeReport::ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("datasource", "LimeReport::ImageItem"), QObject::tr("datasource"),
|
||||
createDatasourcePropItem);
|
||||
|
||||
bool VARIABLE_IS_NOT_USED registredImageFieldProp
|
||||
= LimeReport::ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("field", "LimeReport::ImageItem"), QObject::tr("field"),
|
||||
createFieldPropItem);
|
||||
|
||||
bool VARIABLE_IS_NOT_USED registredChartDatasouceProp
|
||||
= LimeReport::ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("datasource", "LimeReport::ChartItem"), QObject::tr("datasource"),
|
||||
createDatasourcePropItem);
|
||||
|
||||
bool VARIABLE_IS_NOT_USED registredBarcodeDatasouceProp
|
||||
= LimeReport::ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("datasource", "LimeReport::BarcodeItem"), QObject::tr("datasource"),
|
||||
createDatasourcePropItem);
|
||||
|
||||
bool VARIABLE_IS_NOT_USED registredBarcodeFieldProp
|
||||
= LimeReport::ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("field", "LimeReport::BarcodeItem"), QObject::tr("field"),
|
||||
createFieldPropItem);
|
||||
|
||||
bool VARIABLE_IS_NOT_USED registredSVGItemDatasouceProp
|
||||
= LimeReport::ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("datasource", "LimeReport::SVGItem"), QObject::tr("datasource"),
|
||||
createDatasourcePropItem);
|
||||
|
||||
bool VARIABLE_IS_NOT_USED registredSVGFieldProp
|
||||
= LimeReport::ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("field", "LimeReport::SVGItem"), QObject::tr("field"),
|
||||
createFieldPropItem);
|
||||
} // namespace
|
||||
|
||||
QWidget* LimeReport::DatasourcePropItem::createProperyEditor(QWidget* parent) const
|
||||
{
|
||||
ComboBoxEditor* editor = new ComboBoxEditor(parent, true);
|
||||
editor->setEditable(true);
|
||||
LimeReport::BaseDesignIntf *item=dynamic_cast<LimeReport::BaseDesignIntf*>(object());
|
||||
if (item){
|
||||
editor->addItems(item->reportEditor()->dataManager()->dataSourceNames());
|
||||
LimeReport::BaseDesignIntf* item = dynamic_cast<LimeReport::BaseDesignIntf*>(object());
|
||||
if (item) {
|
||||
editor->addItems(item->reportEditor()->dataManager()->dataSourceNames());
|
||||
}
|
||||
return editor;
|
||||
}
|
||||
|
||||
void LimeReport::DatasourcePropItem::setPropertyEditorData(QWidget *propertyEditor, const QModelIndex &) const{
|
||||
ComboBoxEditor *editor=qobject_cast<ComboBoxEditor *>(propertyEditor);
|
||||
void LimeReport::DatasourcePropItem::setPropertyEditorData(QWidget* propertyEditor,
|
||||
const QModelIndex&) const
|
||||
{
|
||||
ComboBoxEditor* editor = qobject_cast<ComboBoxEditor*>(propertyEditor);
|
||||
editor->setTextValue(propertyValue().toString());
|
||||
}
|
||||
|
||||
void LimeReport::DatasourcePropItem::setModelData(QWidget *propertyEditor, QAbstractItemModel *model, const QModelIndex &index){
|
||||
model->setData(index,qobject_cast<ComboBoxEditor*>(propertyEditor)->text());
|
||||
object()->setProperty(propertyName().toLatin1(),propertyValue());
|
||||
void LimeReport::DatasourcePropItem::setModelData(QWidget* propertyEditor,
|
||||
QAbstractItemModel* model,
|
||||
const QModelIndex& index)
|
||||
{
|
||||
model->setData(index, qobject_cast<ComboBoxEditor*>(propertyEditor)->text());
|
||||
object()->setProperty(propertyName().toLatin1(), propertyValue());
|
||||
}
|
||||
|
||||
|
||||
QWidget *LimeReport::FieldPropItem::createProperyEditor(QWidget *parent) const
|
||||
QWidget* LimeReport::FieldPropItem::createProperyEditor(QWidget* parent) const
|
||||
{
|
||||
ComboBoxEditor *editor = new ComboBoxEditor(parent);
|
||||
ComboBoxEditor* editor = new ComboBoxEditor(parent);
|
||||
editor->setEditable(true);
|
||||
LimeReport::BaseDesignIntf *item=dynamic_cast<LimeReport::BaseDesignIntf*>(object());
|
||||
LimeReport::BaseDesignIntf* item = dynamic_cast<LimeReport::BaseDesignIntf*>(object());
|
||||
int propertyIndex = object()->metaObject()->indexOfProperty("datasource");
|
||||
|
||||
if (item && propertyIndex>0){
|
||||
editor->addItems(item->reportEditor()->dataManager()->fieldNames(object()->property("datasource").toString()));
|
||||
if (item && propertyIndex > 0) {
|
||||
editor->addItems(item->reportEditor()->dataManager()->fieldNames(
|
||||
object()->property("datasource").toString()));
|
||||
}
|
||||
return editor;
|
||||
}
|
||||
|
||||
void LimeReport::FieldPropItem::setPropertyEditorData(QWidget *propertyEditor, const QModelIndex &) const
|
||||
void LimeReport::FieldPropItem::setPropertyEditorData(QWidget* propertyEditor,
|
||||
const QModelIndex&) const
|
||||
{
|
||||
ComboBoxEditor *editor=qobject_cast<ComboBoxEditor *>(propertyEditor);
|
||||
ComboBoxEditor* editor = qobject_cast<ComboBoxEditor*>(propertyEditor);
|
||||
editor->setTextValue(propertyValue().toString());
|
||||
}
|
||||
|
||||
void LimeReport::FieldPropItem::setModelData(QWidget *propertyEditor, QAbstractItemModel *model, const QModelIndex &index)
|
||||
void LimeReport::FieldPropItem::setModelData(QWidget* propertyEditor, QAbstractItemModel* model,
|
||||
const QModelIndex& index)
|
||||
{
|
||||
model->setData(index,qobject_cast<ComboBoxEditor*>(propertyEditor)->text());
|
||||
object()->setProperty(propertyName().toLatin1(),propertyValue());
|
||||
model->setData(index, qobject_cast<ComboBoxEditor*>(propertyEditor)->text());
|
||||
object()->setProperty(propertyName().toLatin1(), propertyValue());
|
||||
}
|
||||
|
||||
@@ -31,31 +31,37 @@
|
||||
#define LRDATASOURCEPROPITEM_H
|
||||
|
||||
#include "lrobjectpropitem.h"
|
||||
namespace LimeReport{
|
||||
namespace LimeReport {
|
||||
|
||||
class DatasourcePropItem : public LimeReport::ObjectPropItem
|
||||
{
|
||||
class DatasourcePropItem: public LimeReport::ObjectPropItem {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DatasourcePropItem(QObject* object, ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& value,ObjectPropItem* parent, bool readonly)
|
||||
:ObjectPropItem(object, objects, name, displayName, value, parent, readonly){}
|
||||
QWidget* createProperyEditor(QWidget *parent) const;
|
||||
void setPropertyEditorData(QWidget *, const QModelIndex &) const;
|
||||
void setModelData(QWidget *, QAbstractItemModel *, const QModelIndex &);
|
||||
DatasourcePropItem(QObject* object, ObjectsList* objects, const QString& name,
|
||||
const QString& displayName, const QVariant& value, ObjectPropItem* parent,
|
||||
bool readonly):
|
||||
ObjectPropItem(object, objects, name, displayName, value, parent, readonly)
|
||||
{
|
||||
}
|
||||
QWidget* createProperyEditor(QWidget* parent) const;
|
||||
void setPropertyEditorData(QWidget*, const QModelIndex&) const;
|
||||
void setModelData(QWidget*, QAbstractItemModel*, const QModelIndex&);
|
||||
};
|
||||
|
||||
class FieldPropItem : public LimeReport::ObjectPropItem
|
||||
{
|
||||
class FieldPropItem: public LimeReport::ObjectPropItem {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
FieldPropItem(QObject* object, ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& value,ObjectPropItem* parent, bool readonly)
|
||||
:ObjectPropItem(object, objects, name, displayName, value, parent, readonly){}
|
||||
QWidget* createProperyEditor(QWidget *parent) const;
|
||||
void setPropertyEditorData(QWidget *propertyEditor, const QModelIndex &) const;
|
||||
void setModelData(QWidget *propertyEditor, QAbstractItemModel *, const QModelIndex &index);
|
||||
FieldPropItem(QObject* object, ObjectsList* objects, const QString& name,
|
||||
const QString& displayName, const QVariant& value, ObjectPropItem* parent,
|
||||
bool readonly):
|
||||
ObjectPropItem(object, objects, name, displayName, value, parent, readonly)
|
||||
{
|
||||
}
|
||||
QWidget* createProperyEditor(QWidget* parent) const;
|
||||
void setPropertyEditorData(QWidget* propertyEditor, const QModelIndex&) const;
|
||||
void setModelData(QWidget* propertyEditor, QAbstractItemModel*, const QModelIndex& index);
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace LimeReport
|
||||
#endif // LRDATASOURCEPROPITEM_H
|
||||
|
||||
@@ -28,35 +28,43 @@
|
||||
* GNU General Public License for more details. *
|
||||
****************************************************************************/
|
||||
#include "lrenumpropitem.h"
|
||||
|
||||
#include "../editors/lrcomboboxeditor.h"
|
||||
#include "lrbanddesignintf.h"
|
||||
|
||||
namespace {
|
||||
|
||||
LimeReport::ObjectPropItem * createEnumPropItem(
|
||||
QObject *object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly)
|
||||
LimeReport::ObjectPropItem* createEnumPropItem(QObject* object,
|
||||
LimeReport::ObjectPropItem::ObjectsList* objects,
|
||||
const QString& name, const QString& displayName,
|
||||
const QVariant& data,
|
||||
LimeReport::ObjectPropItem* parent, bool readonly)
|
||||
{
|
||||
return new LimeReport::EnumPropItem(object, objects, name, displayName, data, parent, readonly);
|
||||
}
|
||||
bool VARIABLE_IS_NOT_USED registred = LimeReport::ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("enum",""),QObject::tr("enum"),createEnumPropItem
|
||||
);
|
||||
LimeReport::APropIdent("enum", ""), QObject::tr("enum"), createEnumPropItem);
|
||||
|
||||
}
|
||||
} // namespace
|
||||
|
||||
namespace LimeReport {
|
||||
|
||||
QWidget *EnumPropItem::createProperyEditor(QWidget *parent) const
|
||||
QWidget* EnumPropItem::createProperyEditor(QWidget* parent) const
|
||||
{
|
||||
ComboBoxEditor *editor = new ComboBoxEditor(parent,false);
|
||||
connect(editor,SIGNAL(currentIndexChanged(QString)),this,SLOT(slotEnumChanged(QString)));
|
||||
ComboBoxEditor* editor = new ComboBoxEditor(parent, false);
|
||||
connect(editor, SIGNAL(currentIndexChanged(QString)), this, SLOT(slotEnumChanged(QString)));
|
||||
|
||||
QStringList enumValues;
|
||||
QMetaEnum propEnum = object()->metaObject()->property(object()->metaObject()->indexOfProperty(propertyName().toLatin1())).enumerator();
|
||||
for (int i=0;i<propEnum.keyCount();i++){
|
||||
if (m_acceptableValues.isEmpty()) enumValues.append(tr(propEnum.key(i)));
|
||||
QMetaEnum propEnum
|
||||
= object()
|
||||
->metaObject()
|
||||
->property(object()->metaObject()->indexOfProperty(propertyName().toLatin1()))
|
||||
.enumerator();
|
||||
for (int i = 0; i < propEnum.keyCount(); i++) {
|
||||
if (m_acceptableValues.isEmpty())
|
||||
enumValues.append(tr(propEnum.key(i)));
|
||||
else {
|
||||
if (m_acceptableValues.contains(propEnum.value(i))){
|
||||
if (m_acceptableValues.contains(propEnum.value(i))) {
|
||||
enumValues.append(tr(propEnum.key(i)));
|
||||
}
|
||||
}
|
||||
@@ -65,20 +73,24 @@ QWidget *EnumPropItem::createProperyEditor(QWidget *parent) const
|
||||
return editor;
|
||||
}
|
||||
|
||||
void EnumPropItem::slotEnumChanged(const QString &text)
|
||||
void EnumPropItem::slotEnumChanged(const QString& text)
|
||||
{
|
||||
if ( nameByType(object()->property(propertyName().toLatin1()).toInt())!=text){
|
||||
if (nameByType(object()->property(propertyName().toLatin1()).toInt()) != text) {
|
||||
beginChangeValue();
|
||||
setPropertyValue(typeByName(text));
|
||||
setValueToObject(propertyName(),typeByName(text));
|
||||
setValueToObject(propertyName(), typeByName(text));
|
||||
endChangeValue();
|
||||
}
|
||||
}
|
||||
|
||||
void EnumPropItem::initTranslation()
|
||||
{
|
||||
QMetaEnum propEnum = object()->metaObject()->property(object()->metaObject()->indexOfProperty(propertyName().toLatin1())).enumerator();
|
||||
for (int i=0;i<propEnum.keyCount();i++){
|
||||
QMetaEnum propEnum
|
||||
= object()
|
||||
->metaObject()
|
||||
->property(object()->metaObject()->indexOfProperty(propertyName().toLatin1()))
|
||||
.enumerator();
|
||||
for (int i = 0; i < propEnum.keyCount(); i++) {
|
||||
m_translation.insert(QString(tr(propEnum.key(i))), QString(propEnum.key(i)));
|
||||
}
|
||||
}
|
||||
@@ -168,36 +180,42 @@ void EnumPropItem::translateEnumItemName()
|
||||
tr("DashDotLine");
|
||||
tr("DashDotDotLine");
|
||||
tr("CustomDashLine");
|
||||
|
||||
}
|
||||
|
||||
void EnumPropItem::setPropertyEditorData(QWidget *propertyEditor, const QModelIndex &) const
|
||||
void EnumPropItem::setPropertyEditorData(QWidget* propertyEditor, const QModelIndex&) const
|
||||
{
|
||||
ComboBoxEditor *editor=qobject_cast<ComboBoxEditor *>(propertyEditor);
|
||||
ComboBoxEditor* editor = qobject_cast<ComboBoxEditor*>(propertyEditor);
|
||||
editor->setTextValue(nameByType(propertyValue().toInt()));
|
||||
}
|
||||
|
||||
void EnumPropItem::setModelData(QWidget *propertyEditor, QAbstractItemModel *model, const QModelIndex &index)
|
||||
void EnumPropItem::setModelData(QWidget* propertyEditor, QAbstractItemModel* model,
|
||||
const QModelIndex& index)
|
||||
{
|
||||
setValueToObject(propertyName(),typeByName(qobject_cast<ComboBoxEditor*>(propertyEditor)->text()));
|
||||
model->setData(index,object()->property(propertyName().toLatin1()));
|
||||
setValueToObject(propertyName(),
|
||||
typeByName(qobject_cast<ComboBoxEditor*>(propertyEditor)->text()));
|
||||
model->setData(index, object()->property(propertyName().toLatin1()));
|
||||
}
|
||||
|
||||
QString EnumPropItem::nameByType(int value) const
|
||||
{
|
||||
QMetaEnum propEnum = object()->metaObject()->property(object()->metaObject()->indexOfProperty(propertyName().toLatin1())).enumerator();
|
||||
QMetaEnum propEnum
|
||||
= object()
|
||||
->metaObject()
|
||||
->property(object()->metaObject()->indexOfProperty(propertyName().toLatin1()))
|
||||
.enumerator();
|
||||
return isTranslateProperty() ? tr(propEnum.valueToKey(value)) : propEnum.valueToKey(value);
|
||||
}
|
||||
|
||||
int EnumPropItem::typeByName(const QString &value) const
|
||||
int EnumPropItem::typeByName(const QString& value) const
|
||||
{
|
||||
QMetaEnum propEnum = object()->metaObject()->property(object()->metaObject()->indexOfProperty(propertyName().toLatin1())).enumerator();
|
||||
QMetaEnum propEnum
|
||||
= object()
|
||||
->metaObject()
|
||||
->property(object()->metaObject()->indexOfProperty(propertyName().toLatin1()))
|
||||
.enumerator();
|
||||
return propEnum.keyToValue(m_translation.value(value).toLatin1());
|
||||
}
|
||||
|
||||
QString EnumPropItem::displayValue() const
|
||||
{
|
||||
return nameByType((propertyValue().toInt()));
|
||||
}
|
||||
QString EnumPropItem::displayValue() const { return nameByType((propertyValue().toInt())); }
|
||||
|
||||
}
|
||||
} // namespace LimeReport
|
||||
|
||||
@@ -31,35 +31,51 @@
|
||||
#define LRENUMPROPITEM_H
|
||||
|
||||
#include "lrobjectpropitem.h"
|
||||
|
||||
#include <QMap>
|
||||
|
||||
namespace LimeReport{
|
||||
class EnumPropItem : public ObjectPropItem
|
||||
{
|
||||
namespace LimeReport {
|
||||
class EnumPropItem: public ObjectPropItem {
|
||||
Q_OBJECT
|
||||
public:
|
||||
EnumPropItem():ObjectPropItem(), m_settingValue(false){initTranslation();}
|
||||
EnumPropItem(QObject* object, ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& value,ObjectPropItem* parent, bool readonly)
|
||||
:ObjectPropItem(object, objects, name, displayName, value, parent, readonly),m_settingValue(false){initTranslation();}
|
||||
EnumPropItem(QObject* object, ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& value,ObjectPropItem* parent, bool readonly, QVector<int> acceptableValues)
|
||||
:ObjectPropItem(object, objects, name, displayName, value, parent, readonly),m_acceptableValues(acceptableValues),m_settingValue(false){initTranslation();}
|
||||
QWidget* createProperyEditor(QWidget *parent) const;
|
||||
QString displayValue() const;
|
||||
void setPropertyEditorData(QWidget * propertyEditor, const QModelIndex &) const;
|
||||
void setModelData(QWidget * propertyEditor, QAbstractItemModel * model, const QModelIndex & index);
|
||||
QVector<int> acceptableValues() const {return m_acceptableValues;}
|
||||
EnumPropItem(): ObjectPropItem(), m_settingValue(false) { initTranslation(); }
|
||||
EnumPropItem(QObject* object, ObjectsList* objects, const QString& name,
|
||||
const QString& displayName, const QVariant& value, ObjectPropItem* parent,
|
||||
bool readonly):
|
||||
ObjectPropItem(object, objects, name, displayName, value, parent, readonly),
|
||||
m_settingValue(false)
|
||||
{
|
||||
initTranslation();
|
||||
}
|
||||
EnumPropItem(QObject* object, ObjectsList* objects, const QString& name,
|
||||
const QString& displayName, const QVariant& value, ObjectPropItem* parent,
|
||||
bool readonly, QVector<int> acceptableValues):
|
||||
ObjectPropItem(object, objects, name, displayName, value, parent, readonly),
|
||||
m_acceptableValues(acceptableValues),
|
||||
m_settingValue(false)
|
||||
{
|
||||
initTranslation();
|
||||
}
|
||||
QWidget* createProperyEditor(QWidget* parent) const;
|
||||
QString displayValue() const;
|
||||
void setPropertyEditorData(QWidget* propertyEditor, const QModelIndex&) const;
|
||||
void setModelData(QWidget* propertyEditor, QAbstractItemModel* model, const QModelIndex& index);
|
||||
QVector<int> acceptableValues() const { return m_acceptableValues; }
|
||||
|
||||
protected:
|
||||
QString nameByType(int propertyValue) const;
|
||||
int typeByName(const QString& propertyValue) const;
|
||||
int typeByName(const QString& propertyValue) const;
|
||||
private slots:
|
||||
void slotEnumChanged(const QString& text);
|
||||
|
||||
private:
|
||||
void initTranslation();
|
||||
void translateEnumItemName();
|
||||
|
||||
private:
|
||||
QVector<int> m_acceptableValues;
|
||||
bool m_settingValue;
|
||||
QMap<QString, QString> m_translation;
|
||||
};
|
||||
}
|
||||
} // namespace LimeReport
|
||||
#endif // LRENUMPROPITEM_H
|
||||
|
||||
@@ -28,10 +28,12 @@
|
||||
* GNU General Public License for more details. *
|
||||
****************************************************************************/
|
||||
#include "lrflagspropitem.h"
|
||||
#include "lrenumpropitem.h"
|
||||
#include "lrboolpropitem.h"
|
||||
|
||||
#include "../editors/lrcheckboxeditor.h"
|
||||
#include "lrboolpropitem.h"
|
||||
#include "lrenumpropitem.h"
|
||||
#include "lrobjectitemmodel.h"
|
||||
|
||||
#include <QIcon>
|
||||
#include <QImage>
|
||||
#include <QPainter>
|
||||
@@ -40,14 +42,17 @@
|
||||
|
||||
namespace {
|
||||
|
||||
LimeReport::ObjectPropItem * createFlagsPropItem(
|
||||
QObject *object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly)
|
||||
LimeReport::ObjectPropItem* createFlagsPropItem(QObject* object,
|
||||
LimeReport::ObjectPropItem::ObjectsList* objects,
|
||||
const QString& name, const QString& displayName,
|
||||
const QVariant& data,
|
||||
LimeReport::ObjectPropItem* parent, bool readonly)
|
||||
{
|
||||
return new LimeReport::FlagsPropItem(object, objects, name, displayName, data, parent, readonly);
|
||||
return new LimeReport::FlagsPropItem(object, objects, name, displayName, data, parent,
|
||||
readonly);
|
||||
}
|
||||
bool VARIABLE_IS_NOT_USED registred = LimeReport::ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("flags",""),QObject::tr("flags"),createFlagsPropItem
|
||||
);
|
||||
LimeReport::APropIdent("flags", ""), QObject::tr("flags"), createFlagsPropItem);
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -55,52 +60,73 @@ namespace LimeReport {
|
||||
|
||||
void FlagsPropItem::createChildren()
|
||||
{
|
||||
QMetaEnum propEnum = object()->metaObject()->property(object()->metaObject()->indexOfProperty(propertyName().toLatin1())).enumerator();
|
||||
for (int i=0;i<propEnum.keyCount();i++)
|
||||
{
|
||||
if ( propEnum.keyToValue(propEnum.key(i)) !=0 ) {
|
||||
QMetaEnum propEnum
|
||||
= object()
|
||||
->metaObject()
|
||||
->property(object()->metaObject()->indexOfProperty(propertyName().toLatin1()))
|
||||
.enumerator();
|
||||
for (int i = 0; i < propEnum.keyCount(); i++) {
|
||||
if (propEnum.keyToValue(propEnum.key(i)) != 0) {
|
||||
this->appendItem(new LimeReport::FlagPropItem(
|
||||
object(), objects(), QString(propEnum.key(i)), tr(propEnum.key(i)),
|
||||
bool((propertyValue().toInt() & propEnum.keyToValue(propEnum.key(i)))==propEnum.keyToValue(propEnum.key(i))),
|
||||
this, false
|
||||
)
|
||||
);
|
||||
object(), objects(), QString(propEnum.key(i)), tr(propEnum.key(i)),
|
||||
bool((propertyValue().toInt() & propEnum.keyToValue(propEnum.key(i)))
|
||||
== propEnum.keyToValue(propEnum.key(i))),
|
||||
this, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FlagsPropItem::updateChildren()
|
||||
{
|
||||
QMetaEnum propEnum = object()->metaObject()->property(object()->metaObject()->indexOfProperty(propertyName().toLatin1())).enumerator();
|
||||
for (int i=0;i<propEnum.keyCount();i++)
|
||||
{
|
||||
QMetaEnum propEnum
|
||||
= object()
|
||||
->metaObject()
|
||||
->property(object()->metaObject()->indexOfProperty(propertyName().toLatin1()))
|
||||
.enumerator();
|
||||
for (int i = 0; i < propEnum.keyCount(); i++) {
|
||||
ObjectPropItem* property = findChild(QString(propEnum.key(i)));
|
||||
if (property)
|
||||
property->setPropertyValue(bool((propertyValue().toInt() & propEnum.keyToValue(propEnum.key(i)))==propEnum.keyToValue(propEnum.key(i))));
|
||||
property->setPropertyValue(
|
||||
bool((propertyValue().toInt() & propEnum.keyToValue(propEnum.key(i)))
|
||||
== propEnum.keyToValue(propEnum.key(i))));
|
||||
}
|
||||
}
|
||||
|
||||
FlagsPropItem::FlagsPropItem(QObject *object, ObjectPropItem::ObjectsList *objects, const QString &name, const QString &displayName, const QVariant &value, ObjectPropItem *parent, bool readonly)
|
||||
:ObjectPropItem(object, objects, name, displayName, value, parent, readonly)
|
||||
FlagsPropItem::FlagsPropItem(QObject* object, ObjectPropItem::ObjectsList* objects,
|
||||
const QString& name, const QString& displayName, const QVariant& value,
|
||||
ObjectPropItem* parent, bool readonly):
|
||||
ObjectPropItem(object, objects, name, displayName, value, parent, readonly)
|
||||
{
|
||||
createChildren();
|
||||
}
|
||||
|
||||
FlagsPropItem::FlagsPropItem(QObject *object, ObjectPropItem::ObjectsList *objects, const QString &name, const QString &displayName, const QVariant &value, ObjectPropItem *parent, bool readonly, QSet<int> acceptableValues)
|
||||
:ObjectPropItem(object, objects, name, displayName, value, parent, readonly),m_acceptableValues(acceptableValues){}
|
||||
FlagsPropItem::FlagsPropItem(QObject* object, ObjectPropItem::ObjectsList* objects,
|
||||
const QString& name, const QString& displayName, const QVariant& value,
|
||||
ObjectPropItem* parent, bool readonly, QSet<int> acceptableValues):
|
||||
ObjectPropItem(object, objects, name, displayName, value, parent, readonly),
|
||||
m_acceptableValues(acceptableValues)
|
||||
{
|
||||
}
|
||||
|
||||
QString FlagsPropItem::displayValue() const
|
||||
{
|
||||
QString result;
|
||||
QMetaEnum propEnum = object()->metaObject()->property(object()->metaObject()->indexOfProperty(propertyName().toLatin1())).enumerator();
|
||||
for (int i=0;i<propEnum.keyCount();i++)
|
||||
{
|
||||
if ((propEnum.keyToValue(propEnum.key(i)) == 0) ? propertyValue().toInt() == 0 : (propertyValue().toInt() & propEnum.keyToValue(propEnum.key(i))) == propEnum.keyToValue(propEnum.key(i)))
|
||||
{
|
||||
if (result.isEmpty()) result+= isTranslateProperty() ? tr(propEnum.key(i)) : propEnum.key(i);
|
||||
else result=result+" | "+ (isTranslateProperty() ? tr(propEnum.key(i)) : propEnum.key(i));
|
||||
QMetaEnum propEnum
|
||||
= object()
|
||||
->metaObject()
|
||||
->property(object()->metaObject()->indexOfProperty(propertyName().toLatin1()))
|
||||
.enumerator();
|
||||
for (int i = 0; i < propEnum.keyCount(); i++) {
|
||||
if ((propEnum.keyToValue(propEnum.key(i)) == 0)
|
||||
? propertyValue().toInt() == 0
|
||||
: (propertyValue().toInt() & propEnum.keyToValue(propEnum.key(i)))
|
||||
== propEnum.keyToValue(propEnum.key(i))) {
|
||||
if (result.isEmpty())
|
||||
result += isTranslateProperty() ? tr(propEnum.key(i)) : propEnum.key(i);
|
||||
else
|
||||
result = result + " | "
|
||||
+ (isTranslateProperty() ? tr(propEnum.key(i)) : propEnum.key(i));
|
||||
}
|
||||
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -111,9 +137,7 @@ void FlagsPropItem::setPropertyValue(QVariant value)
|
||||
updateChildren();
|
||||
}
|
||||
|
||||
void FlagsPropItem::slotEnumChanged(QString /*text*/)
|
||||
{
|
||||
}
|
||||
void FlagsPropItem::slotEnumChanged(QString /*text*/) { }
|
||||
|
||||
void FlagsPropItem::translateFlagsItem()
|
||||
{
|
||||
@@ -125,34 +149,42 @@ void FlagsPropItem::translateFlagsItem()
|
||||
tr("AllLines");
|
||||
}
|
||||
|
||||
FlagPropItem::FlagPropItem(QObject* object, ObjectsList* objects, const QString &propName, const QString &displayName, const QVariant &value, ObjectPropItem* parent, bool readonly)
|
||||
:BoolPropItem(object, objects, propName,displayName,value,parent,readonly)
|
||||
FlagPropItem::FlagPropItem(QObject* object, ObjectsList* objects, const QString& propName,
|
||||
const QString& displayName, const QVariant& value,
|
||||
ObjectPropItem* parent, bool readonly):
|
||||
BoolPropItem(object, objects, propName, displayName, value, parent, readonly)
|
||||
{
|
||||
}
|
||||
|
||||
void FlagPropItem::setPropertyEditorData(QWidget *propertyEditor, const QModelIndex &/*index*/) const
|
||||
void FlagPropItem::setPropertyEditorData(QWidget* propertyEditor,
|
||||
const QModelIndex& /*index*/) const
|
||||
{
|
||||
CheckBoxEditor *editor = qobject_cast<CheckBoxEditor*>(propertyEditor);
|
||||
CheckBoxEditor* editor = qobject_cast<CheckBoxEditor*>(propertyEditor);
|
||||
editor->setChecked(propertyValue().toBool());
|
||||
}
|
||||
|
||||
void FlagPropItem::setModelData(QWidget *propertyEditor, QAbstractItemModel *model, const QModelIndex &index)
|
||||
void FlagPropItem::setModelData(QWidget* propertyEditor, QAbstractItemModel* model,
|
||||
const QModelIndex& index)
|
||||
{
|
||||
bool value = qobject_cast<CheckBoxEditor*>(propertyEditor)->isChecked();
|
||||
model->setData(index,value);
|
||||
model->setData(index, value);
|
||||
int flags = object()->property(parent()->propertyName().toLatin1()).toInt();
|
||||
if (value) flags = flags | valueByName(propertyName());
|
||||
else if (flags & valueByName(propertyName())) flags = flags ^ valueByName(propertyName());
|
||||
setValueToObject(parent()->propertyName(),flags);
|
||||
if (value)
|
||||
flags = flags | valueByName(propertyName());
|
||||
else if (flags & valueByName(propertyName()))
|
||||
flags = flags ^ valueByName(propertyName());
|
||||
setValueToObject(parent()->propertyName(), flags);
|
||||
parent()->setPropertyValue(flags);
|
||||
}
|
||||
|
||||
int FlagPropItem::valueByName(const QString& typeName)
|
||||
{
|
||||
QMetaEnum propEnum = object()->metaObject()->property(object()->metaObject()->indexOfProperty(parent()->propertyName().toLatin1())).enumerator();
|
||||
QMetaEnum propEnum = object()
|
||||
->metaObject()
|
||||
->property(object()->metaObject()->indexOfProperty(
|
||||
parent()->propertyName().toLatin1()))
|
||||
.enumerator();
|
||||
return propEnum.keyToValue(typeName.toLatin1());
|
||||
}
|
||||
|
||||
} // namespace LimeReport
|
||||
|
||||
|
||||
|
||||
@@ -30,43 +30,50 @@
|
||||
#ifndef LRFLAGSPROPEDITOR_H
|
||||
#define LRFLAGSPROPEDITOR_H
|
||||
|
||||
#include "lrobjectpropitem.h"
|
||||
#include "lrboolpropitem.h"
|
||||
#include "lrobjectpropitem.h"
|
||||
|
||||
namespace LimeReport{
|
||||
namespace LimeReport {
|
||||
|
||||
class FlagsPropItem : public ObjectPropItem
|
||||
{
|
||||
class FlagsPropItem: public ObjectPropItem {
|
||||
Q_OBJECT
|
||||
public:
|
||||
FlagsPropItem():ObjectPropItem(){}
|
||||
FlagsPropItem(QObject* object, ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& value,ObjectPropItem* parent, bool readonly);
|
||||
FlagsPropItem(QObject* object, ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& value,ObjectPropItem* parent, bool readonly, QSet<int> acceptableValues);
|
||||
FlagsPropItem(): ObjectPropItem() { }
|
||||
FlagsPropItem(QObject* object, ObjectsList* objects, const QString& name,
|
||||
const QString& displayName, const QVariant& value, ObjectPropItem* parent,
|
||||
bool readonly);
|
||||
FlagsPropItem(QObject* object, ObjectsList* objects, const QString& name,
|
||||
const QString& displayName, const QVariant& value, ObjectPropItem* parent,
|
||||
bool readonly, QSet<int> acceptableValues);
|
||||
virtual QString displayValue() const;
|
||||
virtual void setPropertyValue(QVariant propertyValue);
|
||||
virtual void setPropertyValue(QVariant propertyValue);
|
||||
private slots:
|
||||
void slotEnumChanged(QString);
|
||||
|
||||
private:
|
||||
void translateFlagsItem();
|
||||
|
||||
private:
|
||||
QSet<int> m_acceptableValues;
|
||||
QString nameByType(int propertyValue) const;
|
||||
int typeByName(QString propertyValue) const;
|
||||
int typeByName(QString propertyValue) const;
|
||||
void createChildren();
|
||||
void updateChildren();
|
||||
};
|
||||
|
||||
class FlagPropItem : public BoolPropItem{
|
||||
class FlagPropItem: public BoolPropItem {
|
||||
public:
|
||||
FlagPropItem():BoolPropItem(){}
|
||||
FlagPropItem(QObject* object, ObjectsList* objects, const QString& propName, const QString& displayName, const QVariant& propertyValue, ObjectPropItem* parent, bool readonly);
|
||||
virtual void setPropertyEditorData(QWidget * propertyEditor, const QModelIndex & ) const;
|
||||
virtual void setModelData(QWidget *, QAbstractItemModel *, const QModelIndex &);
|
||||
virtual QString displayValue() const{return "";}
|
||||
private:
|
||||
int valueByName(const QString &typeName);
|
||||
};
|
||||
FlagPropItem(): BoolPropItem() { }
|
||||
FlagPropItem(QObject* object, ObjectsList* objects, const QString& propName,
|
||||
const QString& displayName, const QVariant& propertyValue, ObjectPropItem* parent,
|
||||
bool readonly);
|
||||
virtual void setPropertyEditorData(QWidget* propertyEditor, const QModelIndex&) const;
|
||||
virtual void setModelData(QWidget*, QAbstractItemModel*, const QModelIndex&);
|
||||
virtual QString displayValue() const { return ""; }
|
||||
|
||||
private:
|
||||
int valueByName(const QString& typeName);
|
||||
};
|
||||
|
||||
} // namespace LimeReport
|
||||
|
||||
|
||||
@@ -27,35 +27,48 @@
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
****************************************************************************/
|
||||
#include <QFontDialog>
|
||||
|
||||
#include "lrfontpropitem.h"
|
||||
|
||||
#include "editors/lrbuttonlineeditor.h"
|
||||
#include "editors/lrfonteditor.h"
|
||||
#include "editors/lrcheckboxeditor.h"
|
||||
#include "editors/lrfonteditor.h"
|
||||
#include "lrobjectitemmodel.h"
|
||||
|
||||
namespace{
|
||||
LimeReport::ObjectPropItem * createFontPropItem(
|
||||
QObject *object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly)
|
||||
{
|
||||
return new LimeReport::FontPropItem(object, objects, name, displayName, data, parent, readonly);
|
||||
}
|
||||
bool VARIABLE_IS_NOT_USED registredFontProp = LimeReport::ObjectPropFactory::instance().registerCreator(LimeReport::APropIdent("QFont",""),QObject::tr("QFont"),createFontPropItem);
|
||||
#include <QFontDialog>
|
||||
|
||||
namespace {
|
||||
LimeReport::ObjectPropItem* createFontPropItem(QObject* object,
|
||||
LimeReport::ObjectPropItem::ObjectsList* objects,
|
||||
const QString& name, const QString& displayName,
|
||||
const QVariant& data,
|
||||
LimeReport::ObjectPropItem* parent, bool readonly)
|
||||
{
|
||||
return new LimeReport::FontPropItem(object, objects, name, displayName, data, parent, readonly);
|
||||
}
|
||||
bool VARIABLE_IS_NOT_USED registredFontProp
|
||||
= LimeReport::ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("QFont", ""), QObject::tr("QFont"), createFontPropItem);
|
||||
} // namespace
|
||||
|
||||
namespace LimeReport {
|
||||
|
||||
namespace LimeReport{
|
||||
|
||||
FontPropItem::FontPropItem(QObject *object, ObjectPropItem::ObjectsList *objects, const QString &name, const QString &displayName, const QVariant &value, ObjectPropItem *parent, bool readonly)
|
||||
:ObjectPropItem(object, objects, name, displayName, value, parent, readonly)
|
||||
FontPropItem::FontPropItem(QObject* object, ObjectPropItem::ObjectsList* objects,
|
||||
const QString& name, const QString& displayName, const QVariant& value,
|
||||
ObjectPropItem* parent, bool readonly):
|
||||
ObjectPropItem(object, objects, name, displayName, value, parent, readonly)
|
||||
{
|
||||
|
||||
m_bold = new FontAttribPropItem(object,objects,"bold",tr("bold"),propertyValue().value<QFont>().bold(),this,false);
|
||||
m_italic = new FontAttribPropItem(object,objects,"italic",tr("italic"),propertyValue().value<QFont>().italic(),this,false);
|
||||
m_underline = new FontAttribPropItem(object,objects,"underline",tr("underline"),propertyValue().value<QFont>().underline(),this,false);
|
||||
m_pointSize = new FontPointSizePropItem(object,0,"pointSize",tr("size"),propertyValue().value<QFont>().pointSize(),this,false);
|
||||
m_family = new FontFamilyPropItem(object,0,"family",tr("family"),propertyValue().value<QFont>(),this,false);
|
||||
m_bold = new FontAttribPropItem(object, objects, "bold", tr("bold"),
|
||||
propertyValue().value<QFont>().bold(), this, false);
|
||||
m_italic = new FontAttribPropItem(object, objects, "italic", tr("italic"),
|
||||
propertyValue().value<QFont>().italic(), this, false);
|
||||
m_underline = new FontAttribPropItem(object, objects, "underline", tr("underline"),
|
||||
propertyValue().value<QFont>().underline(), this, false);
|
||||
m_pointSize
|
||||
= new FontPointSizePropItem(object, 0, "pointSize", tr("size"),
|
||||
propertyValue().value<QFont>().pointSize(), this, false);
|
||||
m_family = new FontFamilyPropItem(object, 0, "family", tr("family"),
|
||||
propertyValue().value<QFont>(), this, false);
|
||||
|
||||
this->appendItem(m_family);
|
||||
this->appendItem(m_pointSize);
|
||||
@@ -64,23 +77,24 @@ FontPropItem::FontPropItem(QObject *object, ObjectPropItem::ObjectsList *objects
|
||||
this->appendItem(m_underline);
|
||||
}
|
||||
|
||||
QWidget *FontPropItem::createProperyEditor(QWidget *parent) const
|
||||
{
|
||||
return new FontEditor(parent);
|
||||
}
|
||||
QWidget* FontPropItem::createProperyEditor(QWidget* parent) const { return new FontEditor(parent); }
|
||||
|
||||
QString FontPropItem::displayValue() const
|
||||
{
|
||||
return toString(propertyValue().value<QFont>());//propertyValue().toString();//toString(propertyValue().value<QFont>());
|
||||
return toString(
|
||||
propertyValue()
|
||||
.value<
|
||||
QFont>()); // propertyValue().toString();//toString(propertyValue().value<QFont>());
|
||||
}
|
||||
|
||||
void FontPropItem::setPropertyEditorData(QWidget* propertyEditor, const QModelIndex &) const
|
||||
void FontPropItem::setPropertyEditorData(QWidget* propertyEditor, const QModelIndex&) const
|
||||
{
|
||||
FontEditor *editor =qobject_cast<FontEditor*>(propertyEditor);
|
||||
FontEditor* editor = qobject_cast<FontEditor*>(propertyEditor);
|
||||
editor->setFontValue(propertyValue().value<QFont>());
|
||||
}
|
||||
|
||||
void FontPropItem::setModelData(QWidget* propertyEditor, QAbstractItemModel* model, const QModelIndex &index)
|
||||
void FontPropItem::setModelData(QWidget* propertyEditor, QAbstractItemModel* model,
|
||||
const QModelIndex& index)
|
||||
{
|
||||
|
||||
QFont tmpFont = qobject_cast<FontEditor*>(propertyEditor)->fontValue();
|
||||
@@ -89,8 +103,8 @@ void FontPropItem::setModelData(QWidget* propertyEditor, QAbstractItemModel* mod
|
||||
font.setPointSize(tmpFont.pointSize());
|
||||
font.setItalic(tmpFont.italic());
|
||||
font.setUnderline(tmpFont.underline());
|
||||
model->setData(index,font);
|
||||
setValueToObject(propertyName(),propertyValue());
|
||||
model->setData(index, font);
|
||||
setValueToObject(propertyName(), propertyValue());
|
||||
}
|
||||
|
||||
void FontPropItem::setPropertyValue(QVariant value)
|
||||
@@ -105,11 +119,14 @@ void FontPropItem::setPropertyValue(QVariant value)
|
||||
|
||||
QString FontPropItem::toString(QFont value) const
|
||||
{
|
||||
QString attribs="";
|
||||
if (value.bold()) (attribs=="") ? attribs+="b":attribs+=",b";
|
||||
if (value.italic()) (attribs=="") ? attribs+="i":attribs+=",i";
|
||||
if (attribs!="") attribs="["+attribs+"]";
|
||||
return "\""+ value.family()+"\" "+QString::number(value.pointSize())+" "+attribs;
|
||||
QString attribs = "";
|
||||
if (value.bold())
|
||||
(attribs == "") ? attribs += "b" : attribs += ",b";
|
||||
if (value.italic())
|
||||
(attribs == "") ? attribs += "i" : attribs += ",i";
|
||||
if (attribs != "")
|
||||
attribs = "[" + attribs + "]";
|
||||
return "\"" + value.family() + "\" " + QString::number(value.pointSize()) + " " + attribs;
|
||||
}
|
||||
|
||||
QString FontFamilyPropItem::displayValue() const
|
||||
@@ -118,71 +135,70 @@ QString FontFamilyPropItem::displayValue() const
|
||||
return font.family();
|
||||
}
|
||||
|
||||
QWidget *FontFamilyPropItem::createProperyEditor(QWidget *parent) const
|
||||
QWidget* FontFamilyPropItem::createProperyEditor(QWidget* parent) const
|
||||
{
|
||||
FontFamilyEditor* editor = new FontFamilyEditor(parent);
|
||||
// QFontComboBox* editor = new QFontComboBox(parent);
|
||||
// QFontComboBox* editor = new QFontComboBox(parent);
|
||||
editor->setAutoFillBackground(true);
|
||||
editor->setFont(propertyValue().value<QFont>());
|
||||
return editor;
|
||||
}
|
||||
|
||||
void FontFamilyPropItem::setPropertyEditorData(QWidget *propertyEditor, const QModelIndex &) const
|
||||
void FontFamilyPropItem::setPropertyEditorData(QWidget* propertyEditor, const QModelIndex&) const
|
||||
{
|
||||
FontFamilyEditor* editor = qobject_cast<FontFamilyEditor*>(propertyEditor);
|
||||
// QFontComboBox* editor = qobject_cast<QFontComboBox*>(propertyEditor);
|
||||
// QFontComboBox* editor = qobject_cast<QFontComboBox*>(propertyEditor);
|
||||
editor->setFont(propertyValue().value<QFont>());
|
||||
}
|
||||
|
||||
void FontFamilyPropItem::setModelData(QWidget *propertyEditor, QAbstractItemModel *model, const QModelIndex &index)
|
||||
void FontFamilyPropItem::setModelData(QWidget* propertyEditor, QAbstractItemModel* model,
|
||||
const QModelIndex& index)
|
||||
{
|
||||
QFont font = object()->property(parent()->propertyName().toLatin1()).value<QFont>();
|
||||
// font.setFamily(qobject_cast<QFontComboBox*>(propertyEditor)->currentFont().family());
|
||||
// font.setFamily(qobject_cast<QFontComboBox*>(propertyEditor)->currentFont().family());
|
||||
font.setFamily(qobject_cast<FontFamilyEditor*>(propertyEditor)->currentFont().family());
|
||||
model->setData(index,font);
|
||||
setValueToObject(parent()->propertyName(),font);
|
||||
model->setData(index, font);
|
||||
setValueToObject(parent()->propertyName(), font);
|
||||
}
|
||||
|
||||
void FontAttribPropItem::setModelData(QWidget *propertyEditor , QAbstractItemModel *model, const QModelIndex &index)
|
||||
void FontAttribPropItem::setModelData(QWidget* propertyEditor, QAbstractItemModel* model,
|
||||
const QModelIndex& index)
|
||||
{
|
||||
model->setData(index,qobject_cast<CheckBoxEditor*>(propertyEditor)->isChecked());
|
||||
model->setData(index, qobject_cast<CheckBoxEditor*>(propertyEditor)->isChecked());
|
||||
QFont font = object()->property(parent()->propertyName().toLatin1()).value<QFont>();
|
||||
if (propertyName()=="bold"){
|
||||
if (propertyName() == "bold") {
|
||||
font.setBold(propertyValue().toBool());
|
||||
}
|
||||
if (propertyName()=="italic"){
|
||||
if (propertyName() == "italic") {
|
||||
font.setItalic(propertyValue().toBool());
|
||||
}
|
||||
if (propertyName()=="underline"){
|
||||
if (propertyName() == "underline") {
|
||||
font.setUnderline(propertyValue().toBool());
|
||||
}
|
||||
setValueToObject(parent()->propertyName(),font);
|
||||
setValueToObject(parent()->propertyName(), font);
|
||||
}
|
||||
|
||||
void FontPointSizePropItem::setModelData(QWidget *propertyEditor, QAbstractItemModel *model, const QModelIndex &index)
|
||||
void FontPointSizePropItem::setModelData(QWidget* propertyEditor, QAbstractItemModel* model,
|
||||
const QModelIndex& index)
|
||||
{
|
||||
model->setData(index,qobject_cast<SpinBoxEditor*>(propertyEditor)->value());
|
||||
model->setData(index, qobject_cast<SpinBoxEditor*>(propertyEditor)->value());
|
||||
QFont font = object()->property(parent()->propertyName().toLatin1()).value<QFont>();
|
||||
font.setPointSize(propertyValue().toInt());
|
||||
setValueToObject(parent()->propertyName(),font);
|
||||
setValueToObject(parent()->propertyName(), font);
|
||||
}
|
||||
|
||||
FontFamilyEditor::FontFamilyEditor(QWidget *parent)
|
||||
:QWidget(parent)
|
||||
FontFamilyEditor::FontFamilyEditor(QWidget* parent): QWidget(parent)
|
||||
{
|
||||
m_valueEditor = new QFontComboBox(this);
|
||||
setFocusProxy(m_valueEditor);
|
||||
QHBoxLayout* hLayout = new QHBoxLayout(this);
|
||||
hLayout->addWidget(m_valueEditor);
|
||||
hLayout->setContentsMargins(1,1,1,1);
|
||||
hLayout->setContentsMargins(1, 1, 1, 1);
|
||||
hLayout->setSpacing(0);
|
||||
setAutoFillBackground(true);
|
||||
}
|
||||
|
||||
QFont FontFamilyEditor::currentFont()
|
||||
{
|
||||
return m_valueEditor->currentFont();
|
||||
}
|
||||
QFont FontFamilyEditor::currentFont() { return m_valueEditor->currentFont(); }
|
||||
|
||||
void FontFamilyEditor::setFont(QFont font)
|
||||
{
|
||||
@@ -190,4 +206,4 @@ void FontFamilyEditor::setFont(QFont font)
|
||||
m_valueEditor->setFont(font);
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace LimeReport
|
||||
|
||||
@@ -30,15 +30,15 @@
|
||||
#ifndef LRFONTPROPITEM_H
|
||||
#define LRFONTPROPITEM_H
|
||||
|
||||
#include <QFontComboBox>
|
||||
|
||||
#include "lrobjectpropitem.h"
|
||||
#include "lrboolpropitem.h"
|
||||
#include "lrintpropitem.h"
|
||||
#include "lrobjectpropitem.h"
|
||||
|
||||
namespace LimeReport{
|
||||
#include <QFontComboBox>
|
||||
|
||||
class FontFamilyEditor : public QWidget{
|
||||
namespace LimeReport {
|
||||
|
||||
class FontFamilyEditor: public QWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
FontFamilyEditor(QWidget* parent);
|
||||
@@ -46,62 +46,82 @@ public:
|
||||
void setFont(QFont font);
|
||||
signals:
|
||||
void editingFinished();
|
||||
|
||||
private:
|
||||
QFontComboBox* m_valueEditor;
|
||||
};
|
||||
|
||||
class FontFamilyPropItem : public ObjectPropItem
|
||||
{
|
||||
class FontFamilyPropItem: public ObjectPropItem {
|
||||
Q_OBJECT
|
||||
public:
|
||||
FontFamilyPropItem():ObjectPropItem(){}
|
||||
FontFamilyPropItem(QObject* object, ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& value,ObjectPropItem* parent, bool readonly=true)
|
||||
:ObjectPropItem(object, objects, name, displayName, value, parent, readonly){}
|
||||
FontFamilyPropItem(): ObjectPropItem() { }
|
||||
FontFamilyPropItem(QObject* object, ObjectsList* objects, const QString& name,
|
||||
const QString& displayName, const QVariant& value, ObjectPropItem* parent,
|
||||
bool readonly = true):
|
||||
ObjectPropItem(object, objects, name, displayName, value, parent, readonly)
|
||||
{
|
||||
}
|
||||
QString displayValue() const;
|
||||
QWidget* createProperyEditor(QWidget *parent) const;
|
||||
void setPropertyEditorData(QWidget *propertyEditor, const QModelIndex &) const;
|
||||
void setModelData(QWidget *propertyEditor , QAbstractItemModel *model, const QModelIndex &index);
|
||||
QWidget* createProperyEditor(QWidget* parent) const;
|
||||
void setPropertyEditorData(QWidget* propertyEditor, const QModelIndex&) const;
|
||||
void setModelData(QWidget* propertyEditor, QAbstractItemModel* model, const QModelIndex& index);
|
||||
};
|
||||
|
||||
class FontPointSizePropItem : public IntPropItem
|
||||
{
|
||||
class FontPointSizePropItem: public IntPropItem {
|
||||
Q_OBJECT
|
||||
public:
|
||||
FontPointSizePropItem():IntPropItem(){}
|
||||
FontPointSizePropItem(QObject* object, ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& value,ObjectPropItem* parent, bool readonly=true)
|
||||
:IntPropItem(object, objects, name, displayName, value, parent, readonly){}
|
||||
void setModelData(QWidget *propertyEditor , QAbstractItemModel *model, const QModelIndex &index);
|
||||
FontPointSizePropItem(): IntPropItem() { }
|
||||
FontPointSizePropItem(QObject* object, ObjectsList* objects, const QString& name,
|
||||
const QString& displayName, const QVariant& value, ObjectPropItem* parent,
|
||||
bool readonly = true):
|
||||
IntPropItem(object, objects, name, displayName, value, parent, readonly)
|
||||
{
|
||||
}
|
||||
void setModelData(QWidget* propertyEditor, QAbstractItemModel* model, const QModelIndex& index);
|
||||
};
|
||||
|
||||
class FontAttribPropItem : public BoolPropItem
|
||||
{
|
||||
class FontAttribPropItem: public BoolPropItem {
|
||||
Q_OBJECT
|
||||
public:
|
||||
FontAttribPropItem():BoolPropItem(){}
|
||||
FontAttribPropItem(QObject* object, ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& value,ObjectPropItem* parent, bool readonly=true)
|
||||
:BoolPropItem(object, objects, name, displayName, value, parent, readonly){}
|
||||
void setModelData(QWidget *propertyEditor , QAbstractItemModel *model, const QModelIndex &index);
|
||||
FontAttribPropItem(): BoolPropItem() { }
|
||||
FontAttribPropItem(QObject* object, ObjectsList* objects, const QString& name,
|
||||
const QString& displayName, const QVariant& value, ObjectPropItem* parent,
|
||||
bool readonly = true):
|
||||
BoolPropItem(object, objects, name, displayName, value, parent, readonly)
|
||||
{
|
||||
}
|
||||
void setModelData(QWidget* propertyEditor, QAbstractItemModel* model, const QModelIndex& index);
|
||||
};
|
||||
|
||||
class FontPropItem : public ObjectPropItem
|
||||
{
|
||||
class FontPropItem: public ObjectPropItem {
|
||||
Q_OBJECT
|
||||
public:
|
||||
FontPropItem():ObjectPropItem(), m_pointSize(NULL), m_bold(NULL), m_italic(NULL), m_underline(NULL), m_family(NULL) {}
|
||||
FontPropItem(QObject* object, ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& value,ObjectPropItem* parent, bool readonly);
|
||||
QWidget* createProperyEditor(QWidget *parent) const;
|
||||
FontPropItem():
|
||||
ObjectPropItem(),
|
||||
m_pointSize(NULL),
|
||||
m_bold(NULL),
|
||||
m_italic(NULL),
|
||||
m_underline(NULL),
|
||||
m_family(NULL)
|
||||
{
|
||||
}
|
||||
FontPropItem(QObject* object, ObjectsList* objects, const QString& name,
|
||||
const QString& displayName, const QVariant& value, ObjectPropItem* parent,
|
||||
bool readonly);
|
||||
QWidget* createProperyEditor(QWidget* parent) const;
|
||||
QString displayValue() const;
|
||||
void setPropertyEditorData(QWidget *propertyEditor, const QModelIndex &) const;
|
||||
void setModelData(QWidget *propertyEditor, QAbstractItemModel *model, const QModelIndex &index);
|
||||
void setPropertyEditorData(QWidget* propertyEditor, const QModelIndex&) const;
|
||||
void setModelData(QWidget* propertyEditor, QAbstractItemModel* model, const QModelIndex& index);
|
||||
void setPropertyValue(QVariant value);
|
||||
|
||||
protected:
|
||||
QString toString(QFont value) const;
|
||||
FontPointSizePropItem* m_pointSize;
|
||||
FontAttribPropItem *m_bold;
|
||||
FontAttribPropItem *m_italic;
|
||||
FontAttribPropItem *m_underline;
|
||||
FontFamilyPropItem *m_family;
|
||||
FontAttribPropItem* m_bold;
|
||||
FontAttribPropItem* m_italic;
|
||||
FontAttribPropItem* m_underline;
|
||||
FontFamilyPropItem* m_family;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace LimeReport
|
||||
#endif // LRFONTPROPITEM_H
|
||||
|
||||
@@ -28,55 +28,66 @@
|
||||
* GNU General Public License for more details. *
|
||||
****************************************************************************/
|
||||
#include "lrgroupfieldpropitem.h"
|
||||
|
||||
#include "../editors/lrcomboboxeditor.h"
|
||||
#include "lrgroupbands.h"
|
||||
#include "lrreportengine_p.h"
|
||||
|
||||
namespace {
|
||||
LimeReport::ObjectPropItem* createFieldPropItem(QObject *object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly){
|
||||
return new LimeReport::GroupFieldPropItem(object, objects, name, displayName, data, parent, readonly);
|
||||
}
|
||||
bool VARIABLE_IS_NOT_USED registredGroupFieldProp = LimeReport::ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("groupFieldName","LimeReport::GroupBandHeader"),QObject::tr("field"),createFieldPropItem
|
||||
);
|
||||
namespace {
|
||||
LimeReport::ObjectPropItem* createFieldPropItem(QObject* object,
|
||||
LimeReport::ObjectPropItem::ObjectsList* objects,
|
||||
const QString& name, const QString& displayName,
|
||||
const QVariant& data,
|
||||
LimeReport::ObjectPropItem* parent, bool readonly)
|
||||
{
|
||||
return new LimeReport::GroupFieldPropItem(object, objects, name, displayName, data, parent,
|
||||
readonly);
|
||||
}
|
||||
bool VARIABLE_IS_NOT_USED registredGroupFieldProp
|
||||
= LimeReport::ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("groupFieldName", "LimeReport::GroupBandHeader"),
|
||||
QObject::tr("field"), createFieldPropItem);
|
||||
} // namespace
|
||||
namespace LimeReport {
|
||||
|
||||
|
||||
QString findDatasourceName(BandDesignIntf* band){
|
||||
if (!band) return "";
|
||||
if (!band->datasourceName().isEmpty()) return band->datasourceName();
|
||||
else return findDatasourceName(band->parentBand());
|
||||
QString findDatasourceName(BandDesignIntf* band)
|
||||
{
|
||||
if (!band)
|
||||
return "";
|
||||
if (!band->datasourceName().isEmpty())
|
||||
return band->datasourceName();
|
||||
else
|
||||
return findDatasourceName(band->parentBand());
|
||||
}
|
||||
|
||||
QWidget *GroupFieldPropItem::createProperyEditor(QWidget *parent) const
|
||||
QWidget* GroupFieldPropItem::createProperyEditor(QWidget* parent) const
|
||||
{
|
||||
ComboBoxEditor *editor = new ComboBoxEditor(parent,true);
|
||||
ComboBoxEditor* editor = new ComboBoxEditor(parent, true);
|
||||
editor->setEditable(true);
|
||||
GroupBandHeader *item=dynamic_cast<GroupBandHeader*>(object());
|
||||
if (item){
|
||||
GroupBandHeader* item = dynamic_cast<GroupBandHeader*>(object());
|
||||
if (item) {
|
||||
BandDesignIntf* dataBand = dynamic_cast<BandDesignIntf*>(item->parentBand());
|
||||
if (dataBand){
|
||||
if (dataBand) {
|
||||
QString datasourceName = findDatasourceName(dataBand);
|
||||
if (!datasourceName.isEmpty()){
|
||||
editor->addItems(item->reportEditor()->dataManager()->fieldNames(datasourceName));
|
||||
if (!datasourceName.isEmpty()) {
|
||||
editor->addItems(item->reportEditor()->dataManager()->fieldNames(datasourceName));
|
||||
}
|
||||
}
|
||||
}
|
||||
return editor;
|
||||
}
|
||||
|
||||
void GroupFieldPropItem::setPropertyEditorData(QWidget *propertyEditor, const QModelIndex &) const
|
||||
void GroupFieldPropItem::setPropertyEditorData(QWidget* propertyEditor, const QModelIndex&) const
|
||||
{
|
||||
ComboBoxEditor *editor=qobject_cast<ComboBoxEditor *>(propertyEditor);
|
||||
ComboBoxEditor* editor = qobject_cast<ComboBoxEditor*>(propertyEditor);
|
||||
editor->setTextValue(propertyValue().toString());
|
||||
}
|
||||
|
||||
void GroupFieldPropItem::setModelData(QWidget *propertyEditor, QAbstractItemModel *model, const QModelIndex &index)
|
||||
void GroupFieldPropItem::setModelData(QWidget* propertyEditor, QAbstractItemModel* model,
|
||||
const QModelIndex& index)
|
||||
{
|
||||
model->setData(index,qobject_cast<ComboBoxEditor*>(propertyEditor)->text());
|
||||
object()->setProperty(propertyName().toLatin1(),propertyValue());
|
||||
}
|
||||
|
||||
model->setData(index, qobject_cast<ComboBoxEditor*>(propertyEditor)->text());
|
||||
object()->setProperty(propertyName().toLatin1(), propertyValue());
|
||||
}
|
||||
|
||||
} // namespace LimeReport
|
||||
|
||||
@@ -31,19 +31,21 @@
|
||||
#define LRGROUPFIELDPROPITEM_H
|
||||
|
||||
#include "lrobjectpropitem.h"
|
||||
namespace LimeReport{
|
||||
namespace LimeReport {
|
||||
|
||||
class GroupFieldPropItem : public ObjectPropItem
|
||||
{
|
||||
class GroupFieldPropItem: public ObjectPropItem {
|
||||
public:
|
||||
GroupFieldPropItem(QObject* object, ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& value,ObjectPropItem* parent, bool readonly)
|
||||
:ObjectPropItem(object, objects, name, displayName, value, parent, readonly){}
|
||||
QWidget* createProperyEditor(QWidget *parent) const;
|
||||
void setPropertyEditorData(QWidget *propertyEditor, const QModelIndex &) const;
|
||||
void setModelData(QWidget *propertyEditor, QAbstractItemModel *model, const QModelIndex &index);
|
||||
GroupFieldPropItem(QObject* object, ObjectsList* objects, const QString& name,
|
||||
const QString& displayName, const QVariant& value, ObjectPropItem* parent,
|
||||
bool readonly):
|
||||
ObjectPropItem(object, objects, name, displayName, value, parent, readonly)
|
||||
{
|
||||
}
|
||||
QWidget* createProperyEditor(QWidget* parent) const;
|
||||
void setPropertyEditorData(QWidget* propertyEditor, const QModelIndex&) const;
|
||||
void setModelData(QWidget* propertyEditor, QAbstractItemModel* model, const QModelIndex& index);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
} // namespace LimeReport
|
||||
|
||||
#endif // LRGROUPFIELDPROPITEM_H
|
||||
|
||||
@@ -28,20 +28,27 @@
|
||||
* GNU General Public License for more details. *
|
||||
****************************************************************************/
|
||||
#include "lrimagepropitem.h"
|
||||
|
||||
#include "editors/lrimageeditor.h"
|
||||
|
||||
namespace{
|
||||
LimeReport::ObjectPropItem * createImagePropItem(
|
||||
QObject *object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly)
|
||||
{
|
||||
return new LimeReport::ImagePropItem(object, objects, name, displayName, data, parent, readonly);
|
||||
}
|
||||
bool VARIABLE_IS_NOT_USED registredImageProp = LimeReport::ObjectPropFactory::instance().registerCreator(LimeReport::APropIdent("QImage",""),QObject::tr("QImage"),createImagePropItem);
|
||||
namespace {
|
||||
LimeReport::ObjectPropItem* createImagePropItem(QObject* object,
|
||||
LimeReport::ObjectPropItem::ObjectsList* objects,
|
||||
const QString& name, const QString& displayName,
|
||||
const QVariant& data,
|
||||
LimeReport::ObjectPropItem* parent, bool readonly)
|
||||
{
|
||||
return new LimeReport::ImagePropItem(object, objects, name, displayName, data, parent,
|
||||
readonly);
|
||||
}
|
||||
bool VARIABLE_IS_NOT_USED registredImageProp
|
||||
= LimeReport::ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("QImage", ""), QObject::tr("QImage"), createImagePropItem);
|
||||
} // namespace
|
||||
|
||||
namespace LimeReport{
|
||||
namespace LimeReport {
|
||||
|
||||
QWidget* ImagePropItem::createProperyEditor(QWidget *parent) const
|
||||
QWidget* ImagePropItem::createProperyEditor(QWidget* parent) const
|
||||
{
|
||||
return new ImageEditor(parent);
|
||||
}
|
||||
@@ -51,16 +58,17 @@ QString ImagePropItem::displayValue() const
|
||||
return (propertyValue().isNull()) ? "" : QObject::tr("image");
|
||||
}
|
||||
|
||||
void ImagePropItem::setPropertyEditorData(QWidget *propertyEditor, const QModelIndex &) const
|
||||
void ImagePropItem::setPropertyEditorData(QWidget* propertyEditor, const QModelIndex&) const
|
||||
{
|
||||
ImageEditor *editor = qobject_cast<ImageEditor*>(propertyEditor);
|
||||
ImageEditor* editor = qobject_cast<ImageEditor*>(propertyEditor);
|
||||
editor->setImage(propertyValue().value<QImage>());
|
||||
}
|
||||
|
||||
void ImagePropItem::setModelData(QWidget *propertyEditor, QAbstractItemModel *model, const QModelIndex &index)
|
||||
void ImagePropItem::setModelData(QWidget* propertyEditor, QAbstractItemModel* model,
|
||||
const QModelIndex& index)
|
||||
{
|
||||
model->setData(index,qobject_cast<ImageEditor*>(propertyEditor)->image());
|
||||
object()->setProperty(propertyName().toLatin1(),propertyValue());
|
||||
model->setData(index, qobject_cast<ImageEditor*>(propertyEditor)->image());
|
||||
object()->setProperty(propertyName().toLatin1(), propertyValue());
|
||||
}
|
||||
|
||||
QIcon ImagePropItem::iconValue() const
|
||||
@@ -68,4 +76,4 @@ QIcon ImagePropItem::iconValue() const
|
||||
return QIcon(QPixmap::fromImage(propertyValue().value<QImage>()));
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace LimeReport
|
||||
|
||||
@@ -31,21 +31,24 @@
|
||||
#define LRIMAGEPROPITEM_H
|
||||
|
||||
#include "lrobjectpropitem.h"
|
||||
namespace LimeReport{
|
||||
namespace LimeReport {
|
||||
|
||||
class ImagePropItem : public ObjectPropItem
|
||||
{
|
||||
class ImagePropItem: public ObjectPropItem {
|
||||
Q_OBJECT
|
||||
public:
|
||||
ImagePropItem():ObjectPropItem(){}
|
||||
ImagePropItem(QObject* object, ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& value,ObjectPropItem* parent, bool readonly)
|
||||
:ObjectPropItem(object, objects, name, displayName, value, parent, readonly){}
|
||||
QWidget* createProperyEditor(QWidget *parent) const;
|
||||
ImagePropItem(): ObjectPropItem() { }
|
||||
ImagePropItem(QObject* object, ObjectsList* objects, const QString& name,
|
||||
const QString& displayName, const QVariant& value, ObjectPropItem* parent,
|
||||
bool readonly):
|
||||
ObjectPropItem(object, objects, name, displayName, value, parent, readonly)
|
||||
{
|
||||
}
|
||||
QWidget* createProperyEditor(QWidget* parent) const;
|
||||
QString displayValue() const;
|
||||
void setPropertyEditorData(QWidget *propertyEditor, const QModelIndex &) const;
|
||||
void setModelData(QWidget *propertyEditor, QAbstractItemModel *model, const QModelIndex &index);
|
||||
void setPropertyEditorData(QWidget* propertyEditor, const QModelIndex&) const;
|
||||
void setModelData(QWidget* propertyEditor, QAbstractItemModel* model, const QModelIndex& index);
|
||||
virtual QIcon iconValue() const;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace LimeReport
|
||||
#endif // LRIMAGEPROPITEM_H
|
||||
|
||||
@@ -28,56 +28,62 @@
|
||||
* GNU General Public License for more details. *
|
||||
****************************************************************************/
|
||||
#include "lrintpropitem.h"
|
||||
#include <limits>
|
||||
|
||||
#include <QDoubleSpinBox>
|
||||
#include <QHBoxLayout>
|
||||
|
||||
namespace{
|
||||
LimeReport::ObjectPropItem * createIntPropItem(
|
||||
QObject *object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly)
|
||||
{
|
||||
return new LimeReport::IntPropItem(object, objects, name, displayName, data, parent, readonly);
|
||||
}
|
||||
bool VARIABLE_IS_NOT_USED registred = LimeReport::ObjectPropFactory::instance().registerCreator(LimeReport::APropIdent("int",""),QObject::tr("int"),createIntPropItem);
|
||||
#include <limits>
|
||||
|
||||
namespace {
|
||||
LimeReport::ObjectPropItem* createIntPropItem(QObject* object,
|
||||
LimeReport::ObjectPropItem::ObjectsList* objects,
|
||||
const QString& name, const QString& displayName,
|
||||
const QVariant& data,
|
||||
LimeReport::ObjectPropItem* parent, bool readonly)
|
||||
{
|
||||
return new LimeReport::IntPropItem(object, objects, name, displayName, data, parent, readonly);
|
||||
}
|
||||
bool VARIABLE_IS_NOT_USED registred = LimeReport::ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("int", ""), QObject::tr("int"), createIntPropItem);
|
||||
} // namespace
|
||||
|
||||
namespace LimeReport{
|
||||
namespace LimeReport {
|
||||
|
||||
QWidget *IntPropItem::createProperyEditor(QWidget *parent) const
|
||||
QWidget* IntPropItem::createProperyEditor(QWidget* parent) const
|
||||
{
|
||||
// QWidget* base = new QWidget(parent);
|
||||
// QHBoxLayout* layout = new QHBoxLayout();
|
||||
// base->setLayout(layout);
|
||||
// QWidget* base = new QWidget(parent);
|
||||
// QHBoxLayout* layout = new QHBoxLayout();
|
||||
// base->setLayout(layout);
|
||||
|
||||
// QSpinBox *editor = new QSpinBox(parent);
|
||||
// editor->setMaximum(std::numeric_limits<int>::max());
|
||||
// editor->setMinimum(std::numeric_limits<int>::min());
|
||||
// QSpinBox *editor = new QSpinBox(parent);
|
||||
// editor->setMaximum(std::numeric_limits<int>::max());
|
||||
// editor->setMinimum(std::numeric_limits<int>::min());
|
||||
|
||||
// layout->addWidget(editor);
|
||||
// layout->addWidget(editor);
|
||||
return new SpinBoxEditor(parent);
|
||||
}
|
||||
|
||||
void IntPropItem::setPropertyEditorData(QWidget *propertyEditor, const QModelIndex &) const
|
||||
void IntPropItem::setPropertyEditorData(QWidget* propertyEditor, const QModelIndex&) const
|
||||
{
|
||||
SpinBoxEditor *editor =qobject_cast<SpinBoxEditor *>(propertyEditor);
|
||||
SpinBoxEditor* editor = qobject_cast<SpinBoxEditor*>(propertyEditor);
|
||||
editor->setValue(propertyValue().toInt());
|
||||
}
|
||||
|
||||
void IntPropItem::setModelData(QWidget *propertyEditor, QAbstractItemModel *model, const QModelIndex &index)
|
||||
void IntPropItem::setModelData(QWidget* propertyEditor, QAbstractItemModel* model,
|
||||
const QModelIndex& index)
|
||||
{
|
||||
model->setData(index,qobject_cast<SpinBoxEditor*>(propertyEditor)->value());
|
||||
object()->setProperty(propertyName().toLatin1(),propertyValue());
|
||||
if (objects()){
|
||||
foreach(QObject* item, *objects()){
|
||||
if (item->metaObject()->indexOfProperty(propertyName().toLatin1())!=-1){
|
||||
item->setProperty(propertyName().toLatin1(),propertyValue());
|
||||
model->setData(index, qobject_cast<SpinBoxEditor*>(propertyEditor)->value());
|
||||
object()->setProperty(propertyName().toLatin1(), propertyValue());
|
||||
if (objects()) {
|
||||
foreach (QObject* item, *objects()) {
|
||||
if (item->metaObject()->indexOfProperty(propertyName().toLatin1()) != -1) {
|
||||
item->setProperty(propertyName().toLatin1(), propertyValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SpinBoxEditor::SpinBoxEditor(QWidget *parent)
|
||||
:QWidget(parent)
|
||||
SpinBoxEditor::SpinBoxEditor(QWidget* parent): QWidget(parent)
|
||||
{
|
||||
m_valueEditor = new QSpinBox(this);
|
||||
m_valueEditor->setMinimum(std::numeric_limits<int>::min());
|
||||
@@ -85,20 +91,14 @@ SpinBoxEditor::SpinBoxEditor(QWidget *parent)
|
||||
setFocusProxy(m_valueEditor);
|
||||
QHBoxLayout* hLayout = new QHBoxLayout(this);
|
||||
hLayout->addWidget(m_valueEditor);
|
||||
hLayout->setContentsMargins(1,1,1,1);
|
||||
hLayout->setContentsMargins(1, 1, 1, 1);
|
||||
hLayout->setSpacing(0);
|
||||
setAutoFillBackground(true);
|
||||
connect(m_valueEditor, SIGNAL(editingFinished()), this, SIGNAL(editingFinished()));
|
||||
}
|
||||
|
||||
int SpinBoxEditor::value()
|
||||
{
|
||||
return m_valueEditor->value();
|
||||
}
|
||||
int SpinBoxEditor::value() { return m_valueEditor->value(); }
|
||||
|
||||
void SpinBoxEditor::setValue(int value)
|
||||
{
|
||||
m_valueEditor->setValue(value);
|
||||
}
|
||||
void SpinBoxEditor::setValue(int value) { m_valueEditor->setValue(value); }
|
||||
|
||||
} // namespace LimeReport
|
||||
|
||||
@@ -31,11 +31,12 @@
|
||||
#define LRINTPROPITEM_H
|
||||
|
||||
#include "lrobjectpropitem.h"
|
||||
|
||||
#include <QSpinBox>
|
||||
|
||||
namespace LimeReport {
|
||||
|
||||
class SpinBoxEditor : public QWidget{
|
||||
class SpinBoxEditor: public QWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
SpinBoxEditor(QWidget* parent);
|
||||
@@ -43,20 +44,24 @@ public:
|
||||
void setValue(int value);
|
||||
signals:
|
||||
void editingFinished();
|
||||
|
||||
private:
|
||||
QSpinBox* m_valueEditor;
|
||||
};
|
||||
|
||||
class IntPropItem : public ObjectPropItem
|
||||
{
|
||||
class IntPropItem: public ObjectPropItem {
|
||||
Q_OBJECT
|
||||
public:
|
||||
IntPropItem():ObjectPropItem(){}
|
||||
IntPropItem(QObject* object, ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& value, ObjectPropItem* parent, bool readonly)
|
||||
:ObjectPropItem(object, objects, name, displayName, value, parent, readonly){}
|
||||
QWidget* createProperyEditor(QWidget *parent) const;
|
||||
void setPropertyEditorData(QWidget * propertyEditor, const QModelIndex &) const;
|
||||
void setModelData(QWidget * propertyEditor, QAbstractItemModel * model, const QModelIndex & index);
|
||||
IntPropItem(): ObjectPropItem() { }
|
||||
IntPropItem(QObject* object, ObjectsList* objects, const QString& name,
|
||||
const QString& displayName, const QVariant& value, ObjectPropItem* parent,
|
||||
bool readonly):
|
||||
ObjectPropItem(object, objects, name, displayName, value, parent, readonly)
|
||||
{
|
||||
}
|
||||
QWidget* createProperyEditor(QWidget* parent) const;
|
||||
void setPropertyEditorData(QWidget* propertyEditor, const QModelIndex&) const;
|
||||
void setModelData(QWidget* propertyEditor, QAbstractItemModel* model, const QModelIndex& index);
|
||||
};
|
||||
|
||||
} // namespace LimeReport
|
||||
|
||||
@@ -1,68 +1,77 @@
|
||||
#include "lrmarginpropitem.h"
|
||||
#include <QDoubleSpinBox>
|
||||
#include <limits>
|
||||
|
||||
#include "lrbasedesignintf.h"
|
||||
|
||||
namespace {
|
||||
LimeReport::ObjectPropItem * createMarginPropItem(
|
||||
QObject *object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly)
|
||||
{
|
||||
return new LimeReport::MarginPropItem(object, objects, name, displayName, data, parent, readonly);
|
||||
}
|
||||
bool VARIABLE_IS_NOT_USED registredTopMargin = LimeReport::ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("topMargin","LimeReport::PageItemDesignIntf"),
|
||||
QObject::tr("margin"),createMarginPropItem
|
||||
);
|
||||
bool VARIABLE_IS_NOT_USED registredRightMargin = LimeReport::ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("rightMargin","LimeReport::PageItemDesignIntf"),
|
||||
QObject::tr("margin"),createMarginPropItem
|
||||
);
|
||||
bool VARIABLE_IS_NOT_USED registredBottomMargin = LimeReport::ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("bottomMargin","LimeReport::PageItemDesignIntf"),
|
||||
QObject::tr("margin"),createMarginPropItem
|
||||
);
|
||||
bool VARIABLE_IS_NOT_USED registredLeftMargin = LimeReport::ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("leftMargin","LimeReport::PageItemDesignIntf"),
|
||||
QObject::tr("margin"),createMarginPropItem
|
||||
);
|
||||
#include <QDoubleSpinBox>
|
||||
|
||||
#include <limits>
|
||||
|
||||
namespace {
|
||||
LimeReport::ObjectPropItem* createMarginPropItem(QObject* object,
|
||||
LimeReport::ObjectPropItem::ObjectsList* objects,
|
||||
const QString& name, const QString& displayName,
|
||||
const QVariant& data,
|
||||
LimeReport::ObjectPropItem* parent, bool readonly)
|
||||
{
|
||||
return new LimeReport::MarginPropItem(object, objects, name, displayName, data, parent,
|
||||
readonly);
|
||||
}
|
||||
bool VARIABLE_IS_NOT_USED registredTopMargin
|
||||
= LimeReport::ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("topMargin", "LimeReport::PageItemDesignIntf"),
|
||||
QObject::tr("margin"), createMarginPropItem);
|
||||
bool VARIABLE_IS_NOT_USED registredRightMargin
|
||||
= LimeReport::ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("rightMargin", "LimeReport::PageItemDesignIntf"),
|
||||
QObject::tr("margin"), createMarginPropItem);
|
||||
bool VARIABLE_IS_NOT_USED registredBottomMargin
|
||||
= LimeReport::ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("bottomMargin", "LimeReport::PageItemDesignIntf"),
|
||||
QObject::tr("margin"), createMarginPropItem);
|
||||
bool VARIABLE_IS_NOT_USED registredLeftMargin
|
||||
= LimeReport::ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("leftMargin", "LimeReport::PageItemDesignIntf"),
|
||||
QObject::tr("margin"), createMarginPropItem);
|
||||
} // namespace
|
||||
|
||||
namespace LimeReport{
|
||||
|
||||
namespace LimeReport {
|
||||
|
||||
QString MarginPropItem::displayValue() const
|
||||
{
|
||||
LimeReport::BaseDesignIntf * item = dynamic_cast<LimeReport::BaseDesignIntf*>(object());
|
||||
LimeReport::BaseDesignIntf* item = dynamic_cast<LimeReport::BaseDesignIntf*>(object());
|
||||
switch (item->unitType()) {
|
||||
case LimeReport::BaseDesignIntf::Millimeters:
|
||||
|
||||
return QString("%1 %2").arg(propertyValue().toDouble(), 0, 'f', 2)
|
||||
.arg(QObject::tr("mm"));
|
||||
return QString("%1 %2").arg(propertyValue().toDouble(), 0, 'f', 2).arg(QObject::tr("mm"));
|
||||
case LimeReport::BaseDesignIntf::Inches:
|
||||
return QString("%1 %2").arg((propertyValue().toDouble() * Const::mmFACTOR) / (item->unitFactor() * 10), 0, 'f', 2)
|
||||
.arg(QObject::tr("''"));
|
||||
return QString("%1 %2")
|
||||
.arg((propertyValue().toDouble() * Const::mmFACTOR) / (item->unitFactor() * 10), 0, 'f',
|
||||
2)
|
||||
.arg(QObject::tr("''"));
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
||||
QWidget *MarginPropItem::createProperyEditor(QWidget *parent) const
|
||||
QWidget* MarginPropItem::createProperyEditor(QWidget* parent) const
|
||||
{
|
||||
QDoubleSpinBox *editor= new QDoubleSpinBox(parent);
|
||||
QDoubleSpinBox* editor = new QDoubleSpinBox(parent);
|
||||
editor->setMaximum(std::numeric_limits<qreal>::max());
|
||||
editor->setMinimum(std::numeric_limits<qreal>::max()*-1);
|
||||
editor->setSuffix(" "+unitShortName());
|
||||
editor->setMinimum(std::numeric_limits<qreal>::max() * -1);
|
||||
editor->setSuffix(" " + unitShortName());
|
||||
return editor;
|
||||
}
|
||||
|
||||
void MarginPropItem::setPropertyEditorData(QWidget *propertyEditor, const QModelIndex &) const
|
||||
void MarginPropItem::setPropertyEditorData(QWidget* propertyEditor, const QModelIndex&) const
|
||||
{
|
||||
QDoubleSpinBox *editor =qobject_cast<QDoubleSpinBox*>(propertyEditor);
|
||||
QDoubleSpinBox* editor = qobject_cast<QDoubleSpinBox*>(propertyEditor);
|
||||
editor->setValue(valueInUnits(propertyValue().toReal()));
|
||||
}
|
||||
|
||||
void MarginPropItem::setModelData(QWidget *propertyEditor, QAbstractItemModel *model, const QModelIndex &index)
|
||||
void MarginPropItem::setModelData(QWidget* propertyEditor, QAbstractItemModel* model,
|
||||
const QModelIndex& index)
|
||||
{
|
||||
model->setData(index, valueInReportUnits(qobject_cast<QDoubleSpinBox*>(propertyEditor)->value()));
|
||||
model->setData(index,
|
||||
valueInReportUnits(qobject_cast<QDoubleSpinBox*>(propertyEditor)->value()));
|
||||
setValueToObject(propertyName(), propertyValue());
|
||||
}
|
||||
|
||||
|
||||
@@ -5,17 +5,21 @@
|
||||
|
||||
namespace LimeReport {
|
||||
|
||||
class MarginPropItem : public ObjectPropItem
|
||||
{
|
||||
class MarginPropItem: public ObjectPropItem {
|
||||
Q_OBJECT
|
||||
public:
|
||||
MarginPropItem():ObjectPropItem(){}
|
||||
MarginPropItem(QObject* object, ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& value,ObjectPropItem* parent, bool readonly)
|
||||
:ObjectPropItem(object, objects, name, displayName, value, parent, readonly){}
|
||||
MarginPropItem(): ObjectPropItem() { }
|
||||
MarginPropItem(QObject* object, ObjectsList* objects, const QString& name,
|
||||
const QString& displayName, const QVariant& value, ObjectPropItem* parent,
|
||||
bool readonly):
|
||||
ObjectPropItem(object, objects, name, displayName, value, parent, readonly)
|
||||
{
|
||||
}
|
||||
QString displayValue() const;
|
||||
QWidget* createProperyEditor(QWidget *parent) const;
|
||||
void setPropertyEditorData(QWidget * propertyEditor, const QModelIndex &) const;
|
||||
void setModelData(QWidget * propertyEditor, QAbstractItemModel * model, const QModelIndex & index);
|
||||
QWidget* createProperyEditor(QWidget* parent) const;
|
||||
void setPropertyEditorData(QWidget* propertyEditor, const QModelIndex&) const;
|
||||
void setModelData(QWidget* propertyEditor, QAbstractItemModel* model, const QModelIndex& index);
|
||||
|
||||
private:
|
||||
qreal valueInUnits(qreal value) const;
|
||||
qreal valueInReportUnits(qreal value) const;
|
||||
@@ -24,5 +28,4 @@ private:
|
||||
|
||||
} // namespace LimeReport
|
||||
|
||||
|
||||
#endif // LRMARGINPROPITEM_H
|
||||
|
||||
@@ -30,39 +30,48 @@
|
||||
#include "lrqrealpropitem.h"
|
||||
|
||||
#include <QDoubleSpinBox>
|
||||
|
||||
#include <limits>
|
||||
|
||||
namespace{
|
||||
LimeReport::ObjectPropItem * createQRealPropItem(
|
||||
QObject *object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly)
|
||||
{
|
||||
return new LimeReport::QRealPropItem(object, objects, name, displayName, data, parent, readonly);
|
||||
}
|
||||
|
||||
bool VARIABLE_IS_NOT_USED registred = LimeReport::ObjectPropFactory::instance().registerCreator(LimeReport::APropIdent("qreal",""),QObject::tr("qreal"),createQRealPropItem);
|
||||
bool VARIABLE_IS_NOT_USED registredDouble = LimeReport::ObjectPropFactory::instance().registerCreator(LimeReport::APropIdent("double",""),QObject::tr("qreal"),createQRealPropItem);
|
||||
namespace {
|
||||
LimeReport::ObjectPropItem* createQRealPropItem(QObject* object,
|
||||
LimeReport::ObjectPropItem::ObjectsList* objects,
|
||||
const QString& name, const QString& displayName,
|
||||
const QVariant& data,
|
||||
LimeReport::ObjectPropItem* parent, bool readonly)
|
||||
{
|
||||
return new LimeReport::QRealPropItem(object, objects, name, displayName, data, parent,
|
||||
readonly);
|
||||
}
|
||||
|
||||
namespace LimeReport{
|
||||
bool VARIABLE_IS_NOT_USED registred = LimeReport::ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("qreal", ""), QObject::tr("qreal"), createQRealPropItem);
|
||||
bool VARIABLE_IS_NOT_USED registredDouble
|
||||
= LimeReport::ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("double", ""), QObject::tr("qreal"), createQRealPropItem);
|
||||
} // namespace
|
||||
|
||||
QWidget *QRealPropItem::createProperyEditor(QWidget *parent) const
|
||||
namespace LimeReport {
|
||||
|
||||
QWidget* QRealPropItem::createProperyEditor(QWidget* parent) const
|
||||
{
|
||||
QDoubleSpinBox *editor= new QDoubleSpinBox(parent);
|
||||
QDoubleSpinBox* editor = new QDoubleSpinBox(parent);
|
||||
editor->setMaximum(std::numeric_limits<qreal>::max());
|
||||
editor->setMinimum(std::numeric_limits<qreal>::max()*-1);
|
||||
editor->setMinimum(std::numeric_limits<qreal>::max() * -1);
|
||||
return editor;
|
||||
}
|
||||
|
||||
void QRealPropItem::setPropertyEditorData(QWidget *propertyEditor, const QModelIndex &) const
|
||||
void QRealPropItem::setPropertyEditorData(QWidget* propertyEditor, const QModelIndex&) const
|
||||
{
|
||||
QDoubleSpinBox *editor =qobject_cast<QDoubleSpinBox*>(propertyEditor);
|
||||
QDoubleSpinBox* editor = qobject_cast<QDoubleSpinBox*>(propertyEditor);
|
||||
editor->setValue(propertyValue().toDouble());
|
||||
}
|
||||
|
||||
void QRealPropItem::setModelData(QWidget *propertyEditor, QAbstractItemModel *model, const QModelIndex &index)
|
||||
void QRealPropItem::setModelData(QWidget* propertyEditor, QAbstractItemModel* model,
|
||||
const QModelIndex& index)
|
||||
{
|
||||
model->setData(index,qobject_cast<QDoubleSpinBox*>(propertyEditor)->value());
|
||||
setValueToObject(propertyName(),propertyValue());
|
||||
model->setData(index, qobject_cast<QDoubleSpinBox*>(propertyEditor)->value());
|
||||
setValueToObject(propertyName(), propertyValue());
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace LimeReport
|
||||
|
||||
@@ -34,17 +34,20 @@
|
||||
|
||||
namespace LimeReport {
|
||||
|
||||
class QRealPropItem : public ObjectPropItem
|
||||
{
|
||||
class QRealPropItem: public ObjectPropItem {
|
||||
Q_OBJECT
|
||||
public:
|
||||
QRealPropItem():ObjectPropItem(){}
|
||||
QRealPropItem(QObject* object, ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& value,ObjectPropItem* parent, bool readonly)
|
||||
:ObjectPropItem(object, objects, name, displayName, value, parent, readonly){}
|
||||
QWidget* createProperyEditor(QWidget *parent) const;
|
||||
void setPropertyEditorData(QWidget * propertyEditor, const QModelIndex &) const;
|
||||
void setModelData(QWidget * propertyEditor, QAbstractItemModel * model, const QModelIndex & index);
|
||||
QRealPropItem(): ObjectPropItem() { }
|
||||
QRealPropItem(QObject* object, ObjectsList* objects, const QString& name,
|
||||
const QString& displayName, const QVariant& value, ObjectPropItem* parent,
|
||||
bool readonly):
|
||||
ObjectPropItem(object, objects, name, displayName, value, parent, readonly)
|
||||
{
|
||||
}
|
||||
QWidget* createProperyEditor(QWidget* parent) const;
|
||||
void setPropertyEditorData(QWidget* propertyEditor, const QModelIndex&) const;
|
||||
void setModelData(QWidget* propertyEditor, QAbstractItemModel* model, const QModelIndex& index);
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace LimeReport
|
||||
#endif // LRQREALPROPITEM_H
|
||||
|
||||
@@ -28,150 +28,213 @@
|
||||
* GNU General Public License for more details. *
|
||||
****************************************************************************/
|
||||
#include "lrrectproptem.h"
|
||||
#include "lrobjectpropitem.h"
|
||||
|
||||
#include "lrbanddesignintf.h"
|
||||
#include "lrpageitemdesignintf.h"
|
||||
#include "lrglobal.h"
|
||||
#include "lrobjectitemmodel.h"
|
||||
#include "lrobjectpropitem.h"
|
||||
#include "lrpageitemdesignintf.h"
|
||||
|
||||
#include <QAbstractItemModel>
|
||||
#include <QRect>
|
||||
#include <QDoubleSpinBox>
|
||||
#include <QDebug>
|
||||
#include <QDoubleSpinBox>
|
||||
#include <QRect>
|
||||
|
||||
namespace{
|
||||
LimeReport::ObjectPropItem * createReqtItem(
|
||||
QObject *object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly
|
||||
){
|
||||
return new LimeReport::RectPropItem(object, objects, name, displayName, data, parent, readonly);
|
||||
}
|
||||
LimeReport::ObjectPropItem * createReqtUnitItem(
|
||||
QObject*object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly
|
||||
){
|
||||
return new LimeReport::RectUnitPropItem(object, objects, name, displayName, data, parent, readonly);
|
||||
}
|
||||
bool VARIABLE_IS_NOT_USED registredRectProp = LimeReport::ObjectPropFactory::instance().registerCreator(LimeReport::APropIdent("QRect",""),QObject::tr("QRect"),createReqtItem);
|
||||
bool VARIABLE_IS_NOT_USED registredRectFProp = LimeReport::ObjectPropFactory::instance().registerCreator(LimeReport::APropIdent("QRectF",""),QObject::tr("QRectF"),createReqtItem);
|
||||
bool VARIABLE_IS_NOT_USED registredRectMMProp = LimeReport::ObjectPropFactory::instance().registerCreator(LimeReport::APropIdent("geometry","LimeReport::BaseDesignIntf"),QObject::tr("geometry"),createReqtUnitItem);
|
||||
}
|
||||
|
||||
namespace LimeReport{
|
||||
|
||||
template<class T> QString rectToString(T rect)
|
||||
namespace {
|
||||
LimeReport::ObjectPropItem* createReqtItem(QObject* object,
|
||||
LimeReport::ObjectPropItem::ObjectsList* objects,
|
||||
const QString& name, const QString& displayName,
|
||||
const QVariant& data, LimeReport::ObjectPropItem* parent,
|
||||
bool readonly)
|
||||
{
|
||||
return QString("[%1,%2] %3x%4").arg(rect.x()).arg(rect.y()).arg(rect.width()).arg(rect.height());
|
||||
return new LimeReport::RectPropItem(object, objects, name, displayName, data, parent, readonly);
|
||||
}
|
||||
LimeReport::ObjectPropItem* createReqtUnitItem(QObject* object,
|
||||
LimeReport::ObjectPropItem::ObjectsList* objects,
|
||||
const QString& name, const QString& displayName,
|
||||
const QVariant& data,
|
||||
LimeReport::ObjectPropItem* parent, bool readonly)
|
||||
{
|
||||
return new LimeReport::RectUnitPropItem(object, objects, name, displayName, data, parent,
|
||||
readonly);
|
||||
}
|
||||
bool VARIABLE_IS_NOT_USED registredRectProp
|
||||
= LimeReport::ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("QRect", ""), QObject::tr("QRect"), createReqtItem);
|
||||
bool VARIABLE_IS_NOT_USED registredRectFProp
|
||||
= LimeReport::ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("QRectF", ""), QObject::tr("QRectF"), createReqtItem);
|
||||
bool VARIABLE_IS_NOT_USED registredRectMMProp
|
||||
= LimeReport::ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("geometry", "LimeReport::BaseDesignIntf"), QObject::tr("geometry"),
|
||||
createReqtUnitItem);
|
||||
} // namespace
|
||||
|
||||
namespace LimeReport {
|
||||
|
||||
template <class T> QString rectToString(T rect)
|
||||
{
|
||||
return QString("[%1,%2] %3x%4")
|
||||
.arg(rect.x())
|
||||
.arg(rect.y())
|
||||
.arg(rect.width())
|
||||
.arg(rect.height());
|
||||
}
|
||||
|
||||
QRectF modifyRect(QRectF rect, const QString& name, qreal itemValue){
|
||||
if (name=="x"){qreal width=rect.width(); rect.setX(itemValue); rect.setWidth(width);}
|
||||
if (name=="y"){qreal heigh=rect.height(); rect.setY(itemValue); rect.setHeight(heigh);}
|
||||
if (name=="height"){rect.setHeight(itemValue);}
|
||||
if (name=="width"){rect.setWidth(itemValue);}
|
||||
QRectF modifyRect(QRectF rect, const QString& name, qreal itemValue)
|
||||
{
|
||||
if (name == "x") {
|
||||
qreal width = rect.width();
|
||||
rect.setX(itemValue);
|
||||
rect.setWidth(width);
|
||||
}
|
||||
if (name == "y") {
|
||||
qreal heigh = rect.height();
|
||||
rect.setY(itemValue);
|
||||
rect.setHeight(heigh);
|
||||
}
|
||||
if (name == "height") {
|
||||
rect.setHeight(itemValue);
|
||||
}
|
||||
if (name == "width") {
|
||||
rect.setWidth(itemValue);
|
||||
}
|
||||
|
||||
return rect;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace LimeReport
|
||||
|
||||
LimeReport::RectPropItem::RectPropItem(QObject *object, ObjectsList* objects, const QString &name, const QString &displayName, const QVariant &value, ObjectPropItem *parent, bool readonly):
|
||||
ObjectPropItem(object, objects, name, displayName, value,parent,readonly)
|
||||
LimeReport::RectPropItem::RectPropItem(QObject* object, ObjectsList* objects, const QString& name,
|
||||
const QString& displayName, const QVariant& value,
|
||||
ObjectPropItem* parent, bool readonly):
|
||||
ObjectPropItem(object, objects, name, displayName, value, parent, readonly)
|
||||
{
|
||||
QRect rect=value.toRect();
|
||||
this->appendItem(new ObjectPropItem(object, objects, "x","x", rect.x(),this));
|
||||
this->appendItem(new ObjectPropItem(object, objects, "y","x", rect.y(),this));
|
||||
this->appendItem(new ObjectPropItem(object, objects, "width",tr("width"), rect.width(),this));
|
||||
this->appendItem(new ObjectPropItem(object, objects, "heigh",tr("height"),rect.height(),this));
|
||||
QRect rect = value.toRect();
|
||||
this->appendItem(new ObjectPropItem(object, objects, "x", "x", rect.x(), this));
|
||||
this->appendItem(new ObjectPropItem(object, objects, "y", "x", rect.y(), this));
|
||||
this->appendItem(new ObjectPropItem(object, objects, "width", tr("width"), rect.width(), this));
|
||||
this->appendItem(
|
||||
new ObjectPropItem(object, objects, "heigh", tr("height"), rect.height(), this));
|
||||
}
|
||||
|
||||
QString LimeReport::RectPropItem::displayValue() const
|
||||
{
|
||||
//TODO: Migrate to QMetaType
|
||||
// TODO: Migrate to QMetaType
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
switch(propertyValue().typeId()){
|
||||
case QMetaType::QRect:
|
||||
return rectToString(propertyValue().toRect());
|
||||
case QMetaType::QRectF:
|
||||
return rectToString(propertyValue().toRect());
|
||||
default :
|
||||
return ObjectPropItem::displayValue();
|
||||
switch (propertyValue().typeId()) {
|
||||
case QMetaType::QRect:
|
||||
return rectToString(propertyValue().toRect());
|
||||
case QMetaType::QRectF:
|
||||
return rectToString(propertyValue().toRect());
|
||||
default:
|
||||
return ObjectPropItem::displayValue();
|
||||
}
|
||||
#else
|
||||
switch(propertyValue().type()){
|
||||
case QVariant::Rect:
|
||||
return rectToString(propertyValue().toRect());
|
||||
case QVariant::RectF:
|
||||
return rectToString(propertyValue().toRect());
|
||||
default :
|
||||
return ObjectPropItem::displayValue();
|
||||
switch (propertyValue().type()) {
|
||||
case QVariant::Rect:
|
||||
return rectToString(propertyValue().toRect());
|
||||
case QVariant::RectF:
|
||||
return rectToString(propertyValue().toRect());
|
||||
default:
|
||||
return ObjectPropItem::displayValue();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
LimeReport::RectUnitPropItem::RectUnitPropItem(QObject *object, ObjectsList* objects, const QString &name, const QString &displayName, const QVariant &value, ObjectPropItem *parent, bool /*readonly*/):
|
||||
ObjectPropItem(object, objects, name, displayName, value,parent)
|
||||
LimeReport::RectUnitPropItem::RectUnitPropItem(QObject* object, ObjectsList* objects,
|
||||
const QString& name, const QString& displayName,
|
||||
const QVariant& value, ObjectPropItem* parent,
|
||||
bool /*readonly*/):
|
||||
ObjectPropItem(object, objects, name, displayName, value, parent)
|
||||
{
|
||||
QRectF rect= value.toRect();
|
||||
QRectF rect = value.toRect();
|
||||
LimeReport::BandDesignIntf* band = dynamic_cast<LimeReport::BandDesignIntf*>(object);
|
||||
LimeReport::PageItemDesignIntf* page = dynamic_cast<LimeReport::PageItemDesignIntf*>(object);
|
||||
LimeReport::BaseDesignIntf* item = dynamic_cast<BaseDesignIntf*>(object);
|
||||
|
||||
if (band){
|
||||
this->appendItem(new LimeReport::RectUnitValuePropItem(object, objects, "x", "x", rect.x(), this, true));
|
||||
this->appendItem(new LimeReport::RectUnitValuePropItem(object, objects, "y", "y", rect.y(), this, true));
|
||||
this->appendItem(new LimeReport::RectUnitValuePropItem(object, objects, "width", tr("width"), rect.width(), this, true));
|
||||
this->appendItem(new LimeReport::RectUnitValuePropItem(object, objects, "height", tr("height"), rect.height(), this, false));
|
||||
} else if (page){
|
||||
this->appendItem(new LimeReport::RectUnitValuePropItem(object, 0, "x", "x", rect.x(), this, true));
|
||||
this->appendItem(new LimeReport::RectUnitValuePropItem(object, 0, "y", "y",rect.y(), this, true));
|
||||
this->appendItem(new LimeReport::RectUnitValuePropItem(object, 0,"width", tr("width"), rect.width(), this, false));
|
||||
this->appendItem(new LimeReport::RectUnitValuePropItem(object, 0, "height", tr("height"), rect.height(), this, false));
|
||||
if (band) {
|
||||
this->appendItem(
|
||||
new LimeReport::RectUnitValuePropItem(object, objects, "x", "x", rect.x(), this, true));
|
||||
this->appendItem(
|
||||
new LimeReport::RectUnitValuePropItem(object, objects, "y", "y", rect.y(), this, true));
|
||||
this->appendItem(new LimeReport::RectUnitValuePropItem(
|
||||
object, objects, "width", tr("width"), rect.width(), this, true));
|
||||
this->appendItem(new LimeReport::RectUnitValuePropItem(
|
||||
object, objects, "height", tr("height"), rect.height(), this, false));
|
||||
} else if (page) {
|
||||
this->appendItem(
|
||||
new LimeReport::RectUnitValuePropItem(object, 0, "x", "x", rect.x(), this, true));
|
||||
this->appendItem(
|
||||
new LimeReport::RectUnitValuePropItem(object, 0, "y", "y", rect.y(), this, true));
|
||||
this->appendItem(new LimeReport::RectUnitValuePropItem(object, 0, "width", tr("width"),
|
||||
rect.width(), this, false));
|
||||
this->appendItem(new LimeReport::RectUnitValuePropItem(object, 0, "height", tr("height"),
|
||||
rect.height(), this, false));
|
||||
} else {
|
||||
this->appendItem(new LimeReport::RectUnitValuePropItem(object, objects, "x", "x", rect.x(), this, false));
|
||||
this->appendItem(new LimeReport::RectUnitValuePropItem(object, objects, "y", "y", rect.y(), this, false));
|
||||
this->appendItem(new LimeReport::RectUnitValuePropItem(object, objects, "width", tr("width"), rect.width(), this, false));
|
||||
this->appendItem(new LimeReport::RectUnitValuePropItem(object, objects, "height", tr("height"), rect.height(), this, false));
|
||||
this->appendItem(new LimeReport::RectUnitValuePropItem(object, objects, "x", "x", rect.x(),
|
||||
this, false));
|
||||
this->appendItem(new LimeReport::RectUnitValuePropItem(object, objects, "y", "y", rect.y(),
|
||||
this, false));
|
||||
this->appendItem(new LimeReport::RectUnitValuePropItem(
|
||||
object, objects, "width", tr("width"), rect.width(), this, false));
|
||||
this->appendItem(new LimeReport::RectUnitValuePropItem(
|
||||
object, objects, "height", tr("height"), rect.height(), this, false));
|
||||
}
|
||||
|
||||
if (item){
|
||||
connect(item,SIGNAL(geometryChanged(QObject*,QRectF,QRectF)),this,SLOT(itemGeometryChanged(QObject*,QRectF,QRectF)));
|
||||
connect(item,SIGNAL(posChanged(QObject*,QPointF,QPointF)),this,SLOT(itemPosChanged(QObject*,QPointF,QPointF)));
|
||||
connect(item,SIGNAL(posChanging(QObject*,QPointF,QPointF)),this,SLOT(itemPosChanged(QObject*,QPointF,QPointF)));
|
||||
if (item) {
|
||||
connect(item, SIGNAL(geometryChanged(QObject*, QRectF, QRectF)), this,
|
||||
SLOT(itemGeometryChanged(QObject*, QRectF, QRectF)));
|
||||
connect(item, SIGNAL(posChanged(QObject*, QPointF, QPointF)), this,
|
||||
SLOT(itemPosChanged(QObject*, QPointF, QPointF)));
|
||||
connect(item, SIGNAL(posChanging(QObject*, QPointF, QPointF)), this,
|
||||
SLOT(itemPosChanged(QObject*, QPointF, QPointF)));
|
||||
}
|
||||
|
||||
}
|
||||
QString LimeReport::RectUnitPropItem::displayValue() const
|
||||
{
|
||||
QRectF rect = rectInUnits(propertyValue().toRectF());
|
||||
return QString("[%1,%2] %3x%4 %5")
|
||||
.arg(rect.x(), 0, 'f', 2)
|
||||
.arg(rect.y(), 0,'f', 2)
|
||||
.arg(rect.width(), 0, 'f', 2)
|
||||
.arg(rect.height(), 0, 'f', 2)
|
||||
.arg(unitShortName());
|
||||
.arg(rect.x(), 0, 'f', 2)
|
||||
.arg(rect.y(), 0, 'f', 2)
|
||||
.arg(rect.width(), 0, 'f', 2)
|
||||
.arg(rect.height(), 0, 'f', 2)
|
||||
.arg(unitShortName());
|
||||
}
|
||||
|
||||
LimeReport::RectUnitValuePropItem::RectUnitValuePropItem(QObject *object, ObjectsList* objects, const QString &name, const QString &displayName, const QVariant &value, ObjectPropItem *parent, bool readonly
|
||||
):ObjectPropItem(object, objects, name, displayName, value,parent,readonly){}
|
||||
|
||||
QWidget * LimeReport::RectUnitValuePropItem::createProperyEditor(QWidget *parent) const
|
||||
LimeReport::RectUnitValuePropItem::RectUnitValuePropItem(QObject* object, ObjectsList* objects,
|
||||
const QString& name,
|
||||
const QString& displayName,
|
||||
const QVariant& value,
|
||||
ObjectPropItem* parent, bool readonly):
|
||||
ObjectPropItem(object, objects, name, displayName, value, parent, readonly)
|
||||
{
|
||||
QDoubleSpinBox *editor= new QDoubleSpinBox(parent);
|
||||
}
|
||||
|
||||
QWidget* LimeReport::RectUnitValuePropItem::createProperyEditor(QWidget* parent) const
|
||||
{
|
||||
QDoubleSpinBox* editor = new QDoubleSpinBox(parent);
|
||||
editor->setMaximum(100000);
|
||||
editor->setSuffix(" "+unitShortName());
|
||||
editor->setSuffix(" " + unitShortName());
|
||||
return editor;
|
||||
}
|
||||
|
||||
void LimeReport::RectUnitValuePropItem::setPropertyEditorData(QWidget *propertyEditor, const QModelIndex &) const
|
||||
void LimeReport::RectUnitValuePropItem::setPropertyEditorData(QWidget* propertyEditor,
|
||||
const QModelIndex&) const
|
||||
{
|
||||
QDoubleSpinBox *editor = qobject_cast<QDoubleSpinBox*>(propertyEditor);
|
||||
QDoubleSpinBox* editor = qobject_cast<QDoubleSpinBox*>(propertyEditor);
|
||||
editor->setValue(valueInUnits(propertyValue().toReal()));
|
||||
}
|
||||
|
||||
void LimeReport::RectUnitValuePropItem::setModelData(QWidget *propertyEditor, QAbstractItemModel *model, const QModelIndex &index)
|
||||
void LimeReport::RectUnitValuePropItem::setModelData(QWidget* propertyEditor,
|
||||
QAbstractItemModel* model,
|
||||
const QModelIndex& index)
|
||||
{
|
||||
model->setData(index,valueInReportUnits(qobject_cast<QDoubleSpinBox*>(propertyEditor)->value()));
|
||||
QRectF rect=object()->property(parent()->propertyName().toLatin1()).toRectF();
|
||||
object()->setProperty(parent()->propertyName().toLatin1(), modifyRect(rect, propertyName(), propertyValue().toReal()));
|
||||
model->setData(index,
|
||||
valueInReportUnits(qobject_cast<QDoubleSpinBox*>(propertyEditor)->value()));
|
||||
QRectF rect = object()->property(parent()->propertyName().toLatin1()).toRectF();
|
||||
object()->setProperty(parent()->propertyName().toLatin1(),
|
||||
modifyRect(rect, propertyName(), propertyValue().toReal()));
|
||||
}
|
||||
|
||||
qreal LimeReport::RectUnitValuePropItem::valueInUnits(qreal value) const
|
||||
@@ -212,43 +275,48 @@ QString LimeReport::RectUnitValuePropItem::unitShortName() const
|
||||
|
||||
QString LimeReport::RectUnitValuePropItem::displayValue() const
|
||||
{
|
||||
return QString("%1 %2").arg(valueInUnits(propertyValue().toReal()), 0, 'f', 2).arg(unitShortName());
|
||||
return QString("%1 %2")
|
||||
.arg(valueInUnits(propertyValue().toReal()), 0, 'f', 2)
|
||||
.arg(unitShortName());
|
||||
}
|
||||
|
||||
void LimeReport::RectUnitPropItem::itemPosChanged(QObject* /*object*/, QPointF newPos, QPointF oldPos)
|
||||
void LimeReport::RectUnitPropItem::itemPosChanged(QObject* /*object*/, QPointF newPos,
|
||||
QPointF oldPos)
|
||||
{
|
||||
if (newPos.x() != oldPos.x()){
|
||||
if (newPos.x() != oldPos.x()) {
|
||||
setValue("x", newPos.x());
|
||||
}
|
||||
if (newPos.y() != oldPos.y()){
|
||||
if (newPos.y() != oldPos.y()) {
|
||||
setValue("y", newPos.y());
|
||||
}
|
||||
}
|
||||
|
||||
void LimeReport::RectUnitPropItem::itemGeometryChanged(QObject * /*object*/, QRectF newGeometry, QRectF oldGeometry)
|
||||
void LimeReport::RectUnitPropItem::itemGeometryChanged(QObject* /*object*/, QRectF newGeometry,
|
||||
QRectF oldGeometry)
|
||||
{
|
||||
if (newGeometry.x() != oldGeometry.x()){
|
||||
if (newGeometry.x() != oldGeometry.x()) {
|
||||
setValue("x", newGeometry.x());
|
||||
}
|
||||
if (newGeometry.y() != oldGeometry.y()){
|
||||
if (newGeometry.y() != oldGeometry.y()) {
|
||||
setValue("y", newGeometry.y());
|
||||
}
|
||||
if (newGeometry.width() != oldGeometry.width()){
|
||||
if (newGeometry.width() != oldGeometry.width()) {
|
||||
setValue("width", newGeometry.width());
|
||||
}
|
||||
if (newGeometry.height() != oldGeometry.height()){
|
||||
if (newGeometry.height() != oldGeometry.height()) {
|
||||
setValue("height", newGeometry.height());
|
||||
}
|
||||
}
|
||||
|
||||
void LimeReport::RectUnitPropItem::setValue(const QString &name, qreal value)
|
||||
void LimeReport::RectUnitPropItem::setValue(const QString& name, qreal value)
|
||||
{
|
||||
if (name != ""){
|
||||
if (name != "") {
|
||||
LimeReport::ObjectPropItem* propItem = findChild(name);
|
||||
if (propItem) {
|
||||
propItem->setPropertyValue(value);
|
||||
setPropertyValue(LimeReport::modifyRect(propertyValue().toRectF(), name, value));
|
||||
LimeReport::QObjectPropertyModel *itemModel = dynamic_cast<LimeReport::QObjectPropertyModel *>(model());
|
||||
LimeReport::QObjectPropertyModel* itemModel
|
||||
= dynamic_cast<LimeReport::QObjectPropertyModel*>(model());
|
||||
if (itemModel) {
|
||||
itemModel->itemDataChanged(modelIndex());
|
||||
if (propItem->modelIndex().isValid())
|
||||
@@ -263,13 +331,10 @@ QRectF LimeReport::RectUnitPropItem::rectInUnits(QRectF rect) const
|
||||
BaseDesignIntf* item = dynamic_cast<BaseDesignIntf*>(object());
|
||||
switch (item->unitType()) {
|
||||
case LimeReport::BaseDesignIntf::Millimeters:
|
||||
return QRectF(rect.x() / item->unitFactor(),
|
||||
rect.y() / item->unitFactor(),
|
||||
rect.width() / item->unitFactor(),
|
||||
rect.height() / item->unitFactor());
|
||||
return QRectF(rect.x() / item->unitFactor(), rect.y() / item->unitFactor(),
|
||||
rect.width() / item->unitFactor(), rect.height() / item->unitFactor());
|
||||
case LimeReport::BaseDesignIntf::Inches:
|
||||
return QRectF(rect.x() / (item->unitFactor() * 10),
|
||||
rect.y() / (item->unitFactor() * 10),
|
||||
return QRectF(rect.x() / (item->unitFactor() * 10), rect.y() / (item->unitFactor() * 10),
|
||||
rect.width() / (item->unitFactor() * 10),
|
||||
rect.height() / (item->unitFactor() * 10));
|
||||
}
|
||||
|
||||
@@ -30,49 +30,57 @@
|
||||
#ifndef LRRECTPROPTEM_H
|
||||
#define LRRECTPROPTEM_H
|
||||
#include "lrobjectpropitem.h"
|
||||
#include <QRectF>
|
||||
|
||||
#include <QMetaProperty>
|
||||
#include <QRectF>
|
||||
|
||||
namespace LimeReport{
|
||||
namespace LimeReport {
|
||||
|
||||
class RectPropItem : public ObjectPropItem{
|
||||
class RectPropItem: public ObjectPropItem {
|
||||
Q_OBJECT
|
||||
public:
|
||||
RectPropItem():ObjectPropItem(){}
|
||||
RectPropItem(QObject *object, ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& value, ObjectPropItem* parent, bool readonly=true);
|
||||
RectPropItem(): ObjectPropItem() { }
|
||||
RectPropItem(QObject* object, ObjectsList* objects, const QString& name,
|
||||
const QString& displayName, const QVariant& value, ObjectPropItem* parent,
|
||||
bool readonly = true);
|
||||
QString displayValue() const;
|
||||
};
|
||||
|
||||
class RectUnitPropItem : public ObjectPropItem{
|
||||
class RectUnitPropItem: public ObjectPropItem {
|
||||
Q_OBJECT
|
||||
public:
|
||||
RectUnitPropItem():ObjectPropItem(){}
|
||||
RectUnitPropItem(QObject *object, ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& value, ObjectPropItem* parent, bool readonly=true);
|
||||
RectUnitPropItem(): ObjectPropItem() { }
|
||||
RectUnitPropItem(QObject* object, ObjectsList* objects, const QString& name,
|
||||
const QString& displayName, const QVariant& value, ObjectPropItem* parent,
|
||||
bool readonly = true);
|
||||
QString displayValue() const;
|
||||
public slots:
|
||||
void itemPosChanged(QObject* /*object*/, QPointF newPos, QPointF oldPos);
|
||||
void itemGeometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry);
|
||||
|
||||
private:
|
||||
void setValue(const QString& propertyName, qreal propertyValue);
|
||||
QRectF rectInUnits(QRectF rect) const;
|
||||
void setValue(const QString& propertyName, qreal propertyValue);
|
||||
QRectF rectInUnits(QRectF rect) const;
|
||||
QString unitShortName() const;
|
||||
};
|
||||
|
||||
class RectUnitValuePropItem : public ObjectPropItem{
|
||||
class RectUnitValuePropItem: public ObjectPropItem {
|
||||
Q_OBJECT
|
||||
public:
|
||||
RectUnitValuePropItem():ObjectPropItem(){}
|
||||
RectUnitValuePropItem(QObject *object, ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& value, ObjectPropItem* parent, bool readonly );
|
||||
RectUnitValuePropItem(): ObjectPropItem() { }
|
||||
RectUnitValuePropItem(QObject* object, ObjectsList* objects, const QString& name,
|
||||
const QString& displayName, const QVariant& value, ObjectPropItem* parent,
|
||||
bool readonly);
|
||||
QString displayValue() const;
|
||||
QWidget* createProperyEditor(QWidget *) const;
|
||||
void setPropertyEditorData(QWidget *, const QModelIndex &) const;
|
||||
void setModelData(QWidget *, QAbstractItemModel *, const QModelIndex &);
|
||||
QWidget* createProperyEditor(QWidget*) const;
|
||||
void setPropertyEditorData(QWidget*, const QModelIndex&) const;
|
||||
void setModelData(QWidget*, QAbstractItemModel*, const QModelIndex&);
|
||||
|
||||
private:
|
||||
qreal valueInUnits(qreal value) const;
|
||||
qreal valueInReportUnits(qreal value) const;
|
||||
QString unitShortName() const;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace LimeReport
|
||||
#endif // LRRECTPROPTEM_H
|
||||
|
||||
@@ -6,39 +6,45 @@
|
||||
#include <lrpagedesignintf.h>
|
||||
#include <lrreportengine_p.h>
|
||||
|
||||
namespace{
|
||||
LimeReport::ObjectPropItem * createSeriesPropItem(
|
||||
QObject *object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly)
|
||||
namespace {
|
||||
LimeReport::ObjectPropItem* createSeriesPropItem(QObject* object,
|
||||
LimeReport::ObjectPropItem::ObjectsList* objects,
|
||||
const QString& name, const QString& displayName,
|
||||
const QVariant& data,
|
||||
LimeReport::ObjectPropItem* parent, bool readonly)
|
||||
{
|
||||
return new LimeReport::SeriesPropItem(object, objects, name, displayName, data, parent, readonly);
|
||||
}
|
||||
bool VARIABLE_IS_NOT_USED registredSeriesProp = LimeReport::ObjectPropFactory::instance().registerCreator(LimeReport::APropIdent("series", "LimeReport::ChartItem"), QObject::tr("series"), createSeriesPropItem);
|
||||
return new LimeReport::SeriesPropItem(object, objects, name, displayName, data, parent,
|
||||
readonly);
|
||||
}
|
||||
bool VARIABLE_IS_NOT_USED registredSeriesProp
|
||||
= LimeReport::ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("series", "LimeReport::ChartItem"), QObject::tr("series"),
|
||||
createSeriesPropItem);
|
||||
} // namespace
|
||||
|
||||
namespace LimeReport {
|
||||
|
||||
QWidget *SeriesPropItem::createProperyEditor(QWidget *parent) const
|
||||
QWidget* SeriesPropItem::createProperyEditor(QWidget* parent) const
|
||||
{
|
||||
return new SeriesPropEditor(qobject_cast<ChartItem*>(object()), parent);
|
||||
}
|
||||
|
||||
QString SeriesPropItem::displayValue() const
|
||||
{
|
||||
return QObject::tr("Series");
|
||||
}
|
||||
QString SeriesPropItem::displayValue() const { return QObject::tr("Series"); }
|
||||
|
||||
SeriesPropEditor::SeriesPropEditor(ChartItem *chart, QWidget *parent)
|
||||
: QWidget(parent), m_button(new QPushButton(this)), m_chart(chart)
|
||||
SeriesPropEditor::SeriesPropEditor(ChartItem* chart, QWidget* parent):
|
||||
QWidget(parent),
|
||||
m_button(new QPushButton(this)),
|
||||
m_chart(chart)
|
||||
{
|
||||
m_button->setText("...");
|
||||
QHBoxLayout* layout = new QHBoxLayout(this);
|
||||
layout->addWidget(m_button);
|
||||
layout->setSpacing(1);
|
||||
layout->setContentsMargins(1,0,1,1);
|
||||
layout->setContentsMargins(1, 0, 1, 1);
|
||||
setLayout(layout);
|
||||
setFocusProxy(m_button);
|
||||
setAutoFillBackground(true);
|
||||
connect(m_button,SIGNAL(clicked()),this,SLOT(slotButtonClicked()));
|
||||
connect(m_button, SIGNAL(clicked()), this, SLOT(slotButtonClicked()));
|
||||
}
|
||||
|
||||
void SeriesPropEditor::slotButtonClicked()
|
||||
@@ -47,5 +53,4 @@ void SeriesPropEditor::slotButtonClicked()
|
||||
emit editingFinished();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
} // namespace LimeReport
|
||||
|
||||
@@ -1,41 +1,42 @@
|
||||
#ifndef SERIESPROPITEM_H
|
||||
#define SERIESPROPITEM_H
|
||||
|
||||
#include <QPushButton>
|
||||
#include <QHBoxLayout>
|
||||
#include <lrobjectpropitem.h>
|
||||
#include <QPushButton>
|
||||
|
||||
#include <lrchartitem.h>
|
||||
#include <lrobjectpropitem.h>
|
||||
|
||||
namespace LimeReport {
|
||||
|
||||
class SeriesPropEditor : public QWidget
|
||||
{
|
||||
class SeriesPropEditor: public QWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
SeriesPropEditor(ChartItem* chart, QWidget *parent = 0);
|
||||
SeriesPropEditor(ChartItem* chart, QWidget* parent = 0);
|
||||
signals:
|
||||
void editingFinished();
|
||||
private slots:
|
||||
void slotButtonClicked();
|
||||
|
||||
private:
|
||||
QPushButton* m_button;
|
||||
ChartItem* m_chart;
|
||||
};
|
||||
|
||||
class SeriesPropItem : public LimeReport::ObjectPropItem{
|
||||
class SeriesPropItem: public LimeReport::ObjectPropItem {
|
||||
Q_OBJECT
|
||||
public:
|
||||
SeriesPropItem():ObjectPropItem(){}
|
||||
SeriesPropItem(QObject* object, ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& value, ObjectPropItem* parent, bool readonly)
|
||||
:ObjectPropItem(object, objects, name, displayName, value, parent, readonly){}
|
||||
QWidget* createProperyEditor(QWidget *parent) const;
|
||||
SeriesPropItem(): ObjectPropItem() { }
|
||||
SeriesPropItem(QObject* object, ObjectsList* objects, const QString& name,
|
||||
const QString& displayName, const QVariant& value, ObjectPropItem* parent,
|
||||
bool readonly):
|
||||
ObjectPropItem(object, objects, name, displayName, value, parent, readonly)
|
||||
{
|
||||
}
|
||||
QWidget* createProperyEditor(QWidget* parent) const;
|
||||
QString displayValue() const;
|
||||
};
|
||||
|
||||
} // namespace LimeReport
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // SERIESPROPITEM_H
|
||||
|
||||
@@ -27,46 +27,50 @@
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
****************************************************************************/
|
||||
#include <QLineEdit>
|
||||
#include <QDebug>
|
||||
#include <QString>
|
||||
|
||||
#include "lrstringpropitem.h"
|
||||
|
||||
#include "lrobjectpropitem.h"
|
||||
#include "objectinspector/editors/lrbuttonlineeditor.h"
|
||||
|
||||
namespace{
|
||||
LimeReport::ObjectPropItem * createStringPropItem(
|
||||
QObject *object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly)
|
||||
{
|
||||
return new LimeReport::StringPropItem(object, objects, name, displayName, data, parent, readonly);
|
||||
}
|
||||
bool VARIABLE_IS_NOT_USED registredStringProp = LimeReport::ObjectPropFactory::instance().registerCreator(LimeReport::APropIdent("QString",""),QObject::tr("QString"),createStringPropItem);
|
||||
#include <QDebug>
|
||||
#include <QLineEdit>
|
||||
#include <QString>
|
||||
|
||||
namespace {
|
||||
LimeReport::ObjectPropItem* createStringPropItem(QObject* object,
|
||||
LimeReport::ObjectPropItem::ObjectsList* objects,
|
||||
const QString& name, const QString& displayName,
|
||||
const QVariant& data,
|
||||
LimeReport::ObjectPropItem* parent, bool readonly)
|
||||
{
|
||||
return new LimeReport::StringPropItem(object, objects, name, displayName, data, parent,
|
||||
readonly);
|
||||
}
|
||||
bool VARIABLE_IS_NOT_USED registredStringProp
|
||||
= LimeReport::ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("QString", ""), QObject::tr("QString"), createStringPropItem);
|
||||
} // namespace
|
||||
|
||||
namespace LimeReport{
|
||||
namespace LimeReport {
|
||||
|
||||
|
||||
QWidget * StringPropItem::createProperyEditor(QWidget *parent) const
|
||||
QWidget* StringPropItem::createProperyEditor(QWidget* parent) const
|
||||
{
|
||||
return new ButtonLineEditor(object()->objectName()+"."+displayName(),parent);
|
||||
return new ButtonLineEditor(object()->objectName() + "." + displayName(), parent);
|
||||
}
|
||||
|
||||
void StringPropItem::setPropertyEditorData(QWidget *propertyEditor, const QModelIndex &) const
|
||||
void StringPropItem::setPropertyEditorData(QWidget* propertyEditor, const QModelIndex&) const
|
||||
{
|
||||
ButtonLineEditor *editor = qobject_cast<ButtonLineEditor *>(propertyEditor);
|
||||
ButtonLineEditor* editor = qobject_cast<ButtonLineEditor*>(propertyEditor);
|
||||
editor->setText(propertyValue().toString());
|
||||
}
|
||||
|
||||
void StringPropItem::setModelData(QWidget *propertyEditor, QAbstractItemModel *model, const QModelIndex &index)
|
||||
void StringPropItem::setModelData(QWidget* propertyEditor, QAbstractItemModel* model,
|
||||
const QModelIndex& index)
|
||||
{
|
||||
model->setData(index,qobject_cast<ButtonLineEditor*>(propertyEditor)->text());
|
||||
object()->setProperty(propertyName().toLatin1(),propertyValue());
|
||||
model->setData(index, qobject_cast<ButtonLineEditor*>(propertyEditor)->text());
|
||||
object()->setProperty(propertyName().toLatin1(), propertyValue());
|
||||
}
|
||||
|
||||
QString StringPropItem::displayValue() const
|
||||
{
|
||||
return propertyValue().toString().simplified();
|
||||
}
|
||||
QString StringPropItem::displayValue() const { return propertyValue().toString().simplified(); }
|
||||
|
||||
} // namespace LimeReport
|
||||
|
||||
@@ -31,17 +31,21 @@
|
||||
#define LRSTRINGPROPITEM_H
|
||||
#include "lrobjectpropitem.h"
|
||||
|
||||
namespace LimeReport{
|
||||
class StringPropItem : public LimeReport::ObjectPropItem{
|
||||
namespace LimeReport {
|
||||
class StringPropItem: public LimeReport::ObjectPropItem {
|
||||
Q_OBJECT
|
||||
public:
|
||||
StringPropItem():ObjectPropItem(){}
|
||||
StringPropItem(QObject* object, ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& value, ObjectPropItem* parent, bool readonly)
|
||||
:ObjectPropItem(object, objects, name, displayName, value, parent, readonly){}
|
||||
QWidget* createProperyEditor(QWidget *parent) const;
|
||||
StringPropItem(): ObjectPropItem() { }
|
||||
StringPropItem(QObject* object, ObjectsList* objects, const QString& name,
|
||||
const QString& displayName, const QVariant& value, ObjectPropItem* parent,
|
||||
bool readonly):
|
||||
ObjectPropItem(object, objects, name, displayName, value, parent, readonly)
|
||||
{
|
||||
}
|
||||
QWidget* createProperyEditor(QWidget* parent) const;
|
||||
QString displayValue() const;
|
||||
void setPropertyEditorData(QWidget *, const QModelIndex &) const;
|
||||
void setModelData(QWidget *, QAbstractItemModel *, const QModelIndex &);
|
||||
void setPropertyEditorData(QWidget*, const QModelIndex&) const;
|
||||
void setModelData(QWidget*, QAbstractItemModel*, const QModelIndex&);
|
||||
};
|
||||
} // namespace LimeReport
|
||||
#endif // LRSTRINGPROPITEM_H
|
||||
|
||||
@@ -1,37 +1,42 @@
|
||||
#include "lrsvgpropitem.h"
|
||||
|
||||
#include "editors/lrsvgeditor.h"
|
||||
|
||||
namespace{
|
||||
LimeReport::ObjectPropItem * createSvgPropItem(
|
||||
QObject *object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly)
|
||||
namespace {
|
||||
LimeReport::ObjectPropItem* createSvgPropItem(QObject* object,
|
||||
LimeReport::ObjectPropItem::ObjectsList* objects,
|
||||
const QString& name, const QString& displayName,
|
||||
const QVariant& data,
|
||||
LimeReport::ObjectPropItem* parent, bool readonly)
|
||||
{
|
||||
return new LimeReport::SvgPropItem(object, objects, name, displayName, data, parent, readonly);
|
||||
}
|
||||
bool VARIABLE_IS_NOT_USED registredImageProp = LimeReport::ObjectPropFactory::instance().registerCreator(LimeReport::APropIdent("image","LimeReport::SVGItem"),QObject::tr("image"),createSvgPropItem);
|
||||
}
|
||||
bool VARIABLE_IS_NOT_USED registredImageProp
|
||||
= LimeReport::ObjectPropFactory::instance().registerCreator(
|
||||
LimeReport::APropIdent("image", "LimeReport::SVGItem"), QObject::tr("image"),
|
||||
createSvgPropItem);
|
||||
} // namespace
|
||||
|
||||
namespace LimeReport{
|
||||
namespace LimeReport {
|
||||
|
||||
QWidget* SvgPropItem::createProperyEditor(QWidget *parent) const
|
||||
{
|
||||
return new SvgEditor(parent);
|
||||
}
|
||||
QWidget* SvgPropItem::createProperyEditor(QWidget* parent) const { return new SvgEditor(parent); }
|
||||
|
||||
QString SvgPropItem::displayValue() const
|
||||
{
|
||||
return (propertyValue().isNull()) ? "" : QObject::tr("image");
|
||||
}
|
||||
|
||||
void SvgPropItem::setPropertyEditorData(QWidget *propertyEditor, const QModelIndex &) const
|
||||
void SvgPropItem::setPropertyEditorData(QWidget* propertyEditor, const QModelIndex&) const
|
||||
{
|
||||
SvgEditor *editor = qobject_cast<SvgEditor*>(propertyEditor);
|
||||
SvgEditor* editor = qobject_cast<SvgEditor*>(propertyEditor);
|
||||
editor->setImage(propertyValue().value<QByteArray>());
|
||||
}
|
||||
|
||||
void SvgPropItem::setModelData(QWidget *propertyEditor, QAbstractItemModel *model, const QModelIndex &index)
|
||||
void SvgPropItem::setModelData(QWidget* propertyEditor, QAbstractItemModel* model,
|
||||
const QModelIndex& index)
|
||||
{
|
||||
model->setData(index,qobject_cast<SvgEditor*>(propertyEditor)->image());
|
||||
object()->setProperty(propertyName().toLatin1(),propertyValue());
|
||||
model->setData(index, qobject_cast<SvgEditor*>(propertyEditor)->image());
|
||||
object()->setProperty(propertyName().toLatin1(), propertyValue());
|
||||
}
|
||||
|
||||
QIcon SvgPropItem::iconValue() const
|
||||
@@ -39,4 +44,4 @@ QIcon SvgPropItem::iconValue() const
|
||||
return QIcon(QPixmap::fromImage(propertyValue().value<QImage>()));
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace LimeReport
|
||||
|
||||
@@ -2,19 +2,22 @@
|
||||
#define SVGPROPITEM_H
|
||||
|
||||
#include "lrobjectpropitem.h"
|
||||
namespace LimeReport{
|
||||
namespace LimeReport {
|
||||
|
||||
class SvgPropItem : public ObjectPropItem
|
||||
{
|
||||
class SvgPropItem: public ObjectPropItem {
|
||||
Q_OBJECT
|
||||
public:
|
||||
SvgPropItem():ObjectPropItem(){}
|
||||
SvgPropItem(QObject* object, ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& value,ObjectPropItem* parent, bool readonly)
|
||||
:ObjectPropItem(object, objects, name, displayName, value, parent, readonly){}
|
||||
QWidget* createProperyEditor(QWidget *parent) const;
|
||||
SvgPropItem(): ObjectPropItem() { }
|
||||
SvgPropItem(QObject* object, ObjectsList* objects, const QString& name,
|
||||
const QString& displayName, const QVariant& value, ObjectPropItem* parent,
|
||||
bool readonly):
|
||||
ObjectPropItem(object, objects, name, displayName, value, parent, readonly)
|
||||
{
|
||||
}
|
||||
QWidget* createProperyEditor(QWidget* parent) const;
|
||||
QString displayValue() const;
|
||||
void setPropertyEditorData(QWidget *propertyEditor, const QModelIndex &) const;
|
||||
void setModelData(QWidget *propertyEditor, QAbstractItemModel *model, const QModelIndex &index);
|
||||
void setPropertyEditorData(QWidget* propertyEditor, const QModelIndex&) const;
|
||||
void setModelData(QWidget* propertyEditor, QAbstractItemModel* model, const QModelIndex& index);
|
||||
virtual QIcon iconValue() const;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user