mirror of
https://github.com/fralx/LimeReport.git
synced 2024-12-23 16:22:58 +03:00
Rulers and inches support has been added
This commit is contained in:
parent
9f00bf9db2
commit
667a655e4a
@ -34,7 +34,7 @@ QWidget
|
||||
{
|
||||
color: #eff0f1;
|
||||
background-color: #383838;
|
||||
selection-background-color:#000;
|
||||
selection-background-color:#819a67;
|
||||
selection-color: #eff0f1;
|
||||
background-clip: border;
|
||||
border-image: none;
|
||||
|
@ -34,7 +34,7 @@ QWidget
|
||||
{
|
||||
color: #000;
|
||||
background-color: #f0f0f0;
|
||||
selection-background-color:#000;
|
||||
selection-background-color:#b5da91;
|
||||
selection-color: #000;
|
||||
background-clip: border;
|
||||
border-image: none;
|
||||
|
@ -27,6 +27,7 @@ SOURCES += \
|
||||
$$REPORT_PATH/objectinspector/propertyItems/lrdatasourcepropitem.cpp \
|
||||
$$REPORT_PATH/objectinspector/propertyItems/lrgroupfieldpropitem.cpp \
|
||||
$$REPORT_PATH/objectinspector/propertyItems/lrcontentpropitem.cpp \
|
||||
$$REPORT_PATH/objectinspector/propertyItems/lrmarginpropitem.cpp \
|
||||
$$REPORT_PATH/objectinspector/editors/lrtextitempropertyeditor.cpp \
|
||||
$$REPORT_PATH/objectinspector/editors/lrcomboboxeditor.cpp \
|
||||
$$REPORT_PATH/objectinspector/editors/lrcheckboxeditor.cpp \
|
||||
@ -69,6 +70,7 @@ HEADERS += \
|
||||
$$REPORT_PATH/objectinspector/propertyItems/lrcontentpropitem.h \
|
||||
$$REPORT_PATH/objectinspector/propertyItems/lrqrealpropitem.h \
|
||||
$$REPORT_PATH/objectinspector/propertyItems/lrcolorpropitem.h \
|
||||
$$REPORT_PATH/objectinspector/propertyItems/lrmarginpropitem.h \
|
||||
$$REPORT_PATH/objectinspector/editors/lrtextitempropertyeditor.h \
|
||||
$$REPORT_PATH/objectinspector/editors/lrcomboboxeditor.h \
|
||||
$$REPORT_PATH/objectinspector/editors/lrcheckboxeditor.h \
|
||||
|
@ -34,7 +34,7 @@ public:
|
||||
int childrenCount();
|
||||
int layoutSpacing() const;
|
||||
void setLayoutSpacing(int layoutSpacing);
|
||||
qreal layoutSpacingMM(){ return m_layoutSpacing * mmFactor();}
|
||||
qreal layoutSpacingMM(){ return m_layoutSpacing * unitFactor();}
|
||||
protected:
|
||||
void beforeDelete();
|
||||
void childAddedEvent(BaseDesignIntf *child);
|
||||
|
@ -60,7 +60,6 @@ BaseDesignIntf::BaseDesignIntf(const QString &storageTypeName, QObject *owner, Q
|
||||
m_width(200),
|
||||
m_height(50),
|
||||
m_fontColor(Qt::black),
|
||||
m_mmFactor(Const::mmFACTOR),
|
||||
m_fixedPos(false),
|
||||
m_borderLineSize(1),
|
||||
m_BGMode(OpaqueMode),
|
||||
@ -83,7 +82,8 @@ BaseDesignIntf::BaseDesignIntf(const QString &storageTypeName, QObject *owner, Q
|
||||
m_hovered(false),
|
||||
m_joinMarkerOn(false),
|
||||
m_selectionMarker(0),
|
||||
m_fillTransparentInDesignMode(true)
|
||||
m_fillTransparentInDesignMode(true),
|
||||
m_unitType(Millimeters)
|
||||
{
|
||||
setGeometry(QRectF(0, 0, m_width, m_height));
|
||||
if (BaseDesignIntf *item = dynamic_cast<BaseDesignIntf *>(parent)) {
|
||||
@ -100,7 +100,6 @@ QRectF BaseDesignIntf::boundingRect() const
|
||||
qreal halfpw = pen().widthF() / 2;
|
||||
halfpw += 2;
|
||||
m_boundingRect = rect();
|
||||
m_boundingRect.adjust(-halfpw, -halfpw, halfpw, halfpw);
|
||||
};
|
||||
return m_boundingRect;
|
||||
}
|
||||
@ -185,7 +184,7 @@ void BaseDesignIntf::setWidth(qreal width)
|
||||
|
||||
QString BaseDesignIntf::setItemWidth(qreal width)
|
||||
{
|
||||
setWidth(width * mmFactor());
|
||||
setWidth(width * unitFactor());
|
||||
return QString();
|
||||
}
|
||||
|
||||
@ -194,9 +193,9 @@ qreal BaseDesignIntf::height() const
|
||||
return rect().height();
|
||||
}
|
||||
|
||||
QRectF BaseDesignIntf::geometry() const
|
||||
QRect BaseDesignIntf::geometry() const
|
||||
{
|
||||
return QRectF(pos().x(), pos().y(), width(), height());
|
||||
return QRect(pos().x(), pos().y(), width(), height());
|
||||
}
|
||||
|
||||
void BaseDesignIntf::setHeight(qreal height)
|
||||
@ -206,28 +205,28 @@ void BaseDesignIntf::setHeight(qreal height)
|
||||
|
||||
QString BaseDesignIntf::setItemHeight(qreal height)
|
||||
{
|
||||
setHeight(height * mmFactor());
|
||||
setHeight(height * unitFactor());
|
||||
return QString();
|
||||
}
|
||||
|
||||
qreal BaseDesignIntf::getItemWidth()
|
||||
{
|
||||
return width() / mmFactor();
|
||||
return width() / unitFactor();
|
||||
}
|
||||
|
||||
qreal BaseDesignIntf::getItemHeight()
|
||||
{
|
||||
return height() / mmFactor();
|
||||
return height() / unitFactor();
|
||||
}
|
||||
|
||||
qreal BaseDesignIntf::getItemPosX()
|
||||
{
|
||||
return x() / mmFactor();
|
||||
return x() / unitFactor();
|
||||
}
|
||||
|
||||
qreal BaseDesignIntf::getItemPosY()
|
||||
{
|
||||
return y() / mmFactor();
|
||||
return y() / unitFactor();
|
||||
}
|
||||
|
||||
qreal BaseDesignIntf::getAbsolutePosX()
|
||||
@ -242,13 +241,13 @@ qreal BaseDesignIntf::getAbsolutePosY()
|
||||
|
||||
QString BaseDesignIntf::setItemPosX(qreal xValue)
|
||||
{
|
||||
setItemPos(xValue * mmFactor(),y());
|
||||
setItemPos(xValue * unitFactor(),y());
|
||||
return QString();
|
||||
}
|
||||
|
||||
QString BaseDesignIntf::setItemPosY(qreal yValue)
|
||||
{
|
||||
setItemPos(x(),yValue * mmFactor());
|
||||
setItemPos(x(),yValue * unitFactor());
|
||||
return QString();
|
||||
}
|
||||
|
||||
@ -337,32 +336,46 @@ QSizeF BaseDesignIntf::size() const
|
||||
|
||||
QSizeF BaseDesignIntf::sizeMM() const
|
||||
{
|
||||
return QSizeF(width() / m_mmFactor, height() / m_mmFactor);
|
||||
return QSizeF(width() / Const::mmFACTOR, height() / Const::mmFACTOR);
|
||||
}
|
||||
|
||||
qreal BaseDesignIntf::widthMM() const
|
||||
{
|
||||
return width() / m_mmFactor;
|
||||
return width() / Const::mmFACTOR;
|
||||
}
|
||||
|
||||
qreal BaseDesignIntf::heightMM() const
|
||||
{
|
||||
return height() / m_mmFactor;
|
||||
return height() / Const::mmFACTOR;
|
||||
}
|
||||
|
||||
void BaseDesignIntf::setMMFactor(qreal mmFactor)
|
||||
//void BaseDesignIntf::setUnitFactor(qreal unitFactor)
|
||||
//{
|
||||
// m_unitFactor = unitFactor;
|
||||
//}
|
||||
|
||||
qreal BaseDesignIntf::unitFactor() const
|
||||
{
|
||||
m_mmFactor = mmFactor;
|
||||
if (m_unitType == Millimeters)
|
||||
return Const::mmFACTOR;
|
||||
else return Const::mmFACTOR * 2.54;
|
||||
}
|
||||
|
||||
qreal BaseDesignIntf::mmFactor() const
|
||||
void BaseDesignIntf::setUnitType(BaseDesignIntf::UnitType value)
|
||||
{
|
||||
return m_mmFactor;
|
||||
foreach(BaseDesignIntf* child, childBaseItems())
|
||||
child->setUnitType(value);
|
||||
m_unitType = value;
|
||||
}
|
||||
|
||||
BaseDesignIntf::UnitType BaseDesignIntf::unitType()
|
||||
{
|
||||
return m_unitType;
|
||||
}
|
||||
|
||||
QPointF BaseDesignIntf::posMM() const
|
||||
{
|
||||
return QPointF(pos().x() / m_mmFactor, pos().y() / m_mmFactor);
|
||||
return QPointF(pos().x() / Const::mmFACTOR, pos().y() / Const::mmFACTOR);
|
||||
}
|
||||
|
||||
QRectF BaseDesignIntf::rect() const
|
||||
@ -652,8 +665,8 @@ QPointF BaseDesignIntf::modifyPosForAlignedItem(const QPointF& pos){
|
||||
BaseDesignIntf* parent = dynamic_cast<BaseDesignIntf*>(parentItem());
|
||||
PageItemDesignIntf* parentPage = dynamic_cast<PageItemDesignIntf*>(parentItem());
|
||||
if (parent){
|
||||
qreal leftBorder = parentPage?parentPage->leftMargin()*mmFactor():0;
|
||||
qreal rightBorder = parentPage?parentPage->rightMargin()*mmFactor():0;
|
||||
qreal leftBorder = parentPage ? parentPage->leftMargin() * Const::mmFACTOR : 0;
|
||||
qreal rightBorder = parentPage ? parentPage->rightMargin() * Const::mmFACTOR : 0;
|
||||
qreal avaibleSpace = parent->width()-(leftBorder+rightBorder);
|
||||
|
||||
switch(m_itemAlign){
|
||||
@ -694,10 +707,9 @@ void BaseDesignIntf::updateItemAlign(){
|
||||
PageItemDesignIntf* parentPage = dynamic_cast<PageItemDesignIntf*>(parentItem());
|
||||
m_changingItemAlign = true;
|
||||
if (parent){
|
||||
qreal leftBorder = parentPage?parentPage->leftMargin()*mmFactor():0;
|
||||
qreal rightBorder = parentPage?parentPage->rightMargin()*mmFactor():0;
|
||||
qreal leftBorder = parentPage ? parentPage->leftMargin() * Const::mmFACTOR : 0;
|
||||
qreal rightBorder = parentPage ? parentPage->rightMargin() * Const::mmFACTOR : 0;
|
||||
qreal aviableSpace = parent->width()-(leftBorder+rightBorder);
|
||||
|
||||
setPos(modifyPosForAlignedItem(pos()));
|
||||
if (m_itemAlign == ParentWidthItemAlign)
|
||||
setWidth(aviableSpace);
|
||||
@ -732,6 +744,11 @@ void BaseDesignIntf::setFillTransparentInDesignMode(bool fillTransparentInDesign
|
||||
m_fillTransparentInDesignMode = fillTransparentInDesignMode;
|
||||
}
|
||||
|
||||
void BaseDesignIntf::emitPosChanged(QPointF oldPos, QPointF newPos)
|
||||
{
|
||||
emit posChanged(this, oldPos, newPos);
|
||||
}
|
||||
|
||||
bool BaseDesignIntf::fillInSecondPass() const
|
||||
{
|
||||
return m_fillInSecondPass;
|
||||
@ -1031,9 +1048,9 @@ void BaseDesignIntf::beforeDelete()
|
||||
|
||||
}
|
||||
|
||||
void BaseDesignIntf::setGeometryProperty(QRectF rect)
|
||||
void BaseDesignIntf::setGeometryProperty(QRect rect)
|
||||
{
|
||||
if (rect!=geometry()){
|
||||
if ( rect != m_itemGeometry ){
|
||||
QRectF oldValue = geometry();
|
||||
if ((rect.x() != geometry().x()) || (rect.y() != geometry().y()))
|
||||
setPos(rect.x(), rect.y());
|
||||
@ -1098,8 +1115,10 @@ void BaseDesignIntf::initMode(ItemMode mode)
|
||||
|
||||
QVariant BaseDesignIntf::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value)
|
||||
{
|
||||
|
||||
if (change == QGraphicsItem::ItemPositionHasChanged) {
|
||||
updateSelectionMarker();
|
||||
emit geometryChanged(this, geometry(), geometry());
|
||||
}
|
||||
|
||||
if (change == QGraphicsItem::ItemSelectedChange) {
|
||||
|
@ -88,7 +88,8 @@ class BaseDesignIntf :
|
||||
Q_ENUMS(BrushStyle)
|
||||
Q_ENUMS(ItemAlign)
|
||||
Q_FLAGS(BorderLines)
|
||||
Q_PROPERTY(QRectF geometry READ geometry WRITE setGeometryProperty NOTIFY geometryChanged)
|
||||
Q_ENUMS(UnitType)
|
||||
Q_PROPERTY(QRect geometry READ geometry WRITE setGeometryProperty NOTIFY geometryChanged)
|
||||
Q_PROPERTY(ACollectionProperty children READ fakeCollectionReader DESIGNABLE false)
|
||||
Q_PROPERTY(qreal zOrder READ zValue WRITE setZValueProperty DESIGNABLE false)
|
||||
Q_PROPERTY(BorderLines borders READ borderLines WRITE setBorderLinesFlags)
|
||||
@ -137,6 +138,7 @@ public:
|
||||
};
|
||||
enum ObjectState {ObjectLoading, ObjectLoaded, ObjectCreated};
|
||||
enum ItemAlign {LeftItemAlign,RightItemAlign,CenterItemAlign,ParentWidthItemAlign,DesignedItemAlign};
|
||||
enum UnitType {Millimeters, Inches};
|
||||
// enum ExpandType {EscapeSymbols, NoEscapeSymbols, ReplaceHTMLSymbols};
|
||||
Q_DECLARE_FLAGS(BorderLines, BorderSide)
|
||||
Q_DECLARE_FLAGS(ItemMode,ItemModes)
|
||||
@ -183,12 +185,13 @@ public:
|
||||
bool isFixedPos(){return m_fixedPos;}
|
||||
int resizeHandleSize() const;
|
||||
|
||||
void setMMFactor(qreal mmFactor);
|
||||
qreal mmFactor() const;
|
||||
virtual QRectF geometry() const;
|
||||
qreal unitFactor() const;
|
||||
void setUnitType(UnitType unitType);
|
||||
UnitType unitType();
|
||||
virtual QRect geometry() const;
|
||||
void setGeometry(QRectF rect);
|
||||
|
||||
QRectF rect()const;
|
||||
QRectF rect() const;
|
||||
void setupPainter(QPainter* painter) const;
|
||||
virtual QRectF boundingRect() const;
|
||||
|
||||
@ -209,7 +212,7 @@ public:
|
||||
ItemMode itemMode() const {return m_itemMode;}
|
||||
|
||||
virtual void setBorderLinesFlags(LimeReport::BaseDesignIntf::BorderLines flags);
|
||||
void setGeometryProperty(QRectF rect);
|
||||
void setGeometryProperty(QRect rect);
|
||||
PageDesignIntf* page();
|
||||
|
||||
BorderLines borderLines() const;
|
||||
@ -297,6 +300,7 @@ public:
|
||||
|
||||
bool fillTransparentInDesignMode() const;
|
||||
void setFillTransparentInDesignMode(bool fillTransparentInDesignMode);
|
||||
void emitPosChanged(QPointF oldPos, QPointF newPos);
|
||||
|
||||
protected:
|
||||
|
||||
@ -380,7 +384,6 @@ private:
|
||||
QPen m_pen;
|
||||
QFont m_font;
|
||||
QColor m_fontColor;
|
||||
qreal m_mmFactor;
|
||||
bool m_fixedPos;
|
||||
int m_borderLineSize;
|
||||
|
||||
@ -422,6 +425,8 @@ private:
|
||||
SelectionMarker* m_selectionMarker;
|
||||
Marker* m_joinMarker;
|
||||
bool m_fillTransparentInDesignMode;
|
||||
QRect m_itemGeometry;
|
||||
UnitType m_unitType;
|
||||
signals:
|
||||
void geometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry);
|
||||
void posChanging(QObject* object, QPointF newPos, QPointF oldPos);
|
||||
|
@ -294,7 +294,7 @@ ObjectPropItem * createReqtItem(
|
||||
ObjectPropItem * createReqtMMItem(
|
||||
QObject*object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly
|
||||
){
|
||||
return new LimeReport::RectMMPropItem(object, objects, name, displayName, data, parent, readonly);
|
||||
return new LimeReport::RectUnitPropItem(object, objects, name, displayName, data, parent, readonly);
|
||||
}
|
||||
|
||||
ObjectPropItem * createStringPropItem(
|
||||
|
@ -268,7 +268,10 @@ void PageDesignIntf::setPageItem(PageItemDesignIntf::Ptr pageItem)
|
||||
}
|
||||
m_pageItem = pageItem;
|
||||
m_pageItem->setItemMode(itemMode());
|
||||
setSceneRect(pageItem->rect().adjusted(-10*Const::mmFACTOR,-10*Const::mmFACTOR,10*Const::mmFACTOR,10*Const::mmFACTOR));
|
||||
setSceneRect(pageItem->rect().adjusted(-10 * Const::mmFACTOR,
|
||||
-10 * Const::mmFACTOR,
|
||||
10 * Const::mmFACTOR,
|
||||
10 * Const::mmFACTOR));
|
||||
addItem(m_pageItem.data());
|
||||
registerItem(m_pageItem.data());
|
||||
}
|
||||
@ -290,7 +293,10 @@ void PageDesignIntf::setPageItems(QList<PageItemDesignIntf::Ptr> pages)
|
||||
curHeight+=pageItem->height()+20;
|
||||
if (curWidth<pageItem->width()) curWidth=pageItem->width();
|
||||
}
|
||||
setSceneRect(QRectF(0,0,curWidth,curHeight).adjusted(-10*Const::mmFACTOR,-10*Const::mmFACTOR,10*Const::mmFACTOR,10*Const::mmFACTOR));
|
||||
setSceneRect(QRectF( 0, 0, curWidth,curHeight).adjusted( -10 * Const::mmFACTOR,
|
||||
-10 * Const::mmFACTOR,
|
||||
10 * Const::mmFACTOR,
|
||||
10 * Const::mmFACTOR));
|
||||
if (m_reportPages.count()>0)
|
||||
m_currentPage = m_reportPages.at(0).data();
|
||||
|
||||
@ -500,6 +506,7 @@ BaseDesignIntf *PageDesignIntf::addReportItem(const QString &itemType, QPointF p
|
||||
BaseDesignIntf *reportItem = addReportItem(itemType, band, band);
|
||||
reportItem->setPos(placePosOnGrid(band->mapFromScene(pos)));
|
||||
reportItem->setSize(placeSizeOnGrid(size));
|
||||
reportItem->setUnitType(pageItem()->unitType());
|
||||
return reportItem;
|
||||
} else {
|
||||
PageItemDesignIntf* page = pageItem() ? pageItem() : m_currentPage;
|
||||
@ -507,6 +514,7 @@ BaseDesignIntf *PageDesignIntf::addReportItem(const QString &itemType, QPointF p
|
||||
BaseDesignIntf *reportItem = addReportItem(itemType, page, page);
|
||||
reportItem->setPos(placePosOnGrid(page->mapFromScene(pos)));
|
||||
reportItem->setSize(placeSizeOnGrid(size));
|
||||
reportItem->setUnitType(pageItem()->unitType());
|
||||
ItemDesignIntf* ii = dynamic_cast<ItemDesignIntf*>(reportItem);
|
||||
if (ii)
|
||||
ii->setItemLocation(ItemDesignIntf::Page);
|
||||
@ -522,6 +530,7 @@ BaseDesignIntf *PageDesignIntf::addReportItem(const QString &itemType, QObject *
|
||||
BaseDesignIntf *item = LimeReport::DesignElementsFactory::instance().objectCreator(itemType)((owner) ? owner : pageItem(), (parent) ? parent : pageItem());
|
||||
item->setObjectName(genObjectName(*item));
|
||||
item->setItemTypeName(itemType);
|
||||
item->setUnitType(pageItem()->unitType());
|
||||
registerItem(item);
|
||||
return item;
|
||||
}
|
||||
@ -2087,7 +2096,11 @@ bool PosChangedCommand::doIt()
|
||||
for (int i = 0; i < m_newPos.count(); i++) {
|
||||
BaseDesignIntf *reportItem = page()->reportItemByName(m_newPos[i].objectName);
|
||||
|
||||
if (reportItem && (reportItem->pos() != m_newPos[i].pos)) reportItem->setPos(m_newPos[i].pos);
|
||||
if (reportItem && (reportItem->pos() != m_newPos[i].pos)){
|
||||
QPointF oldValue = reportItem->pos();
|
||||
reportItem->setPos(m_newPos[i].pos);
|
||||
emit reportItem->posChanged(reportItem, oldValue, reportItem->pos());
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -2098,7 +2111,11 @@ void PosChangedCommand::undoIt()
|
||||
for (int i = 0; i < m_oldPos.count(); i++) {
|
||||
BaseDesignIntf *reportItem = page()->reportItemByName(m_oldPos[i].objectName);
|
||||
|
||||
if (reportItem && (reportItem->pos() != m_oldPos[i].pos)) reportItem->setPos(m_oldPos[i].pos);
|
||||
if (reportItem && (reportItem->pos() != m_oldPos[i].pos)){
|
||||
QPointF oldValue = reportItem->pos();
|
||||
reportItem->setPos(m_oldPos[i].pos);
|
||||
reportItem->emitPosChanged(oldValue, reportItem->pos());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -544,8 +544,8 @@ void PageItemDesignIntf::relocateBands()
|
||||
m_bands[i+1]->setPos(pageRect().x(),posByColumn[0]);
|
||||
posByColumn[0] += m_bands[i+1]->height()+bandSpace;
|
||||
} else {
|
||||
m_bands[i+1]->setPos(pageRect().x(),posByColumn[0]+2);
|
||||
posByColumn[0] += m_bands[i+1]->height()+bandSpace+2;
|
||||
m_bands[i+1]->setPos(pageRect().x(),posByColumn[0]);
|
||||
posByColumn[0] += m_bands[i+1]->height()+bandSpace;
|
||||
}
|
||||
} else {
|
||||
m_bands[i+1]->setPos(m_bands[i+1]->pos().x(),posByColumn[m_bands[i+1]->columnIndex()]);
|
||||
@ -904,6 +904,18 @@ void PageItemDesignIntf::bandGeometryChanged(QObject* object, QRectF newGeometry
|
||||
bandPositionChanged(object, newGeometry.topLeft(), oldGeometry.topLeft());
|
||||
}
|
||||
|
||||
void PageItemDesignIntf::setUnitTypeProperty(BaseDesignIntf::UnitType value)
|
||||
{
|
||||
if (unitType() != value){
|
||||
UnitType oldValue = unitType();
|
||||
setUnitType(value);
|
||||
if (!isLoading()){
|
||||
update();
|
||||
notify("units", oldValue, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PageItemDesignIntf::collectionLoadFinished(const QString &collectionName)
|
||||
{
|
||||
if (collectionName.compare("children",Qt::CaseInsensitive)==0){
|
||||
@ -925,8 +937,12 @@ void PageItemDesignIntf::collectionLoadFinished(const QString &collectionName)
|
||||
void PageItemDesignIntf::updateMarginRect()
|
||||
{
|
||||
m_pageRect = rect();
|
||||
m_pageRect.adjust(m_leftMargin*mmFactor(),m_topMargin*mmFactor(),
|
||||
-m_rightMargin*mmFactor(),-m_bottomMargin*mmFactor());
|
||||
m_pageRect.adjust( leftMargin() * Const::mmFACTOR,
|
||||
topMargin() * Const::mmFACTOR,
|
||||
-rightMargin() * Const::mmFACTOR,
|
||||
-bottomMargin() * Const::mmFACTOR
|
||||
);
|
||||
|
||||
foreach(BandDesignIntf* band,m_bands){
|
||||
band->setWidth(pageRect().width()/band->columnsCount());
|
||||
relocateBands();
|
||||
@ -944,20 +960,27 @@ void PageItemDesignIntf::paintGrid(QPainter *ppainter, QRectF rect)
|
||||
ppainter->save();
|
||||
ppainter->setPen(QPen(gridColor()));
|
||||
ppainter->setOpacity(0.5);
|
||||
for (int i=0;i<=(rect.height()-50)/100;i++){
|
||||
ppainter->drawLine(rect.x(),(i*100)+rect.y()+50,rect.right(),i*100+rect.y()+50);
|
||||
for (int i = 0; i <= (rect.height() - 5 * unitFactor()) / (10 * unitFactor()); ++i){
|
||||
if (i * 10 * unitFactor() + 5 * unitFactor() >= topMargin() * Const::mmFACTOR)
|
||||
ppainter->drawLine(rect.x(), (i * 10 * unitFactor()) + ( (rect.y() + 5 * unitFactor()) - (topMargin() * Const::mmFACTOR)),
|
||||
rect.right(), i * 10 * unitFactor() +( (rect.y() + 5 * unitFactor()) - (topMargin() * Const::mmFACTOR)));
|
||||
};
|
||||
for (int i=0;i<=((rect.width()-50)/100);i++){
|
||||
ppainter->drawLine(i*100+rect.x()+50,rect.y(),i*100+rect.x()+50,rect.bottom());
|
||||
for (int i=0; i<=((rect.width() - 5 * unitFactor()) / (10 * unitFactor())); ++i){
|
||||
if (i * 10 * unitFactor() + 5 * unitFactor() >= leftMargin() * Const::mmFACTOR)
|
||||
ppainter->drawLine(i * 10 * unitFactor() + ((rect.x() + 5 * unitFactor()) - (leftMargin() * Const::mmFACTOR)), rect.y(),
|
||||
i * 10 * unitFactor() + ((rect.x() + 5 * unitFactor()) - (leftMargin() * Const::mmFACTOR)), rect.bottom());
|
||||
};
|
||||
|
||||
ppainter->setPen(QPen(gridColor()));
|
||||
ppainter->setOpacity(1);
|
||||
for (int i=0;i<=(rect.width()/100);i++){
|
||||
ppainter->drawLine(i*100+rect.x(),rect.y(),i*100+rect.x(),rect.bottom());
|
||||
for (int i = 0; i <= (rect.width() / (10 * unitFactor())); ++i){
|
||||
if (i * 10 * unitFactor() >= leftMargin() * Const::mmFACTOR)
|
||||
ppainter->drawLine(i * 10 * unitFactor() + (rect.x() - (leftMargin() * Const::mmFACTOR)), rect.y(),
|
||||
i * 10 * unitFactor() + (rect.x() - (leftMargin() * Const::mmFACTOR)), rect.bottom());
|
||||
};
|
||||
for (int i=0;i<=rect.height()/100;i++){
|
||||
ppainter->drawLine(rect.x(),i*100+rect.y(),rect.right(),i*100+rect.y());
|
||||
for (int i = 0; i <= rect.height() / (10 * unitFactor()); ++i){
|
||||
if (i * 10 * unitFactor() >= topMargin() * Const::mmFACTOR)
|
||||
ppainter->drawLine(rect.x(), i * 10 * unitFactor() + (rect.y() - (topMargin() * Const::mmFACTOR)),
|
||||
rect.right(), i * 10 * unitFactor() + (rect.y() - (topMargin() * Const::mmFACTOR)));
|
||||
};
|
||||
ppainter->drawRect(rect);
|
||||
ppainter->restore();
|
||||
|
@ -61,6 +61,7 @@ class PageItemDesignIntf : public ItemsContainerDesignInft
|
||||
Q_PROPERTY(bool endlessHeight READ endlessHeight WRITE setEndlessHeight)
|
||||
Q_PROPERTY(bool printable READ isPrintable WRITE setPrintable)
|
||||
Q_PROPERTY(QString printerName READ printerName WRITE setPrinterName)
|
||||
Q_PROPERTY(UnitType units READ unitType WRITE setUnitTypeProperty)
|
||||
friend class ReportRender;
|
||||
public:
|
||||
enum Orientation { Portrait = QPrinter::Portrait, Landscape = QPrinter::Landscape };
|
||||
@ -169,6 +170,7 @@ protected slots:
|
||||
void bandDeleted(QObject* band);
|
||||
void bandPositionChanged(QObject* object, QPointF newPos, QPointF oldPos);
|
||||
void bandGeometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry);
|
||||
void setUnitTypeProperty(BaseDesignIntf::UnitType value);
|
||||
protected:
|
||||
void collectionLoadFinished(const QString& collectionName);
|
||||
QRectF& pageRect(){return m_pageRect;}
|
||||
|
@ -277,10 +277,12 @@ void ReportDesignWidget::createTabs(){
|
||||
m_tabWidget->clear();
|
||||
int pageIndex = -1;
|
||||
for (int i = 0; i<m_report->pageCount();++i){
|
||||
QGraphicsView* view = new QGraphicsView(qobject_cast<QWidget*>(this));
|
||||
// QGraphicsView* view = new QGraphicsView(qobject_cast<QWidget*>(this));
|
||||
PageView* view = new PageView(qobject_cast<QWidget*>(this));
|
||||
view->setBackgroundBrush(QBrush(Qt::gray));
|
||||
view->setFrameShape(QFrame::NoFrame);
|
||||
view->setScene(m_report->pageAt(i));
|
||||
view->setPageItem(m_report->pageAt(i)->pageItem());
|
||||
|
||||
// foreach(QGraphicsItem* item, m_report->pageAt(i)->selectedItems()){
|
||||
// item->setSelected(false);
|
||||
@ -1017,6 +1019,179 @@ void ReportDesignWidget::clear()
|
||||
m_scriptEditor->setPlainText("");
|
||||
}
|
||||
|
||||
void PageView::setPageItem(PageItemDesignIntf *pageItem)
|
||||
{
|
||||
if (!pageItem) return;
|
||||
m_pageItem = pageItem;
|
||||
if (!m_horizontalRuller){
|
||||
m_horizontalRuller = new Ruler(Ruler::Horizontal, this);
|
||||
m_horizontalRuller->setPage(pageItem);
|
||||
}
|
||||
if (!m_verticalRuller){
|
||||
m_verticalRuller = new Ruler(Ruler::Vertical, this);
|
||||
m_verticalRuller->setPage(pageItem);
|
||||
}
|
||||
}
|
||||
|
||||
bool PageView::viewportEvent(QEvent *event)
|
||||
{
|
||||
switch (event->type()) {
|
||||
case QEvent::MouseMove:
|
||||
m_horizontalRuller->setMousePos(dynamic_cast<QMouseEvent*>(event)->pos());
|
||||
m_verticalRuller->setMousePos(dynamic_cast<QMouseEvent*>(event)->pos());
|
||||
m_horizontalRuller->update();
|
||||
m_verticalRuller->update();
|
||||
break;
|
||||
//case QEvent::Resize:
|
||||
case QEvent::Paint:
|
||||
if (m_horizontalRuller){
|
||||
int x = mapFromScene(m_pageItem->boundingRect().x(),m_pageItem->boundingRect().y()).x();
|
||||
int y = mapFromScene(m_pageItem->boundingRect().x(),m_pageItem->boundingRect().y()).y();
|
||||
int width = mapFromScene(m_pageItem->boundingRect().bottomRight().x(),m_pageItem->boundingRect().bottomRight().y()).x();
|
||||
int height = mapFromScene(m_pageItem->boundingRect().bottomRight().x(),m_pageItem->boundingRect().bottomRight().y()).y();
|
||||
|
||||
x = x < 0 ? 0 : x;
|
||||
y = y < 0 ? 0 : y;
|
||||
|
||||
m_horizontalRuller->setGeometry(x+20, 0, (width-x), 20);
|
||||
m_verticalRuller->setGeometry(0, y+20, 20, (height - y));
|
||||
m_verticalRuller->update();
|
||||
m_horizontalRuller->update();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return QGraphicsView::viewportEvent(event);
|
||||
}
|
||||
|
||||
void Ruler::setPage(PageItemDesignIntf *page)
|
||||
{
|
||||
m_page = page;
|
||||
|
||||
}
|
||||
|
||||
void Ruler::paintEvent(QPaintEvent *event){
|
||||
QPainter painter(this);
|
||||
painter.setBrush(palette().background());
|
||||
painter.setPen(Qt::NoPen);
|
||||
painter.drawRect(event->rect());
|
||||
// painter.setPen(palette().foreground().color());
|
||||
|
||||
if (m_page){
|
||||
qreal rulerWidth = m_page->geometry().width() / m_page->unitFactor();
|
||||
qreal rulerHeight = m_page->geometry().height() / m_page->unitFactor();
|
||||
|
||||
QGraphicsView* view = qobject_cast<QGraphicsView*>(parent());
|
||||
|
||||
int hStartPos = view->mapFromScene(0,0).x();
|
||||
int vStartPos = view->mapFromScene(0,0).y();
|
||||
|
||||
QFont font = painter.font();
|
||||
font.setPointSize(7);
|
||||
painter.setFont(font);
|
||||
|
||||
switch (m_type) {
|
||||
case Horizontal:
|
||||
painter.setPen(Qt::NoPen);
|
||||
|
||||
if (isColorDark(palette().background().color()))
|
||||
painter.setBrush(QColor("#64893d"));
|
||||
else
|
||||
painter.setBrush(QColor("#b5da91"));
|
||||
|
||||
drawItemWithChildren(&painter, m_page);
|
||||
painter.setPen(palette().foreground().color());
|
||||
|
||||
for (int i = 0; i < rulerWidth / 10; ++i){
|
||||
int hs10 = view->mapFromScene(QPointF(m_page->geometry().topLeft().x() + i * 10 * m_page->unitFactor(), 0)).x();
|
||||
int hs5 = view->mapFromScene(QPointF(m_page->geometry().topLeft().x() + i * 10 * m_page->unitFactor() + 5 * m_page->unitFactor(), 0)).x();
|
||||
if (hs10 > 0){
|
||||
if (hStartPos > 0){
|
||||
hs10 -= hStartPos;
|
||||
hs5 -= hStartPos;
|
||||
}
|
||||
painter.drawLine(hs10, 15, hs10, 20);
|
||||
painter.drawLine(hs5, 10, hs5, 20);
|
||||
if ( i > 0)
|
||||
painter.drawText(QPoint(hs10 - (painter.fontMetrics().width(QString::number(i))/2), 12),
|
||||
QString::number(i));
|
||||
}
|
||||
}
|
||||
painter.setPen(Qt::black);
|
||||
painter.drawLine(m_mousePos.x() - (hStartPos > 0 ? hStartPos : 0) , 0,
|
||||
m_mousePos.x() - (hStartPos > 0 ? hStartPos : 0) , 20);
|
||||
break;
|
||||
case Vertical:
|
||||
painter.setPen(Qt::NoPen);
|
||||
|
||||
if (isColorDark(palette().background().color()))
|
||||
painter.setBrush(QColor("#64893d"));
|
||||
else
|
||||
painter.setBrush(QColor("#b5da91"));
|
||||
|
||||
drawItemWithChildren(&painter, m_page);
|
||||
painter.setPen(palette().foreground().color());
|
||||
for (int i = 0; i < rulerHeight / 10; ++i){
|
||||
int vs10 = view->mapFromScene(QPointF(0, m_page->geometry().topLeft().y()+i * 10 * m_page->unitFactor())).y();
|
||||
int vs5 = view->mapFromScene(QPointF(0, m_page->geometry().topLeft().y()+i * 10 * m_page->unitFactor() + 5 * m_page->unitFactor())).y();
|
||||
if (vs10 > 0){
|
||||
if (vStartPos > 0){
|
||||
vs10 -= vStartPos;
|
||||
vs5 -= vStartPos;
|
||||
}
|
||||
painter.drawLine(15, vs10, 20, vs10);
|
||||
if ( i > 0 )
|
||||
painter.drawText(QPoint( (15 - painter.fontMetrics().width(QString::number(i))) / 2 ,
|
||||
vs10 + (painter.fontMetrics().height()/2)), QString::number(i));
|
||||
painter.drawLine(10, vs5, 20, vs5);
|
||||
}
|
||||
}
|
||||
painter.setPen(Qt::black);
|
||||
painter.drawLine(0, m_mousePos.y() - (vStartPos > 0 ? vStartPos : 0),
|
||||
20, m_mousePos.y() - (vStartPos > 0 ? vStartPos : 0));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Ruler::drawItemWithChildren(QPainter* painter, BaseDesignIntf *item)
|
||||
{
|
||||
foreach(BaseDesignIntf* child, item->childBaseItems()){
|
||||
if (!child->childBaseItems().isEmpty())
|
||||
drawItemWithChildren(painter, child);
|
||||
else drawItem(painter, child);
|
||||
|
||||
}
|
||||
drawItem(painter, item);
|
||||
}
|
||||
|
||||
void Ruler::drawItem(QPainter* painter, BaseDesignIntf *item)
|
||||
{
|
||||
if (!item->isSelected()) return;
|
||||
|
||||
QGraphicsView* view = qobject_cast<QGraphicsView*>(parent());
|
||||
int hStartPos = view->mapFromScene(0,0).x();
|
||||
int vStartPos = view->mapFromScene(0,0).y();
|
||||
|
||||
switch (m_type) {
|
||||
case Horizontal:
|
||||
if (item->isSelected())
|
||||
painter->drawRect(view->mapFromScene(item->mapToScene(0,0)).x() - hStartPos, 0,
|
||||
view->mapFromScene(item->geometry().bottomRight().x() - item->pos().x(), 0).x() - hStartPos, 20);
|
||||
|
||||
|
||||
break;
|
||||
case Vertical:
|
||||
if (item->isSelected())
|
||||
painter->drawRect(0, view->mapFromScene(item->mapToScene(0, 0)).y() - vStartPos,
|
||||
20, view->mapFromScene(0, item->geometry().bottomRight().y() - item->pos().y()).y() - vStartPos);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -64,6 +64,46 @@ class TranslationEditor;
|
||||
class ScriptEditor;
|
||||
|
||||
|
||||
class Ruler: public QWidget{
|
||||
public:
|
||||
enum RulerType{Horizontal, Vertical};
|
||||
Ruler(RulerType type, QWidget* parent = 0): QWidget(parent), m_page(0), m_type(type){}
|
||||
void setPage(PageItemDesignIntf* page);
|
||||
void setMousePos(QPoint mousePos){ m_mousePos = mousePos;}
|
||||
protected:
|
||||
void paintEvent(QPaintEvent* event);
|
||||
void drawItemWithChildren(QPainter *painter, BaseDesignIntf* item);
|
||||
void drawItem(QPainter *painter, BaseDesignIntf* item);
|
||||
private:
|
||||
PageItemDesignIntf* m_page;
|
||||
RulerType m_type;
|
||||
QPoint m_mousePos;
|
||||
};
|
||||
|
||||
class PageView: public QGraphicsView{
|
||||
public:
|
||||
PageView(QWidget *parent = nullptr): QGraphicsView(parent),
|
||||
m_horizontalRuller(0), m_verticalRuller(0)
|
||||
{
|
||||
setViewportMargins(20,20,0,0);
|
||||
}
|
||||
PageView(QGraphicsScene *scene, QWidget *parent = nullptr):
|
||||
QGraphicsView(scene, parent),
|
||||
m_horizontalRuller(0), m_verticalRuller(0)
|
||||
{
|
||||
setViewportMargins(20,20,0,0);
|
||||
}
|
||||
void setPageItem(PageItemDesignIntf* pageItem);
|
||||
protected:
|
||||
// void mouseMoveEvent(QMouseEvent *event);
|
||||
// void resizeEvent(QResizeEvent *event);
|
||||
bool viewportEvent(QEvent *event);
|
||||
private:
|
||||
PageItemDesignIntf* m_pageItem;
|
||||
Ruler* m_horizontalRuller;
|
||||
Ruler* m_verticalRuller;
|
||||
};
|
||||
|
||||
class ReportDesignWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -1786,8 +1786,8 @@ bool PrintProcessor::printPage(PageItemDesignIntf::Ptr page)
|
||||
m_printer->getPageMargins(&leftMargin, &topMargin, &rightMargin, &bottomMargin, QPrinter::Millimeter);
|
||||
|
||||
QRectF printerPageRect = m_printer->pageRect(QPrinter::Millimeter);
|
||||
printerPageRect = QRectF(0,0,(printerPageRect.size().width() + rightMargin + leftMargin) * Const::mmFACTOR,
|
||||
(printerPageRect.size().height() + bottomMargin +topMargin) * Const::mmFACTOR);
|
||||
printerPageRect = QRectF(0,0,(printerPageRect.size().width() + rightMargin + leftMargin) * page->unitFactor(),
|
||||
(printerPageRect.size().height() + bottomMargin +topMargin) * page->unitFactor());
|
||||
|
||||
if (m_printer->pageSize() != static_cast<QPrinter::PageSize>(page->pageSize()) &&
|
||||
printerPageRect.width() < page->geometry().width())
|
||||
|
@ -1241,9 +1241,9 @@ void ReportRender::startNewPage(bool isFirst)
|
||||
emit m_patternPageItem->beforeRender();
|
||||
|
||||
m_renderPageItem->setObjectName(QLatin1String("ReportPage")+QString::number(m_pageCount));
|
||||
m_maxHeightByColumn[m_currentColumn]=m_renderPageItem->pageRect().height();
|
||||
m_currentStartDataPos[m_currentColumn]=m_patternPageItem->topMargin()*Const::mmFACTOR;
|
||||
m_currentIndex=0;
|
||||
m_maxHeightByColumn[m_currentColumn] = m_renderPageItem->pageRect().height();
|
||||
m_currentStartDataPos[m_currentColumn] = m_patternPageItem->topMargin() * Const::mmFACTOR;
|
||||
m_currentIndex = 0;
|
||||
|
||||
if (isFirst) {
|
||||
renderReportHeader(m_patternPageItem, BeforePageHeader);
|
||||
@ -1254,7 +1254,7 @@ void ReportRender::startNewPage(bool isFirst)
|
||||
|
||||
m_pageFooterHeight = calcPageFooterHeight(m_patternPageItem)+2;
|
||||
m_maxHeightByColumn[m_currentColumn] -= m_pageFooterHeight;
|
||||
m_currentIndex=10;
|
||||
m_currentIndex = 10;
|
||||
m_dataAreaSize = m_maxHeightByColumn[m_currentColumn];
|
||||
m_renderedDataBandCount = 0;
|
||||
|
||||
@ -1473,7 +1473,8 @@ void ReportRender::savePage(bool isLast)
|
||||
foreach (BandDesignIntf* band, m_renderPageItem->bands()) {
|
||||
pageHeight += band->height();
|
||||
}
|
||||
m_renderPageItem->setHeight(pageHeight+10+(m_patternPageItem->topMargin()+m_patternPageItem->bottomMargin())*Const::mmFACTOR);
|
||||
m_renderPageItem->setHeight(pageHeight + 10 +
|
||||
(m_patternPageItem->topMargin() + m_patternPageItem->bottomMargin()) * Const::mmFACTOR);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -160,6 +160,7 @@ void QObjectPropertyModel::translatePropertyName()
|
||||
tr("fontLetterSpacing");
|
||||
tr("hideText");
|
||||
tr("option3");
|
||||
tr("units");
|
||||
}
|
||||
|
||||
void QObjectPropertyModel::clearObjectsList()
|
||||
|
@ -143,6 +143,8 @@ void EnumPropItem::translateEnumItemName()
|
||||
tr("TitleAlignCenter");
|
||||
tr("Layout");
|
||||
tr("Table");
|
||||
tr("Millimeters");
|
||||
tr("Inches");
|
||||
}
|
||||
|
||||
void EnumPropItem::setPropertyEditorData(QWidget *propertyEditor, const QModelIndex &) const
|
||||
|
102
limereport/objectinspector/propertyItems/lrmarginpropitem.cpp
Normal file
102
limereport/objectinspector/propertyItems/lrmarginpropitem.cpp
Normal file
@ -0,0 +1,102 @@
|
||||
#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
|
||||
);
|
||||
}
|
||||
|
||||
namespace LimeReport{
|
||||
|
||||
|
||||
QString MarginPropItem::displayValue() const
|
||||
{
|
||||
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"));
|
||||
case LimeReport::BaseDesignIntf::Inches:
|
||||
return QString("%1 %2").arg((propertyValue().toDouble() * Const::mmFACTOR) / (item->unitFactor() * 10), 0, 'f', 2)
|
||||
.arg(QObject::tr("''"));
|
||||
}
|
||||
}
|
||||
|
||||
QWidget *MarginPropItem::createProperyEditor(QWidget *parent) const
|
||||
{
|
||||
QDoubleSpinBox *editor= new QDoubleSpinBox(parent);
|
||||
editor->setMaximum(std::numeric_limits<qreal>::max());
|
||||
editor->setMinimum(std::numeric_limits<qreal>::max()*-1);
|
||||
editor->setSuffix(" "+unitShortName());
|
||||
return editor;
|
||||
}
|
||||
|
||||
void MarginPropItem::setPropertyEditorData(QWidget *propertyEditor, const QModelIndex &) const
|
||||
{
|
||||
QDoubleSpinBox *editor =qobject_cast<QDoubleSpinBox*>(propertyEditor);
|
||||
editor->setValue(valueInUnits(propertyValue().toReal()));
|
||||
}
|
||||
|
||||
void MarginPropItem::setModelData(QWidget *propertyEditor, QAbstractItemModel *model, const QModelIndex &index)
|
||||
{
|
||||
model->setData(index, valueInReportUnits(qobject_cast<QDoubleSpinBox*>(propertyEditor)->value()));
|
||||
setValueToObject(propertyName(), propertyValue());
|
||||
}
|
||||
|
||||
qreal MarginPropItem::valueInUnits(qreal value) const
|
||||
{
|
||||
BaseDesignIntf* item = dynamic_cast<BaseDesignIntf*>(object());
|
||||
switch (item->unitType()) {
|
||||
case LimeReport::BaseDesignIntf::Millimeters:
|
||||
return value;
|
||||
case LimeReport::BaseDesignIntf::Inches:
|
||||
return (value * Const::mmFACTOR) / (item->unitFactor() * 10);
|
||||
}
|
||||
}
|
||||
|
||||
qreal MarginPropItem::valueInReportUnits(qreal value) const
|
||||
{
|
||||
BaseDesignIntf* item = dynamic_cast<BaseDesignIntf*>(object());
|
||||
switch (item->unitType()) {
|
||||
case LimeReport::BaseDesignIntf::Millimeters:
|
||||
return value;
|
||||
case LimeReport::BaseDesignIntf::Inches:
|
||||
return (value * (item->unitFactor() * 10)) / Const::mmFACTOR;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
QString MarginPropItem::unitShortName() const
|
||||
{
|
||||
BaseDesignIntf* item = dynamic_cast<BaseDesignIntf*>(object());
|
||||
switch (item->unitType()) {
|
||||
case LimeReport::BaseDesignIntf::Millimeters:
|
||||
return QObject::tr("mm");
|
||||
case LimeReport::BaseDesignIntf::Inches:
|
||||
return QObject::tr("''");
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace LimeReport
|
28
limereport/objectinspector/propertyItems/lrmarginpropitem.h
Normal file
28
limereport/objectinspector/propertyItems/lrmarginpropitem.h
Normal file
@ -0,0 +1,28 @@
|
||||
#ifndef LRMARGINPROPITEM_H
|
||||
#define LRMARGINPROPITEM_H
|
||||
|
||||
#include "lrobjectpropitem.h"
|
||||
|
||||
namespace LimeReport {
|
||||
|
||||
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){}
|
||||
QString displayValue() const;
|
||||
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;
|
||||
QString unitShortName() const;
|
||||
};
|
||||
|
||||
} // namespace LimeReport
|
||||
|
||||
|
||||
#endif // LRMARGINPROPITEM_H
|
@ -38,6 +38,7 @@ namespace{
|
||||
{
|
||||
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);
|
||||
}
|
||||
@ -61,7 +62,6 @@ void QRealPropItem::setPropertyEditorData(QWidget *propertyEditor, const QModelI
|
||||
void QRealPropItem::setModelData(QWidget *propertyEditor, QAbstractItemModel *model, const QModelIndex &index)
|
||||
{
|
||||
model->setData(index,qobject_cast<QDoubleSpinBox*>(propertyEditor)->value());
|
||||
//object()->setProperty(propertyName().toLatin1(),propertyValue());
|
||||
setValueToObject(propertyName(),propertyValue());
|
||||
}
|
||||
|
||||
|
@ -47,6 +47,4 @@ public:
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // LRQREALPROPITEM_H
|
||||
|
@ -45,14 +45,14 @@ namespace{
|
||||
){
|
||||
return new LimeReport::RectPropItem(object, objects, name, displayName, data, parent, readonly);
|
||||
}
|
||||
LimeReport::ObjectPropItem * createReqtMMItem(
|
||||
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::RectMMPropItem(object, objects, name, displayName, data, parent, 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"),createReqtMMItem);
|
||||
bool VARIABLE_IS_NOT_USED registredRectMMProp = LimeReport::ObjectPropFactory::instance().registerCreator(LimeReport::APropIdent("geometry","LimeReport::BaseDesignIntf"),QObject::tr("geometry"),createReqtUnitItem);
|
||||
}
|
||||
|
||||
namespace LimeReport{
|
||||
@ -63,9 +63,8 @@ template<class T> QString rectToString(T rect)
|
||||
}
|
||||
|
||||
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=="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);}
|
||||
|
||||
@ -89,118 +88,153 @@ QString LimeReport::RectPropItem::displayValue() const
|
||||
switch(propertyValue().type()){
|
||||
case QVariant::Rect:
|
||||
return rectToString(propertyValue().toRect());
|
||||
break;
|
||||
case QVariant::RectF:
|
||||
return rectToString(propertyValue().toRect());
|
||||
break;
|
||||
default :
|
||||
return ObjectPropItem::displayValue();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
LimeReport::RectMMPropItem::RectMMPropItem(QObject *object, ObjectsList* objects, const QString &name, const QString &displayName, const QVariant &value, ObjectPropItem *parent, bool /*readonly*/):
|
||||
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);
|
||||
if(band){
|
||||
this->appendItem(new LimeReport::RectMMValuePropItem(object, objects, "x","x",rect.x()/10,this,true));
|
||||
this->appendItem(new LimeReport::RectMMValuePropItem(object, objects, "y","y",rect.y()/10,this,true));
|
||||
this->appendItem(new LimeReport::RectMMValuePropItem(object, objects, "width",tr("width"), rect.width()/10,this,true));
|
||||
this->appendItem(new LimeReport::RectMMValuePropItem(object, objects, "height",tr("height"), rect.height()/10,this,false));
|
||||
} else if(page){
|
||||
this->appendItem(new LimeReport::RectMMValuePropItem(object, 0, "x","x",rect.x()/10,this,true));
|
||||
this->appendItem(new LimeReport::RectMMValuePropItem(object, 0, "y","y",rect.y()/10,this,true));
|
||||
this->appendItem(new LimeReport::RectMMValuePropItem(object, 0,"width", tr("width"), rect.width()/10,this,false));
|
||||
this->appendItem(new LimeReport::RectMMValuePropItem(object, 0, "height", tr("height"), rect.height()/10,this,false));
|
||||
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));
|
||||
} else {
|
||||
this->appendItem(new LimeReport::RectMMValuePropItem(object, objects, "x","x",rect.x()/10,this,false));
|
||||
this->appendItem(new LimeReport::RectMMValuePropItem(object, objects, "y","y",rect.y()/10,this,false));
|
||||
this->appendItem(new LimeReport::RectMMValuePropItem(object, objects, "width", tr("width"), rect.width()/10,this,false));
|
||||
this->appendItem(new LimeReport::RectMMValuePropItem(object, objects, "height", tr("height"), rect.height()/10,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));
|
||||
}
|
||||
LimeReport::BaseDesignIntf * item = dynamic_cast<LimeReport::BaseDesignIntf*>(object);
|
||||
|
||||
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::RectMMPropItem::displayValue() const
|
||||
QString LimeReport::RectUnitPropItem::displayValue() const
|
||||
{
|
||||
QRectF rect = propertyValue().toRectF();
|
||||
return QString("[%1,%2] %3x%4 mm")
|
||||
.arg(rect.x()/10,0,'f',2)
|
||||
.arg(rect.y()/10,0,'f',2)
|
||||
.arg(rect.width()/10,0,'f',2)
|
||||
.arg(rect.height()/10,0,'f',2);
|
||||
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());
|
||||
}
|
||||
|
||||
LimeReport::RectMMValuePropItem::RectMMValuePropItem(QObject *object, ObjectsList* objects, const QString &name, const QString &displayName, const QVariant &value, ObjectPropItem *parent, bool readonly
|
||||
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::RectMMValuePropItem::createProperyEditor(QWidget *parent) const
|
||||
QWidget * LimeReport::RectUnitValuePropItem::createProperyEditor(QWidget *parent) const
|
||||
{
|
||||
QDoubleSpinBox *editor= new QDoubleSpinBox(parent);
|
||||
editor->setMaximum(100000);
|
||||
editor->setSuffix(" mm");
|
||||
editor->setSuffix(" "+unitShortName());
|
||||
BaseDesignIntf* item = dynamic_cast<BaseDesignIntf*>(object());
|
||||
return editor;
|
||||
}
|
||||
|
||||
void LimeReport::RectMMValuePropItem::setPropertyEditorData(QWidget *propertyEditor, const QModelIndex &) const
|
||||
void LimeReport::RectUnitValuePropItem::setPropertyEditorData(QWidget *propertyEditor, const QModelIndex &) const
|
||||
{
|
||||
QDoubleSpinBox *editor = qobject_cast<QDoubleSpinBox*>(propertyEditor);
|
||||
editor->setValue(propertyValue().toDouble());
|
||||
editor->setValue(valueInUnits(propertyValue().toReal()));
|
||||
}
|
||||
|
||||
void LimeReport::RectMMValuePropItem::setModelData(QWidget *propertyEditor, QAbstractItemModel *model, const QModelIndex &index)
|
||||
void LimeReport::RectUnitValuePropItem::setModelData(QWidget *propertyEditor, QAbstractItemModel *model, const QModelIndex &index)
|
||||
{
|
||||
model->setData(index,qobject_cast<QDoubleSpinBox*>(propertyEditor)->value());
|
||||
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()*10));
|
||||
object()->setProperty(parent()->propertyName().toLatin1(), modifyRect(rect, propertyName(), propertyValue().toReal()));
|
||||
}
|
||||
|
||||
QString LimeReport::RectMMValuePropItem::displayValue() const
|
||||
qreal LimeReport::RectUnitValuePropItem::valueInUnits(qreal value) const
|
||||
{
|
||||
return QString::number(propertyValue().toReal())+" "+QObject::tr("mm");
|
||||
}
|
||||
|
||||
void LimeReport::RectMMPropItem::itemPosChanged(QObject* /*object*/, QPointF newPos, QPointF oldPos)
|
||||
{
|
||||
if (newPos.x()!=oldPos.x()){
|
||||
setValue("x",newPos.x());
|
||||
}
|
||||
if (newPos.y()!=oldPos.y()){
|
||||
setValue("y",newPos.y());
|
||||
BaseDesignIntf* item = dynamic_cast<BaseDesignIntf*>(object());
|
||||
switch (item->unitType()) {
|
||||
case LimeReport::BaseDesignIntf::Millimeters:
|
||||
return value / item->unitFactor();
|
||||
case LimeReport::BaseDesignIntf::Inches:
|
||||
return value / (item->unitFactor() * 10);
|
||||
}
|
||||
}
|
||||
|
||||
void LimeReport::RectMMPropItem::itemGeometryChanged(QObject * /*object*/, QRectF newGeometry, QRectF oldGeometry)
|
||||
qreal LimeReport::RectUnitValuePropItem::valueInReportUnits(qreal value) const
|
||||
{
|
||||
if (newGeometry.x()!=oldGeometry.x()){
|
||||
setValue("x",newGeometry.x());
|
||||
}
|
||||
if (newGeometry.y()!=oldGeometry.y()){
|
||||
setValue("y",newGeometry.y());
|
||||
}
|
||||
if (newGeometry.width()!=oldGeometry.width()){
|
||||
setValue("width",newGeometry.width());
|
||||
}
|
||||
if (newGeometry.height()!=oldGeometry.height()){
|
||||
setValue("height",newGeometry.height());
|
||||
BaseDesignIntf* item = dynamic_cast<BaseDesignIntf*>(object());
|
||||
switch (item->unitType()) {
|
||||
case LimeReport::BaseDesignIntf::Millimeters:
|
||||
return value * item->unitFactor();
|
||||
case LimeReport::BaseDesignIntf::Inches:
|
||||
return value * (item->unitFactor() * 10);
|
||||
}
|
||||
}
|
||||
|
||||
void LimeReport::RectMMPropItem::setValue(const QString &name, qreal value)
|
||||
QString LimeReport::RectUnitValuePropItem::unitShortName() const
|
||||
{
|
||||
if (name!=""){
|
||||
BaseDesignIntf* item = dynamic_cast<BaseDesignIntf*>(object());
|
||||
switch (item->unitType()) {
|
||||
case LimeReport::BaseDesignIntf::Millimeters:
|
||||
return QObject::tr("mm");
|
||||
case LimeReport::BaseDesignIntf::Inches:
|
||||
return QObject::tr("''");
|
||||
}
|
||||
}
|
||||
|
||||
QString LimeReport::RectUnitValuePropItem::displayValue() const
|
||||
{
|
||||
return QString("%1 %2").arg(valueInUnits(propertyValue().toReal()), 0, 'f', 2).arg(unitShortName());
|
||||
}
|
||||
|
||||
void LimeReport::RectUnitPropItem::itemPosChanged(QObject* /*object*/, QPointF newPos, QPointF oldPos)
|
||||
{
|
||||
if (newPos.x() != oldPos.x()){
|
||||
setValue("x", newPos.x());
|
||||
}
|
||||
if (newPos.y() != oldPos.y()){
|
||||
setValue("y", newPos.y());
|
||||
}
|
||||
}
|
||||
|
||||
void LimeReport::RectUnitPropItem::itemGeometryChanged(QObject * /*object*/, QRectF newGeometry, QRectF oldGeometry)
|
||||
{
|
||||
if (newGeometry.x() != oldGeometry.x()){
|
||||
setValue("x", newGeometry.x());
|
||||
}
|
||||
if (newGeometry.y() != oldGeometry.y()){
|
||||
setValue("y", newGeometry.y());
|
||||
}
|
||||
if (newGeometry.width() != oldGeometry.width()){
|
||||
setValue("width", newGeometry.width());
|
||||
}
|
||||
if (newGeometry.height() != oldGeometry.height()){
|
||||
setValue("height", newGeometry.height());
|
||||
}
|
||||
}
|
||||
|
||||
void LimeReport::RectUnitPropItem::setValue(const QString &name, qreal value)
|
||||
{
|
||||
if (name != ""){
|
||||
LimeReport::ObjectPropItem* propItem = findChild(name);
|
||||
if (propItem) {
|
||||
propItem->setPropertyValue(value/10);
|
||||
setPropertyValue(LimeReport::modifyRect(propertyValue().toRectF(),name,value));
|
||||
LimeReport::QObjectPropertyModel *itemModel=dynamic_cast<LimeReport::QObjectPropertyModel *>(model());
|
||||
propItem->setPropertyValue(value);
|
||||
setPropertyValue(LimeReport::modifyRect(propertyValue().toRectF(), name, value));
|
||||
LimeReport::QObjectPropertyModel *itemModel = dynamic_cast<LimeReport::QObjectPropertyModel *>(model());
|
||||
if (itemModel) {
|
||||
itemModel->itemDataChanged(modelIndex());
|
||||
if (propItem->modelIndex().isValid())
|
||||
@ -209,3 +243,31 @@ void LimeReport::RectMMPropItem::setValue(const QString &name, qreal value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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());
|
||||
case LimeReport::BaseDesignIntf::Inches:
|
||||
return QRectF(rect.x() / (item->unitFactor() * 10),
|
||||
rect.y() / (item->unitFactor() * 10),
|
||||
rect.width() / (item->unitFactor() * 10),
|
||||
rect.height() / (item->unitFactor() * 10));
|
||||
}
|
||||
}
|
||||
|
||||
QString LimeReport::RectUnitPropItem::unitShortName() const
|
||||
{
|
||||
BaseDesignIntf* item = dynamic_cast<BaseDesignIntf*>(object());
|
||||
switch (item->unitType()) {
|
||||
case LimeReport::BaseDesignIntf::Millimeters:
|
||||
return QObject::tr("mm");
|
||||
case LimeReport::BaseDesignIntf::Inches:
|
||||
return QObject::tr("''");
|
||||
}
|
||||
}
|
||||
|
@ -43,28 +43,35 @@ public:
|
||||
QString displayValue() const;
|
||||
};
|
||||
|
||||
class RectMMPropItem : public ObjectPropItem{
|
||||
class RectUnitPropItem : public ObjectPropItem{
|
||||
Q_OBJECT
|
||||
public:
|
||||
RectMMPropItem():ObjectPropItem(){}
|
||||
RectMMPropItem(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;
|
||||
QString unitShortName() const;
|
||||
};
|
||||
|
||||
class RectMMValuePropItem : public ObjectPropItem{
|
||||
class RectUnitValuePropItem : public ObjectPropItem{
|
||||
Q_OBJECT
|
||||
public:
|
||||
RectMMValuePropItem():ObjectPropItem(){}
|
||||
RectMMValuePropItem(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 &);
|
||||
private:
|
||||
qreal valueInUnits(qreal value) const;
|
||||
qreal valueInReportUnits(qreal value) const;
|
||||
QString unitShortName() const;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
Binary file not shown.
@ -989,6 +989,14 @@ p, li { white-space: pre-wrap; }
|
||||
<source>TitleAlignCenter</source>
|
||||
<translation>Название по центру</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Millimeters</source>
|
||||
<translation>Миллиметры</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Inches</source>
|
||||
<translation>Дюймы</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>LimeReport::FlagsPropItem</name>
|
||||
@ -1939,9 +1947,13 @@ p, li { white-space: pre-wrap; }
|
||||
<source>option3</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>units</source>
|
||||
<translation>Единицы измерения</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>LimeReport::RectMMPropItem</name>
|
||||
<name>LimeReport::RectPropItem</name>
|
||||
<message>
|
||||
<source>width</source>
|
||||
<translation>ширина</translation>
|
||||
@ -1952,7 +1964,7 @@ p, li { white-space: pre-wrap; }
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>LimeReport::RectPropItem</name>
|
||||
<name>LimeReport::RectUnitPropItem</name>
|
||||
<message>
|
||||
<source>width</source>
|
||||
<translation>ширина</translation>
|
||||
@ -3098,5 +3110,13 @@ This preview is no longer valid.</source>
|
||||
<source>Default</source>
|
||||
<translation>По умолчанию</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>margin</source>
|
||||
<translation>Поля</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>''</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
Loading…
Reference in New Issue
Block a user