border width precision has been improved

This commit is contained in:
yanis60 2022-05-07 19:07:43 +01:00
parent db57157690
commit f0da654e7f
6 changed files with 36 additions and 33 deletions

View File

@ -7,6 +7,7 @@
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
QApplication a(argc, argv); QApplication a(argc, argv);
DesignerSettingManager manager; DesignerSettingManager manager;
QTranslator limeReportTranslator; QTranslator limeReportTranslator;

View File

@ -426,6 +426,7 @@ void BaseDesignIntf::paint(QPainter *ppainter, const QStyleOptionGraphicsItem *o
{ {
Q_UNUSED(option); Q_UNUSED(option);
Q_UNUSED(widget); Q_UNUSED(widget);
ppainter->save(); ppainter->save();
setupPainter(ppainter); setupPainter(ppainter);
drawBorder(ppainter, rect()); drawBorder(ppainter, rect());
@ -968,7 +969,7 @@ void BaseDesignIntf::emitObjectNamePropertyChanged(const QString &oldName, const
emit propertyObjectNameChanged(oldName,newName); emit propertyObjectNameChanged(oldName,newName);
} }
int BaseDesignIntf::borderLineSize() const qreal BaseDesignIntf::borderLineSize() const
{ {
return m_borderLineSize; return m_borderLineSize;
} }
@ -981,9 +982,9 @@ void BaseDesignIntf::setBorderStyle(Qt::PenStyle b)
notify("borderStyle",(BorderStyle)oldValue,(BorderStyle)b); notify("borderStyle",(BorderStyle)oldValue,(BorderStyle)b);
} }
void BaseDesignIntf::setBorderLineSize(int value) void BaseDesignIntf::setBorderLineSize(qreal value)
{ {
int oldValue = m_borderLineSize; qreal oldValue = m_borderLineSize;
m_borderLineSize = value; m_borderLineSize = value;
update(); update();
notify("borderLineSize",oldValue,value); notify("borderLineSize",oldValue,value);
@ -1076,6 +1077,7 @@ void BaseDesignIntf::drawBootomLine(QPainter *painter, QRectF rect) const
{ {
if(isShapeItem()) if(isShapeItem())
return; return;
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());
} }
@ -1215,8 +1217,8 @@ QPen BaseDesignIntf::borderPen(BorderSide side/*, bool selected*/) const
if (m_borderLinesFlags & side) { if (m_borderLinesFlags & side) {
pen.setColor(m_borderColor); pen.setColor(m_borderColor);
pen.setStyle(m_borderStyle); pen.setStyle(m_borderStyle);
pen.setCosmetic(true); //pen.setCosmetic(true);
pen.setWidthF(m_borderLineSize); pen.setWidthF(m_borderLineSize+1);
} else { } else {
pen.setColor(Qt::darkGray); pen.setColor(Qt::darkGray);

View File

@ -90,7 +90,7 @@ class BaseDesignIntf :
Q_PROPERTY(qreal zOrder READ zValue WRITE setZValueProperty DESIGNABLE false) Q_PROPERTY(qreal zOrder READ zValue WRITE setZValueProperty DESIGNABLE false)
Q_PROPERTY(BorderLines borders READ borderLines WRITE setBorderLinesFlags) Q_PROPERTY(BorderLines borders READ borderLines WRITE setBorderLinesFlags)
Q_PROPERTY(QString parentName READ parentReportItemName WRITE setParentReportItem DESIGNABLE false) Q_PROPERTY(QString parentName READ parentReportItemName WRITE setParentReportItem DESIGNABLE false)
Q_PROPERTY(int borderLineSize READ borderLineSize WRITE setBorderLineSize) Q_PROPERTY(qreal borderLineSize READ borderLineSize WRITE setBorderLineSize)
Q_PROPERTY(bool isVisible READ isVisible WRITE setItemVisible DESIGNABLE false) Q_PROPERTY(bool isVisible READ isVisible WRITE setItemVisible DESIGNABLE false)
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)
@ -298,9 +298,9 @@ public:
QString itemTypeName() const; QString itemTypeName() const;
void setItemTypeName(const QString &itemTypeName); void setItemTypeName(const QString &itemTypeName);
int borderLineSize() const; qreal borderLineSize() const;
void setBorderStyle(Qt::PenStyle b); void setBorderStyle(Qt::PenStyle b);
void setBorderLineSize(int value); void setBorderLineSize(qreal value);
void showEditorDialog(); void showEditorDialog();
ItemAlign itemAlign() const; ItemAlign itemAlign() const;
virtual void setItemAlign(const ItemAlign &itemAlign); virtual void setItemAlign(const ItemAlign &itemAlign);
@ -444,7 +444,7 @@ private:
QFont m_font; QFont m_font;
QColor m_fontColor; QColor m_fontColor;
bool m_fixedPos; bool m_fixedPos;
int m_borderLineSize; qreal m_borderLineSize;
QRectF m_rect; QRectF m_rect;

View File

@ -152,7 +152,7 @@ void PreviewReportWidget::initPreview()
ui->graphicsView->centerOn(0, 0); ui->graphicsView->centerOn(0, 0);
ui->graphicsView->scene()->setBackgroundBrush(QColor(m_previewPageBackgroundColor)); ui->graphicsView->scene()->setBackgroundBrush(QColor(m_previewPageBackgroundColor));
setScalePercent(d_ptr->m_scalePercent); setScalePercent(d_ptr->m_scalePercent);
qDebug()<<d_ptr->m_scalePercent;
PageDesignIntf* page = dynamic_cast<PageDesignIntf*>(ui->graphicsView->scene()); PageDesignIntf* page = dynamic_cast<PageDesignIntf*>(ui->graphicsView->scene());
if (page) if (page)
connect(page, SIGNAL(itemInserted(LimeReport::PageDesignIntf*, QPointF, QString)), connect(page, SIGNAL(itemInserted(LimeReport::PageDesignIntf*, QPointF, QString)),
@ -484,7 +484,7 @@ void PreviewReportWidget::reportEngineDestroyed(QObject *object)
void PreviewReportWidget::slotZoomed(double ) void PreviewReportWidget::slotZoomed(double )
{ {
#if (QT_VERSION < QT_VERSION_CHECK(5, 15, 1)) #if (QT_VERSION < QT_VERSION_CHECK(5, 15, 0))
d_ptr->m_scalePercent = ui->graphicsView->matrix().m11()*100; d_ptr->m_scalePercent = ui->graphicsView->matrix().m11()*100;
#else #else
d_ptr->m_scalePercent = ui->graphicsView->transform().m11()*100; d_ptr->m_scalePercent = ui->graphicsView->transform().m11()*100;

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="1428"/> <location filename="../limereport/lrbasedesignintf.cpp" line="1430"/>
<location filename="../limereport/lrbasedesignintf.cpp" line="1856"/> <location filename="../limereport/lrbasedesignintf.cpp" line="1858"/>
<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="1434"/> <location filename="../limereport/lrbasedesignintf.cpp" line="1436"/>
<source>Copy</source> <source>Copy</source>
<translation>Copier</translation> <translation>Copier</translation>
</message> </message>
<message> <message>
<location filename="../limereport/lrbasedesignintf.cpp" line="1436"/> <location filename="../limereport/lrbasedesignintf.cpp" line="1438"/>
<source>Cut</source> <source>Cut</source>
<translation>Couper</translation> <translation>Couper</translation>
</message> </message>
<message> <message>
<location filename="../limereport/lrbasedesignintf.cpp" line="1438"/> <location filename="../limereport/lrbasedesignintf.cpp" line="1440"/>
<source>Paste</source> <source>Paste</source>
<translation>Coller</translation> <translation>Coller</translation>
</message> </message>
<message> <message>
<location filename="../limereport/lrbasedesignintf.cpp" line="1448"/> <location filename="../limereport/lrbasedesignintf.cpp" line="1450"/>
<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="1449"/> <location filename="../limereport/lrbasedesignintf.cpp" line="1451"/>
<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="1452"/> <location filename="../limereport/lrbasedesignintf.cpp" line="1454"/>
<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="1456"/> <location filename="../limereport/lrbasedesignintf.cpp" line="1458"/>
<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="1459"/> <location filename="../limereport/lrbasedesignintf.cpp" line="1461"/>
<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="1460"/> <location filename="../limereport/lrbasedesignintf.cpp" line="1462"/>
<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="1428"/> <location filename="../limereport/lrbasedesignintf.cpp" line="1430"/>
<location filename="../limereport/lrbasedesignintf.cpp" line="1856"/> <location filename="../limereport/lrbasedesignintf.cpp" line="1858"/>
<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="1434"/> <location filename="../limereport/lrbasedesignintf.cpp" line="1436"/>
<source>Copy</source> <source>Copy</source>
<translation>Kopiuj</translation> <translation>Kopiuj</translation>
</message> </message>
<message> <message>
<location filename="../limereport/lrbasedesignintf.cpp" line="1436"/> <location filename="../limereport/lrbasedesignintf.cpp" line="1438"/>
<source>Cut</source> <source>Cut</source>
<translation>Wytnij</translation> <translation>Wytnij</translation>
</message> </message>
<message> <message>
<location filename="../limereport/lrbasedesignintf.cpp" line="1438"/> <location filename="../limereport/lrbasedesignintf.cpp" line="1440"/>
<source>Paste</source> <source>Paste</source>
<translation>Wklej</translation> <translation>Wklej</translation>
</message> </message>
<message> <message>
<location filename="../limereport/lrbasedesignintf.cpp" line="1448"/> <location filename="../limereport/lrbasedesignintf.cpp" line="1450"/>
<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="1449"/> <location filename="../limereport/lrbasedesignintf.cpp" line="1451"/>
<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="1452"/> <location filename="../limereport/lrbasedesignintf.cpp" line="1454"/>
<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="1456"/> <location filename="../limereport/lrbasedesignintf.cpp" line="1458"/>
<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="1459"/> <location filename="../limereport/lrbasedesignintf.cpp" line="1461"/>
<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="1460"/> <location filename="../limereport/lrbasedesignintf.cpp" line="1462"/>
<source>All borders</source> <source>All borders</source>
<translation>Pełne obramowanie</translation> <translation>Pełne obramowanie</translation>
</message> </message>