diff --git a/limereport/items/lralignpropitem.cpp b/limereport/items/lralignpropitem.cpp index 8bf4ce0..a91c243 100644 --- a/limereport/items/lralignpropitem.cpp +++ b/limereport/items/lralignpropitem.cpp @@ -109,7 +109,8 @@ void AlignmentItemEditor::setModelData(QWidget *propertyEditor, QAbstractItemMod int align = m_acceptableValues.value(qobject_cast(propertyEditor)->text()); flags=clearAcceptableValues(flags) | align; object()->setProperty(propertyName().toLatin1(),flags); - foreach(QObject* item,*objects()){item->setProperty(propertyName().toLatin1(),flags);} + if (objects()) + foreach(QObject* item,*objects()){item->setProperty(propertyName().toLatin1(),flags);} parent()->setPropertyValue(flags); model->setData(index,align); } diff --git a/limereport/items/lrtextitem.cpp b/limereport/items/lrtextitem.cpp index 1bcd304..d19d8ab 100644 --- a/limereport/items/lrtextitem.cpp +++ b/limereport/items/lrtextitem.cpp @@ -60,6 +60,18 @@ TextItem::TextItem(QObject *owner, QGraphicsItem *parent) m_allowHTMLInFields(false) { m_text = new QTextDocument(); + + PageItemDesignIntf* pageItem = dynamic_cast(parent); + BaseDesignIntf* parentItem = dynamic_cast(parent); + while (!pageItem){ + parentItem = dynamic_cast(parentItem->parentItem()); + pageItem = dynamic_cast(parentItem); + } + + if (pageItem){ + QFont defaultFont = pageItem->font(); + setFont(defaultFont); + } Init(); } diff --git a/limereport/objectinspector/lrobjectitemmodel.cpp b/limereport/objectinspector/lrobjectitemmodel.cpp index a120b84..c79480a 100644 --- a/limereport/objectinspector/lrobjectitemmodel.cpp +++ b/limereport/objectinspector/lrobjectitemmodel.cpp @@ -321,7 +321,7 @@ ObjectPropItem * QObjectPropertyModel::createPropertyItem(QMetaProperty prop, QO object, objects, QString(prop.name()), - QString(tr(prop.name())), //сделать перевод значений на другие языки + QString(tr(prop.name())), object->property(prop.name()), parent, !(prop.isWritable()&&prop.isDesignable()) diff --git a/limereport/objectinspector/lrobjectpropitem.cpp b/limereport/objectinspector/lrobjectpropitem.cpp index 38aeb2a..3fc212c 100644 --- a/limereport/objectinspector/lrobjectpropitem.cpp +++ b/limereport/objectinspector/lrobjectpropitem.cpp @@ -147,9 +147,11 @@ void ObjectPropItem::slotPropertyObjectName(const QString &oldValue, const QStri void ObjectPropItem::setValueToObject(const QString &propertyName, QVariant propertyValue) { object()->setProperty(propertyName.toLatin1(),propertyValue); - foreach (QObject* item, *objects()) { - if (item->metaObject()->indexOfProperty(propertyName.toLatin1())!=-1) - item->setProperty(propertyName.toLatin1(), propertyValue); + if (objects()){ + foreach (QObject* item, *objects()) { + if (item->metaObject()->indexOfProperty(propertyName.toLatin1())!=-1) + item->setProperty(propertyName.toLatin1(), propertyValue); + } } } diff --git a/limereport/objectinspector/lrobjectpropitem.h b/limereport/objectinspector/lrobjectpropitem.h index 2ff3553..f4d783e 100644 --- a/limereport/objectinspector/lrobjectpropitem.h +++ b/limereport/objectinspector/lrobjectpropitem.h @@ -97,7 +97,7 @@ namespace LimeReport{ #endif private: bool m_valid; - void invalidate(){m_object=0; m_valid = false; m_name = ""; m_value=QVariant(), m_isClass=false;} + void invalidate(){m_object=0; m_objects=0; m_valid = false; m_name = ""; m_value=QVariant(), m_isClass=false;} protected: void beginChangeValue(){ m_changingValue = true; } diff --git a/limereport/objectinspector/lrpropertydelegate.cpp b/limereport/objectinspector/lrpropertydelegate.cpp index bdfff23..4856efc 100644 --- a/limereport/objectinspector/lrpropertydelegate.cpp +++ b/limereport/objectinspector/lrpropertydelegate.cpp @@ -37,10 +37,7 @@ LimeReport::PropertyDelegate::PropertyDelegate(QObject *parent) :QItemDelegate(parent), m_editingItem(0), m_isEditing(false) - //:QStyledItemDelegate(parent), m_editingItem(0) -{ - //setClipping(false); -} +{} void LimeReport::PropertyDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const { diff --git a/limereport/objectinspector/propertyItems/lrfontpropitem.cpp b/limereport/objectinspector/propertyItems/lrfontpropitem.cpp index 87815ad..1c8b506 100644 --- a/limereport/objectinspector/propertyItems/lrfontpropitem.cpp +++ b/limereport/objectinspector/propertyItems/lrfontpropitem.cpp @@ -28,8 +28,6 @@ * GNU General Public License for more details. * ****************************************************************************/ #include -#include -#include #include "lrfontpropitem.h" #include "editors/lrbuttonlineeditor.h" @@ -52,6 +50,7 @@ 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) { + m_bold = new FontAttribPropItem(object,objects,"bold",tr("bold"),propertyValue().value().bold(),this,false); m_italic = new FontAttribPropItem(object,objects,"italic",tr("italic"),propertyValue().value().italic(),this,false); m_underline = new FontAttribPropItem(object,objects,"underline",tr("underline"),propertyValue().value().underline(),this,false); @@ -114,21 +113,25 @@ QString FontFamilyPropItem::displayValue() const QWidget *FontFamilyPropItem::createProperyEditor(QWidget *parent) const { - QFontComboBox* editor = new QFontComboBox(parent); + FontFamilyEditor* editor = new FontFamilyEditor(parent); +// QFontComboBox* editor = new QFontComboBox(parent); + editor->setAutoFillBackground(true); editor->setFont(propertyValue().value()); return editor; } void FontFamilyPropItem::setPropertyEditorData(QWidget *propertyEditor, const QModelIndex &) const { - QFontComboBox* editor = qobject_cast(propertyEditor); - editor->setCurrentFont(propertyValue().value()); + FontFamilyEditor* editor = qobject_cast(propertyEditor); +// QFontComboBox* editor = qobject_cast(propertyEditor); + editor->setFont(propertyValue().value()); } void FontFamilyPropItem::setModelData(QWidget *propertyEditor, QAbstractItemModel *model, const QModelIndex &index) { QFont font = object()->property(parent()->propertyName().toLatin1()).value(); - font.setFamily(qobject_cast(propertyEditor)->currentFont().family()); +// font.setFamily(qobject_cast(propertyEditor)->currentFont().family()); + font.setFamily(qobject_cast(propertyEditor)->currentFont().family()); model->setData(index,font); setValueToObject(parent()->propertyName(),font); } @@ -151,10 +154,33 @@ void FontAttribPropItem::setModelData(QWidget *propertyEditor , QAbstractItemMod void FontPointSizePropItem::setModelData(QWidget *propertyEditor, QAbstractItemModel *model, const QModelIndex &index) { - model->setData(index,qobject_cast(propertyEditor)->value()); + model->setData(index,qobject_cast(propertyEditor)->value()); QFont font = object()->property(parent()->propertyName().toLatin1()).value(); font.setPointSize(propertyValue().toInt()); setValueToObject(parent()->propertyName(),font); } +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->setSpacing(0); + setAutoFillBackground(true); +} + +QFont FontFamilyEditor::currentFont() +{ + return m_valueEditor->currentFont(); +} + +void FontFamilyEditor::setFont(QFont font) +{ + m_valueEditor->setCurrentFont(font); + m_valueEditor->setFont(font); +} + } diff --git a/limereport/objectinspector/propertyItems/lrfontpropitem.h b/limereport/objectinspector/propertyItems/lrfontpropitem.h index 92c0405..fe0219a 100644 --- a/limereport/objectinspector/propertyItems/lrfontpropitem.h +++ b/limereport/objectinspector/propertyItems/lrfontpropitem.h @@ -29,12 +29,27 @@ ****************************************************************************/ #ifndef LRFONTPROPITEM_H #define LRFONTPROPITEM_H + +#include + #include "lrobjectpropitem.h" #include "lrboolpropitem.h" #include "lrintpropitem.h" namespace LimeReport{ +class FontFamilyEditor : public QWidget{ + Q_OBJECT +public: + FontFamilyEditor(QWidget* parent); + QFont currentFont(); + void setFont(QFont font); +signals: + void editingFinished(); +private: + QFontComboBox* m_valueEditor; +}; + class FontFamilyPropItem : public ObjectPropItem { Q_OBJECT diff --git a/limereport/objectinspector/propertyItems/lrintpropitem.cpp b/limereport/objectinspector/propertyItems/lrintpropitem.cpp index 58cfbaa..4f6f374 100644 --- a/limereport/objectinspector/propertyItems/lrintpropitem.cpp +++ b/limereport/objectinspector/propertyItems/lrintpropitem.cpp @@ -67,9 +67,11 @@ void IntPropItem::setModelData(QWidget *propertyEditor, QAbstractItemModel *mode { model->setData(index,qobject_cast(propertyEditor)->value()); object()->setProperty(propertyName().toLatin1(),propertyValue()); - foreach(QObject* item, *objects()){ - if (item->metaObject()->indexOfProperty(propertyName().toLatin1())!=-1){ - item->setProperty(propertyName().toLatin1(),propertyValue()); + if (objects()){ + foreach(QObject* item, *objects()){ + if (item->metaObject()->indexOfProperty(propertyName().toLatin1())!=-1){ + item->setProperty(propertyName().toLatin1(),propertyValue()); + } } } }