0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-25 00:54:39 +03:00

Ruler has been fixed

This commit is contained in:
Arin Alexander 2019-06-26 02:23:12 +03:00
parent 7fecc25183
commit ac154dbc03

View File

@ -1175,20 +1175,20 @@ void Ruler::drawItem(QPainter* painter, BaseDesignIntf *item)
int hStartPos = view->mapFromScene(0,0).x(); int hStartPos = view->mapFromScene(0,0).x();
int vStartPos = view->mapFromScene(0,0).y(); int vStartPos = view->mapFromScene(0,0).y();
int itemWidth = view->mapFromScene(item->mapToScene(item->geometry().width(),0).x() - item->mapToScene(0,0).x(), 0).x() - hStartPos;
int itemHeight = view->mapFromScene(0, item->mapToScene(0, item->geometry().height()).y() - item->mapToScene(0,0).y()).y() - vStartPos;
switch (m_type) { switch (m_type) {
case Horizontal: case Horizontal:
if (item->isSelected()) if (item->isSelected())
painter->drawRect(view->mapFromScene(item->mapToScene(0,0)).x() - hStartPos, 0, painter->drawRect(view->mapFromScene(item->mapToScene(0,0)).x() - (hStartPos > 0 ? hStartPos : 0) , 0,
view->mapFromScene(item->geometry().bottomRight().x() - item->pos().x(), 0).x() - hStartPos, 20); itemWidth, 20);
break; break;
case Vertical: case Vertical:
if (item->isSelected()) if (item->isSelected())
painter->drawRect(0, view->mapFromScene(item->mapToScene(0, 0)).y() - vStartPos, painter->drawRect(0, view->mapFromScene(item->mapToScene(0, 0)).y() - (vStartPos > 0 ? vStartPos : 0),
20, view->mapFromScene(0, item->geometry().bottomRight().y() - item->pos().y()).y() - vStartPos); 20, itemHeight);
break; break;
} }
} }