mirror of
https://github.com/fralx/LimeReport.git
synced 2024-12-24 16:44:39 +03:00
Merge branch 'master' into 1.4
This commit is contained in:
commit
16605c1414
@ -109,6 +109,7 @@ void AlignmentItemEditor::setModelData(QWidget *propertyEditor, QAbstractItemMod
|
|||||||
int align = m_acceptableValues.value(qobject_cast<ComboBoxEditor*>(propertyEditor)->text());
|
int align = m_acceptableValues.value(qobject_cast<ComboBoxEditor*>(propertyEditor)->text());
|
||||||
flags=clearAcceptableValues(flags) | align;
|
flags=clearAcceptableValues(flags) | align;
|
||||||
object()->setProperty(propertyName().toLatin1(),flags);
|
object()->setProperty(propertyName().toLatin1(),flags);
|
||||||
|
if (objects())
|
||||||
foreach(QObject* item,*objects()){item->setProperty(propertyName().toLatin1(),flags);}
|
foreach(QObject* item,*objects()){item->setProperty(propertyName().toLatin1(),flags);}
|
||||||
parent()->setPropertyValue(flags);
|
parent()->setPropertyValue(flags);
|
||||||
model->setData(index,align);
|
model->setData(index,align);
|
||||||
|
@ -60,6 +60,18 @@ TextItem::TextItem(QObject *owner, QGraphicsItem *parent)
|
|||||||
m_allowHTMLInFields(false)
|
m_allowHTMLInFields(false)
|
||||||
{
|
{
|
||||||
m_text = new QTextDocument();
|
m_text = new QTextDocument();
|
||||||
|
|
||||||
|
PageItemDesignIntf* pageItem = dynamic_cast<PageItemDesignIntf*>(parent);
|
||||||
|
BaseDesignIntf* parentItem = dynamic_cast<BaseDesignIntf*>(parent);
|
||||||
|
while (!pageItem){
|
||||||
|
parentItem = dynamic_cast<BaseDesignIntf*>(parentItem->parentItem());
|
||||||
|
pageItem = dynamic_cast<PageItemDesignIntf*>(parentItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pageItem){
|
||||||
|
QFont defaultFont = pageItem->font();
|
||||||
|
setFont(defaultFont);
|
||||||
|
}
|
||||||
Init();
|
Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,7 +321,7 @@ ObjectPropItem * QObjectPropertyModel::createPropertyItem(QMetaProperty prop, QO
|
|||||||
object,
|
object,
|
||||||
objects,
|
objects,
|
||||||
QString(prop.name()),
|
QString(prop.name()),
|
||||||
QString(tr(prop.name())), //сделать перевод значений на другие языки
|
QString(tr(prop.name())),
|
||||||
object->property(prop.name()),
|
object->property(prop.name()),
|
||||||
parent,
|
parent,
|
||||||
!(prop.isWritable()&&prop.isDesignable())
|
!(prop.isWritable()&&prop.isDesignable())
|
||||||
|
@ -147,10 +147,12 @@ void ObjectPropItem::slotPropertyObjectName(const QString &oldValue, const QStri
|
|||||||
void ObjectPropItem::setValueToObject(const QString &propertyName, QVariant propertyValue)
|
void ObjectPropItem::setValueToObject(const QString &propertyName, QVariant propertyValue)
|
||||||
{
|
{
|
||||||
object()->setProperty(propertyName.toLatin1(),propertyValue);
|
object()->setProperty(propertyName.toLatin1(),propertyValue);
|
||||||
|
if (objects()){
|
||||||
foreach (QObject* item, *objects()) {
|
foreach (QObject* item, *objects()) {
|
||||||
if (item->metaObject()->indexOfProperty(propertyName.toLatin1())!=-1)
|
if (item->metaObject()->indexOfProperty(propertyName.toLatin1())!=-1)
|
||||||
item->setProperty(propertyName.toLatin1(), propertyValue);
|
item->setProperty(propertyName.toLatin1(), propertyValue);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjectPropItem * ObjectPropItem::findChild(const QString &name)
|
ObjectPropItem * ObjectPropItem::findChild(const QString &name)
|
||||||
|
@ -97,7 +97,7 @@ namespace LimeReport{
|
|||||||
#endif
|
#endif
|
||||||
private:
|
private:
|
||||||
bool m_valid;
|
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:
|
protected:
|
||||||
void beginChangeValue(){ m_changingValue = true; }
|
void beginChangeValue(){ m_changingValue = true; }
|
||||||
|
@ -37,10 +37,7 @@
|
|||||||
|
|
||||||
LimeReport::PropertyDelegate::PropertyDelegate(QObject *parent)
|
LimeReport::PropertyDelegate::PropertyDelegate(QObject *parent)
|
||||||
:QItemDelegate(parent), m_editingItem(0), m_isEditing(false)
|
: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
|
void LimeReport::PropertyDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
|
@ -28,8 +28,6 @@
|
|||||||
* GNU General Public License for more details. *
|
* GNU General Public License for more details. *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include <QFontDialog>
|
#include <QFontDialog>
|
||||||
#include <QSpinBox>
|
|
||||||
#include <QFontComboBox>
|
|
||||||
|
|
||||||
#include "lrfontpropitem.h"
|
#include "lrfontpropitem.h"
|
||||||
#include "editors/lrbuttonlineeditor.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)
|
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)
|
:ObjectPropItem(object, objects, name, displayName, value, parent, readonly)
|
||||||
{
|
{
|
||||||
|
|
||||||
m_bold = new FontAttribPropItem(object,objects,"bold",tr("bold"),propertyValue().value<QFont>().bold(),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_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_underline = new FontAttribPropItem(object,objects,"underline",tr("underline"),propertyValue().value<QFont>().underline(),this,false);
|
||||||
@ -114,21 +113,25 @@ QString FontFamilyPropItem::displayValue() const
|
|||||||
|
|
||||||
QWidget *FontFamilyPropItem::createProperyEditor(QWidget *parent) 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<QFont>());
|
editor->setFont(propertyValue().value<QFont>());
|
||||||
return editor;
|
return editor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FontFamilyPropItem::setPropertyEditorData(QWidget *propertyEditor, const QModelIndex &) const
|
void FontFamilyPropItem::setPropertyEditorData(QWidget *propertyEditor, const QModelIndex &) const
|
||||||
{
|
{
|
||||||
QFontComboBox* editor = qobject_cast<QFontComboBox*>(propertyEditor);
|
FontFamilyEditor* editor = qobject_cast<FontFamilyEditor*>(propertyEditor);
|
||||||
editor->setCurrentFont(propertyValue().value<QFont>());
|
// 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>();
|
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);
|
model->setData(index,font);
|
||||||
setValueToObject(parent()->propertyName(),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)
|
void FontPointSizePropItem::setModelData(QWidget *propertyEditor, QAbstractItemModel *model, const QModelIndex &index)
|
||||||
{
|
{
|
||||||
model->setData(index,qobject_cast<QSpinBox*>(propertyEditor)->value());
|
model->setData(index,qobject_cast<SpinBoxEditor*>(propertyEditor)->value());
|
||||||
QFont font = object()->property(parent()->propertyName().toLatin1()).value<QFont>();
|
QFont font = object()->property(parent()->propertyName().toLatin1()).value<QFont>();
|
||||||
font.setPointSize(propertyValue().toInt());
|
font.setPointSize(propertyValue().toInt());
|
||||||
setValueToObject(parent()->propertyName(),font);
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -29,12 +29,27 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#ifndef LRFONTPROPITEM_H
|
#ifndef LRFONTPROPITEM_H
|
||||||
#define LRFONTPROPITEM_H
|
#define LRFONTPROPITEM_H
|
||||||
|
|
||||||
|
#include <QFontComboBox>
|
||||||
|
|
||||||
#include "lrobjectpropitem.h"
|
#include "lrobjectpropitem.h"
|
||||||
#include "lrboolpropitem.h"
|
#include "lrboolpropitem.h"
|
||||||
#include "lrintpropitem.h"
|
#include "lrintpropitem.h"
|
||||||
|
|
||||||
namespace LimeReport{
|
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
|
class FontFamilyPropItem : public ObjectPropItem
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -67,11 +67,13 @@ void IntPropItem::setModelData(QWidget *propertyEditor, QAbstractItemModel *mode
|
|||||||
{
|
{
|
||||||
model->setData(index,qobject_cast<SpinBoxEditor*>(propertyEditor)->value());
|
model->setData(index,qobject_cast<SpinBoxEditor*>(propertyEditor)->value());
|
||||||
object()->setProperty(propertyName().toLatin1(),propertyValue());
|
object()->setProperty(propertyName().toLatin1(),propertyValue());
|
||||||
|
if (objects()){
|
||||||
foreach(QObject* item, *objects()){
|
foreach(QObject* item, *objects()){
|
||||||
if (item->metaObject()->indexOfProperty(propertyName().toLatin1())!=-1){
|
if (item->metaObject()->indexOfProperty(propertyName().toLatin1())!=-1){
|
||||||
item->setProperty(propertyName().toLatin1(),propertyValue());
|
item->setProperty(propertyName().toLatin1(),propertyValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SpinBoxEditor::SpinBoxEditor(QWidget *parent)
|
SpinBoxEditor::SpinBoxEditor(QWidget *parent)
|
||||||
|
Loading…
Reference in New Issue
Block a user