0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-23 16:22:58 +03:00

added double border style

This commit is contained in:
yanis60 2022-05-13 15:59:48 +01:00
parent f0da654e7f
commit e4dd1b6a86
4 changed files with 55 additions and 36 deletions

View File

@ -65,7 +65,7 @@ BaseDesignIntf::BaseDesignIntf(const QString &storageTypeName, QObject *owner, Q
m_BGMode(OpaqueMode),
m_opacity(100),
m_borderLinesFlags(BorderLines()),
m_borderStyle(Qt::SolidLine),
m_borderStyle(BorderStyle::Solid),
m_storageTypeName(storageTypeName),
m_itemMode(DesignMode),
m_objectState(ObjectCreated),
@ -974,9 +974,9 @@ qreal BaseDesignIntf::borderLineSize() const
return m_borderLineSize;
}
void BaseDesignIntf::setBorderStyle(Qt::PenStyle b)
void BaseDesignIntf::setBorderStyle(BorderStyle b)
{
Qt::PenStyle oldValue = m_borderStyle;
BorderStyle oldValue = m_borderStyle;
m_borderStyle = b;
update();
notify("borderStyle",(BorderStyle)oldValue,(BorderStyle)b);
@ -1060,10 +1060,6 @@ BaseDesignIntf::BorderLines BaseDesignIntf::borderLines() const
return m_borderLinesFlags;
}
Qt::PenStyle BaseDesignIntf::borderStyle() const
{
return m_borderStyle;
}
void BaseDesignIntf::drawTopLine(QPainter *painter, QRectF rect) const
{
@ -1071,6 +1067,11 @@ void BaseDesignIntf::drawTopLine(QPainter *painter, QRectF rect) const
return;
painter->setPen(borderPen(TopLine));
painter->drawLine(rect.x(), rect.y(), rect.width(), rect.y());
if(borderStyle() == BorderStyle::Doubled)
painter->drawLine(rect.x()+6+m_borderLineSize,
rect.y()+6+m_borderLineSize,
rect.width()-6-m_borderLineSize,
rect.y()+6+m_borderLineSize);
}
void BaseDesignIntf::drawBootomLine(QPainter *painter, QRectF rect) const
@ -1080,6 +1081,11 @@ void BaseDesignIntf::drawBootomLine(QPainter *painter, QRectF rect) const
painter->setPen(borderPen(BottomLine));
painter->drawLine(rect.x(), rect.height(), rect.width(), rect.height());
if(borderStyle() == BorderStyle::Doubled)
painter->drawLine(rect.x()+6+m_borderLineSize,
rect.height()-6-m_borderLineSize,
rect.width()-6-m_borderLineSize,
rect.height()-6-m_borderLineSize);
}
void BaseDesignIntf::drawRightLine(QPainter *painter, QRectF rect) const
@ -1089,6 +1095,11 @@ void BaseDesignIntf::drawRightLine(QPainter *painter, QRectF rect) const
painter->setPen(borderPen(RightLine));
painter->drawLine(rect.width(), rect.y(), rect.width(), rect.height());
if(borderStyle() == BorderStyle::Doubled)
painter->drawLine(rect.width()-6 - m_borderLineSize,
rect.y()+6+m_borderLineSize,
rect.width()-6-m_borderLineSize,
rect.height()-6-m_borderLineSize);
}
void BaseDesignIntf::drawLeftLine(QPainter *painter, QRectF rect) const
@ -1097,6 +1108,11 @@ void BaseDesignIntf::drawLeftLine(QPainter *painter, QRectF rect) const
return;
painter->setPen(borderPen(LeftLine));
painter->drawLine(rect.x(), rect.y(), rect.x(), rect.height());
if(borderStyle() == BorderStyle::Doubled)
painter->drawLine(rect.x()+6+m_borderLineSize,
rect.y()+6+m_borderLineSize,
rect.x()+6+m_borderLineSize,
rect.height()-6-m_borderLineSize);
}
void BaseDesignIntf::drawDesignModeBorder(QPainter *painter, QRectF rect) const
@ -1216,9 +1232,10 @@ QPen BaseDesignIntf::borderPen(BorderSide side/*, bool selected*/) const
QPen pen;
if (m_borderLinesFlags & side) {
pen.setColor(m_borderColor);
pen.setStyle(m_borderStyle);
//pen.setCosmetic(true);
pen.setWidthF(m_borderLineSize+1);
if(borderStyle() != BorderStyle::Doubled)
pen.setStyle(static_cast<Qt::PenStyle>(m_borderStyle));
pen.setCosmetic(true);
pen.setWidthF(m_borderLineSize+1); //To draw with point precision (By default: 2px = 1 pt)
} else {
pen.setColor(Qt::darkGray);

View File

@ -95,7 +95,7 @@ class BaseDesignIntf :
Q_PROPERTY(bool shadow READ hasShadow WRITE setShadow)
Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor)
Q_PROPERTY(bool geometryLocked READ isGeometryLocked WRITE setGeometryLocked)
Q_PROPERTY(Qt::PenStyle borderStyle READ borderStyle WRITE setBorderStyle)
Q_PROPERTY(BorderStyle borderStyle READ borderStyle WRITE setBorderStyle)
friend class ReportRender;
public:
@ -106,6 +106,7 @@ public:
Dashed = Qt::DashLine,
DashDot = Qt::DashDotLine,
DashDotDot = Qt::DashDotDotLine,
Doubled = 7
};
@ -188,6 +189,7 @@ public:
QString parentReportItemName() const;
BrushStyle backgroundBrushStyle() const {return m_backgroundBrushStyle;}
BorderStyle borderStyle() const {return m_borderStyle;}
void setBackgroundBrushStyle(BrushStyle value);
QColor backgroundColor() const {return m_backgroundColor;}
void setBackgroundColor(QColor value);
@ -253,7 +255,7 @@ public:
PageDesignIntf* page();
BorderLines borderLines() const;
Qt::PenStyle borderStyle() const;
QString storageTypeName() const {return m_storageTypeName;}
ReportEnginePrivate *reportEditor();
@ -299,7 +301,7 @@ public:
void setItemTypeName(const QString &itemTypeName);
qreal borderLineSize() const;
void setBorderStyle(Qt::PenStyle b);
void setBorderStyle(BorderStyle b);
void setBorderLineSize(qreal value);
void showEditorDialog();
ItemAlign itemAlign() const;
@ -454,7 +456,7 @@ private:
BGMode m_BGMode;
int m_opacity;
BorderLines m_borderLinesFlags;
Qt::PenStyle m_borderStyle;
BorderStyle m_borderStyle;
QRectF m_bottomRect;
QRectF m_topRect;

View File

@ -554,53 +554,53 @@ p, li { white-space: pre-wrap; }
<context>
<name>LimeReport::BaseDesignIntf</name>
<message>
<location filename="../limereport/lrbasedesignintf.cpp" line="1430"/>
<location filename="../limereport/lrbasedesignintf.cpp" line="1858"/>
<location filename="../limereport/lrbasedesignintf.cpp" line="1447"/>
<location filename="../limereport/lrbasedesignintf.cpp" line="1875"/>
<source>Lock item geometry</source>
<translation>Verrouiller la géométrie d&apos;un élément</translation>
</message>
<message>
<location filename="../limereport/lrbasedesignintf.cpp" line="1436"/>
<location filename="../limereport/lrbasedesignintf.cpp" line="1453"/>
<source>Copy</source>
<translation>Copier</translation>
</message>
<message>
<location filename="../limereport/lrbasedesignintf.cpp" line="1438"/>
<location filename="../limereport/lrbasedesignintf.cpp" line="1455"/>
<source>Cut</source>
<translation>Couper</translation>
</message>
<message>
<location filename="../limereport/lrbasedesignintf.cpp" line="1440"/>
<location filename="../limereport/lrbasedesignintf.cpp" line="1457"/>
<source>Paste</source>
<translation>Coller</translation>
</message>
<message>
<location filename="../limereport/lrbasedesignintf.cpp" line="1450"/>
<location filename="../limereport/lrbasedesignintf.cpp" line="1467"/>
<source>Bring to top</source>
<translation>Placer au premier-plan</translation>
</message>
<message>
<location filename="../limereport/lrbasedesignintf.cpp" line="1451"/>
<location filename="../limereport/lrbasedesignintf.cpp" line="1468"/>
<source>Send to back</source>
<translation>Placer en arrière-plan</translation>
</message>
<message>
<location filename="../limereport/lrbasedesignintf.cpp" line="1454"/>
<location filename="../limereport/lrbasedesignintf.cpp" line="1471"/>
<source>Create Horizontal Layout</source>
<translation>Créer une disposition horizontale</translation>
</message>
<message>
<location filename="../limereport/lrbasedesignintf.cpp" line="1458"/>
<location filename="../limereport/lrbasedesignintf.cpp" line="1475"/>
<source>Create Vertical Layout</source>
<translation>Créer une disposition verticale</translation>
</message>
<message>
<location filename="../limereport/lrbasedesignintf.cpp" line="1461"/>
<location filename="../limereport/lrbasedesignintf.cpp" line="1478"/>
<source>No borders</source>
<translation>Aucune bordure</translation>
</message>
<message>
<location filename="../limereport/lrbasedesignintf.cpp" line="1462"/>
<location filename="../limereport/lrbasedesignintf.cpp" line="1479"/>
<source>All borders</source>
<translation>Toutes les bordures</translation>
</message>

View File

@ -566,53 +566,53 @@ p, li { white-space: pre-wrap; }
<context>
<name>LimeReport::BaseDesignIntf</name>
<message>
<location filename="../limereport/lrbasedesignintf.cpp" line="1430"/>
<location filename="../limereport/lrbasedesignintf.cpp" line="1858"/>
<location filename="../limereport/lrbasedesignintf.cpp" line="1447"/>
<location filename="../limereport/lrbasedesignintf.cpp" line="1875"/>
<source>Lock item geometry</source>
<translation>Zablokuj geometrię pozycji</translation>
</message>
<message>
<location filename="../limereport/lrbasedesignintf.cpp" line="1436"/>
<location filename="../limereport/lrbasedesignintf.cpp" line="1453"/>
<source>Copy</source>
<translation>Kopiuj</translation>
</message>
<message>
<location filename="../limereport/lrbasedesignintf.cpp" line="1438"/>
<location filename="../limereport/lrbasedesignintf.cpp" line="1455"/>
<source>Cut</source>
<translation>Wytnij</translation>
</message>
<message>
<location filename="../limereport/lrbasedesignintf.cpp" line="1440"/>
<location filename="../limereport/lrbasedesignintf.cpp" line="1457"/>
<source>Paste</source>
<translation>Wklej</translation>
</message>
<message>
<location filename="../limereport/lrbasedesignintf.cpp" line="1450"/>
<location filename="../limereport/lrbasedesignintf.cpp" line="1467"/>
<source>Bring to top</source>
<translation>Przenieś na górę</translation>
</message>
<message>
<location filename="../limereport/lrbasedesignintf.cpp" line="1451"/>
<location filename="../limereport/lrbasedesignintf.cpp" line="1468"/>
<source>Send to back</source>
<translation>Przenieś na dół</translation>
</message>
<message>
<location filename="../limereport/lrbasedesignintf.cpp" line="1454"/>
<location filename="../limereport/lrbasedesignintf.cpp" line="1471"/>
<source>Create Horizontal Layout</source>
<translation>Utwórz układ poziomy</translation>
</message>
<message>
<location filename="../limereport/lrbasedesignintf.cpp" line="1458"/>
<location filename="../limereport/lrbasedesignintf.cpp" line="1475"/>
<source>Create Vertical Layout</source>
<translation>Utwórz układ pionowy</translation>
</message>
<message>
<location filename="../limereport/lrbasedesignintf.cpp" line="1461"/>
<location filename="../limereport/lrbasedesignintf.cpp" line="1478"/>
<source>No borders</source>
<translation>Bez obramowania</translation>
</message>
<message>
<location filename="../limereport/lrbasedesignintf.cpp" line="1462"/>
<location filename="../limereport/lrbasedesignintf.cpp" line="1479"/>
<source>All borders</source>
<translation>Pełne obramowanie</translation>
</message>