mirror of
https://github.com/python-LimeReport/LimeReport.git
synced 2024-12-23 12:12:59 +03:00
added position info when dragging
This commit is contained in:
parent
8a2d824c5d
commit
36d8878f6e
@ -73,6 +73,7 @@ PageDesignIntf::PageDesignIntf(QObject *parent):
|
||||
m_itemInsertRect(0),
|
||||
m_itemMode(DesignMode),
|
||||
m_cutterBorder(0),
|
||||
m_infoPosRect(0),
|
||||
m_currentCommand(-1),
|
||||
m_changeSizeMode(false),
|
||||
m_changePosMode(false),
|
||||
@ -93,6 +94,7 @@ PageDesignIntf::PageDesignIntf(QObject *parent):
|
||||
m_magneticMovement(false),
|
||||
m_reportSettings(0),
|
||||
m_currentPage(0)
|
||||
|
||||
{
|
||||
m_reportEditor = dynamic_cast<ReportEnginePrivate *>(parent);
|
||||
updatePageRect();
|
||||
@ -314,6 +316,7 @@ void PageDesignIntf::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||
|
||||
void PageDesignIntf::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
PageItemDesignIntf* page = pageItem() ? pageItem() : getCurrentPage();
|
||||
|
||||
if (event->buttons() & Qt::LeftButton) {
|
||||
if (!m_changePosOrSizeMode) {
|
||||
@ -321,6 +324,25 @@ void PageDesignIntf::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
||||
saveSelectedItemsGeometry();
|
||||
m_changePosOrSizeMode = true;
|
||||
}
|
||||
qreal posY = div(page->mapFromScene(event->scenePos()).y(), verticalGridStep()).quot * verticalGridStep();
|
||||
qreal posX = div(page->mapFromScene(event->scenePos()).x(), verticalGridStep()).quot * horizontalGridStep();
|
||||
if(!m_infoPosRect)
|
||||
{
|
||||
|
||||
|
||||
m_infoPosRect = new QGraphicsTextItem();
|
||||
m_infoPosRect->setDefaultTextColor(QColor(100,150,50));
|
||||
|
||||
QFont font("Arial");
|
||||
font.setPointSize(16);
|
||||
font.setBold(true);
|
||||
m_infoPosRect->setFont(font);
|
||||
addItem(m_infoPosRect);
|
||||
}
|
||||
m_infoPosRect->setPlainText("(x: "+QString::number(posX/100)+", y: "+QString::number(posY/100)+") cm");
|
||||
|
||||
m_infoPosRect->setPos(posX,posY+30);
|
||||
|
||||
}
|
||||
|
||||
if (event->buttons() & Qt::LeftButton && m_multiSelectStarted){
|
||||
@ -340,7 +362,6 @@ void PageDesignIntf::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
||||
m_selectionRect->setRect(selectionRect);
|
||||
}
|
||||
|
||||
PageItemDesignIntf* page = pageItem() ? pageItem() : getCurrentPage();
|
||||
if ((m_insertMode) && (page && page->rect().contains(page->mapFromScene(event->scenePos())))) {
|
||||
if (!m_itemInsertRect->isVisible()) m_itemInsertRect->setVisible(true);
|
||||
qreal posY = div(page->mapFromScene(event->scenePos()).y(), verticalGridStep()).quot * verticalGridStep();
|
||||
@ -402,6 +423,11 @@ void PageDesignIntf::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||
m_selectionRect = 0;
|
||||
m_multiSelectStarted = false;
|
||||
}
|
||||
if(m_infoPosRect)
|
||||
{
|
||||
delete m_infoPosRect;
|
||||
m_infoPosRect = 0;
|
||||
}
|
||||
QGraphicsScene::mouseReleaseEvent(event);
|
||||
}
|
||||
|
||||
|
@ -295,6 +295,7 @@ namespace LimeReport {
|
||||
BaseDesignIntf::ItemMode m_itemMode;
|
||||
QGraphicsRectItem* m_cutterBorder;
|
||||
QGraphicsRectItem* m_pageRect;
|
||||
QGraphicsTextItem* m_infoPosRect;
|
||||
QVector<CommandIf::Ptr> m_commandsList;
|
||||
QVector<ReportItemPos> m_positionStamp;
|
||||
QVector<ReportItemSize> m_geometryStamp;
|
||||
|
@ -701,7 +701,7 @@ int ScriptEngineManager::getPageFreeSpace(PageItemDesignIntf* page){
|
||||
}
|
||||
else height += band->height();
|
||||
}
|
||||
return page->height() - height;
|
||||
return page->height() - height - (page->pageFooter()?page->pageFooter()->height() : 0);
|
||||
} else return -1;
|
||||
}
|
||||
|
||||
|
@ -520,6 +520,17 @@ p, li { white-space: pre-wrap; }
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>LimeReport::BorderFrameEditor</name>
|
||||
<message>
|
||||
<source>BorderFrameEditor</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Text</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>LimeReport::ConnectionDesc</name>
|
||||
<message>
|
||||
|
@ -648,6 +648,17 @@ p, li { white-space: pre-wrap; }
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>LimeReport::BorderFrameEditor</name>
|
||||
<message>
|
||||
<source>BorderFrameEditor</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Text</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>LimeReport::ConnectionDesc</name>
|
||||
<message>
|
||||
|
@ -623,6 +623,19 @@ p, li { white-space: pre-wrap; }
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>LimeReport::BorderFrameEditor</name>
|
||||
<message>
|
||||
<location filename="../limereport/items/lrborderframeeditor.ui" line="20"/>
|
||||
<source>BorderFrameEditor</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../limereport/items/lrborderframeeditor.cpp" line="39"/>
|
||||
<source>Text</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>LimeReport::ConnectionDesc</name>
|
||||
<message>
|
||||
@ -4214,14 +4227,14 @@ Cet aperçu n'est plus valide.</translation>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../limereport/lrpagedesignintf.cpp" line="1676"/>
|
||||
<location filename="../limereport/lrpagedesignintf.cpp" line="1718"/>
|
||||
<location filename="../limereport/lrpagedesignintf.cpp" line="1702"/>
|
||||
<location filename="../limereport/lrpagedesignintf.cpp" line="1744"/>
|
||||
<source>Attention!</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../limereport/lrpagedesignintf.cpp" line="1676"/>
|
||||
<location filename="../limereport/lrpagedesignintf.cpp" line="1718"/>
|
||||
<location filename="../limereport/lrpagedesignintf.cpp" line="1702"/>
|
||||
<location filename="../limereport/lrpagedesignintf.cpp" line="1744"/>
|
||||
<source>Selected elements have different parent containers</source>
|
||||
<translation>Les éléments sélectionnés ont un parent différent</translation>
|
||||
</message>
|
||||
|
@ -635,6 +635,19 @@ p, li { white-space: pre-wrap; }
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>LimeReport::BorderFrameEditor</name>
|
||||
<message>
|
||||
<location filename="../limereport/items/lrborderframeeditor.ui" line="20"/>
|
||||
<source>BorderFrameEditor</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../limereport/items/lrborderframeeditor.cpp" line="39"/>
|
||||
<source>Text</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>LimeReport::ConnectionDesc</name>
|
||||
<message>
|
||||
@ -4226,14 +4239,14 @@ Ten podgląd nie jest już prawidłowy.</translation>
|
||||
<translation>Ciąg znaków</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../limereport/lrpagedesignintf.cpp" line="1676"/>
|
||||
<location filename="../limereport/lrpagedesignintf.cpp" line="1718"/>
|
||||
<location filename="../limereport/lrpagedesignintf.cpp" line="1702"/>
|
||||
<location filename="../limereport/lrpagedesignintf.cpp" line="1744"/>
|
||||
<source>Attention!</source>
|
||||
<translation>Uwaga!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../limereport/lrpagedesignintf.cpp" line="1676"/>
|
||||
<location filename="../limereport/lrpagedesignintf.cpp" line="1718"/>
|
||||
<location filename="../limereport/lrpagedesignintf.cpp" line="1702"/>
|
||||
<location filename="../limereport/lrpagedesignintf.cpp" line="1744"/>
|
||||
<source>Selected elements have different parent containers</source>
|
||||
<translation>Wybrane elementy mają różne pojemniki nadrzędne</translation>
|
||||
</message>
|
||||
|
@ -525,6 +525,17 @@ p, li { white-space: pre-wrap; }
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>LimeReport::BorderFrameEditor</name>
|
||||
<message>
|
||||
<source>BorderFrameEditor</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Text</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>LimeReport::ConnectionDesc</name>
|
||||
<message>
|
||||
|
@ -532,6 +532,17 @@ p, li { white-space: pre-wrap; }
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>LimeReport::BorderFrameEditor</name>
|
||||
<message>
|
||||
<source>BorderFrameEditor</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Text</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>LimeReport::ConnectionDesc</name>
|
||||
<message>
|
||||
|
Loading…
Reference in New Issue
Block a user