0
0
mirror of https://github.com/fralx/LimeReport.git synced 2025-01-11 17:18:10 +03:00

Edit mode changed

This commit is contained in:
Arin Alexander 2019-03-01 19:41:27 +03:00
parent ca57e5c195
commit c7045ec1d6
4 changed files with 18 additions and 11 deletions

View File

@ -105,6 +105,7 @@ void BandMarker::mousePressEvent(QGraphicsSceneMouseEvent *event)
if (!(event->modifiers() & Qt::ControlModifier))
m_band->scene()->clearSelection();
m_band->setSelected(true);
m_oldBandPos = m_band->pos();
update(0,0,boundingRect().width(),boundingRect().width());
}
}
@ -136,7 +137,7 @@ void BandMarker::mouseMoveEvent(QGraphicsSceneMouseEvent* event)
void BandMarker::mouseReleaseEvent(QGraphicsSceneMouseEvent* event)
{
m_band->posChanged(m_band, m_band->pos(), m_band->pos());
m_band->posChanged(m_band, m_band->pos(), m_oldBandPos);
}
BandDesignIntf::BandDesignIntf(BandsType bandType, const QString &xmlTypeName, QObject* owner, QGraphicsItem *parent) :

View File

@ -72,6 +72,7 @@ private:
QRectF m_rect;
QColor m_color;
BandDesignIntf* m_band;
QPointF m_oldBandPos;
};
class BandNameLabel : public QGraphicsItem{

View File

@ -256,7 +256,7 @@ void PageDesignIntf::startEditMode()
PageItemDesignIntf *PageDesignIntf::pageItem()
{
return m_pageItem.data();
return m_currentPage ? m_currentPage : m_pageItem.data();
}
void PageDesignIntf::setPageItem(PageItemDesignIntf::Ptr pageItem)
@ -1079,7 +1079,11 @@ PageItemDesignIntf* PageDesignIntf::getCurrentPage() const
void PageDesignIntf::setCurrentPage(PageItemDesignIntf* currentPage)
{
if (m_currentPage != currentPage ){
if (m_currentPage) m_currentPage->setItemMode(PreviewMode);
m_currentPage = currentPage;
if (m_itemMode == DesignMode){
m_currentPage->setItemMode(DesignMode);
}
}
}
@ -1766,13 +1770,14 @@ void PageDesignIntf::removeAllItems()
void PageDesignIntf::setItemMode(BaseDesignIntf::ItemMode state)
{
m_itemMode = state;
foreach(QGraphicsItem * item, items()) {
BaseDesignIntf *reportItem = dynamic_cast<BaseDesignIntf *>(item);
// foreach(QGraphicsItem * item, items()) {
// BaseDesignIntf *reportItem = dynamic_cast<BaseDesignIntf *>(item);
if (reportItem) {
reportItem->setItemMode(itemMode());
}
}
// if (reportItem) {
// reportItem->setItemMode(itemMode());
// }
// }
if (m_currentPage) m_currentPage->setItemMode(state);
}
BaseDesignIntf* PageDesignIntf::reportItemByName(const QString &name)
@ -2507,7 +2512,8 @@ bool BandMoveFromToCommand::doIt()
void BandMoveFromToCommand::undoIt()
{
if (page()) page()->pageItem()->moveBandFromTo(to, from);
if (page() && page()->pageItem())
page()->pageItem()->moveBandFromTo(to, from);
}
}

View File

@ -261,6 +261,7 @@ void PreviewReportWindow::moveEvent(QMoveEvent* e)
void PreviewReportWindow::showEvent(QShowEvent *)
{
m_fontEditor->setVisible(ui->actionEdit_Mode->isChecked());
ui->editModeTools->setVisible(false);
m_textAlignmentEditor->setVisible(ui->actionEdit_Mode->isChecked());
switch (m_previewScaleType) {
case FitWidth:
@ -458,5 +459,3 @@ void PreviewReportWindow::on_actionShow_Toolbar_triggered()
}// namespace LimeReport