0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-24 16:44:39 +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_BGMode(OpaqueMode),
m_opacity(100), m_opacity(100),
m_borderLinesFlags(BorderLines()), m_borderLinesFlags(BorderLines()),
m_borderStyle(Qt::SolidLine), m_borderStyle(BorderStyle::Solid),
m_storageTypeName(storageTypeName), m_storageTypeName(storageTypeName),
m_itemMode(DesignMode), m_itemMode(DesignMode),
m_objectState(ObjectCreated), m_objectState(ObjectCreated),
@ -974,9 +974,9 @@ qreal BaseDesignIntf::borderLineSize() const
return m_borderLineSize; 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; m_borderStyle = b;
update(); update();
notify("borderStyle",(BorderStyle)oldValue,(BorderStyle)b); notify("borderStyle",(BorderStyle)oldValue,(BorderStyle)b);
@ -1060,10 +1060,6 @@ BaseDesignIntf::BorderLines BaseDesignIntf::borderLines() const
return m_borderLinesFlags; return m_borderLinesFlags;
} }
Qt::PenStyle BaseDesignIntf::borderStyle() const
{
return m_borderStyle;
}
void BaseDesignIntf::drawTopLine(QPainter *painter, QRectF rect) const void BaseDesignIntf::drawTopLine(QPainter *painter, QRectF rect) const
{ {
@ -1071,6 +1067,11 @@ void BaseDesignIntf::drawTopLine(QPainter *painter, QRectF rect) const
return; return;
painter->setPen(borderPen(TopLine)); painter->setPen(borderPen(TopLine));
painter->drawLine(rect.x(), rect.y(), rect.width(), rect.y()); 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 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->setPen(borderPen(BottomLine));
painter->drawLine(rect.x(), rect.height(), rect.width(), rect.height()); 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 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->setPen(borderPen(RightLine));
painter->drawLine(rect.width(), rect.y(), rect.width(), rect.height()); 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 void BaseDesignIntf::drawLeftLine(QPainter *painter, QRectF rect) const
@ -1097,6 +1108,11 @@ void BaseDesignIntf::drawLeftLine(QPainter *painter, QRectF rect) const
return; return;
painter->setPen(borderPen(LeftLine)); painter->setPen(borderPen(LeftLine));
painter->drawLine(rect.x(), rect.y(), rect.x(), rect.height()); 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 void BaseDesignIntf::drawDesignModeBorder(QPainter *painter, QRectF rect) const
@ -1216,9 +1232,10 @@ QPen BaseDesignIntf::borderPen(BorderSide side/*, bool selected*/) const
QPen pen; QPen pen;
if (m_borderLinesFlags & side) { if (m_borderLinesFlags & side) {
pen.setColor(m_borderColor); pen.setColor(m_borderColor);
pen.setStyle(m_borderStyle); if(borderStyle() != BorderStyle::Doubled)
//pen.setCosmetic(true); pen.setStyle(static_cast<Qt::PenStyle>(m_borderStyle));
pen.setWidthF(m_borderLineSize+1); pen.setCosmetic(true);
pen.setWidthF(m_borderLineSize+1); //To draw with point precision (By default: 2px = 1 pt)
} else { } else {
pen.setColor(Qt::darkGray); pen.setColor(Qt::darkGray);

View File

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

View File

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

View File

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