mirror of
https://github.com/python-LimeReport/LimeReport.git
synced 2024-12-25 13:04:38 +03:00
Join & selection marker has been removed
This commit is contained in:
parent
f85b564808
commit
6ce77268fd
@ -69,8 +69,6 @@ BaseDesignIntf::BaseDesignIntf(const QString &storageTypeName, QObject *owner, Q
|
|||||||
m_storageTypeName(storageTypeName),
|
m_storageTypeName(storageTypeName),
|
||||||
m_itemMode(DesignMode),
|
m_itemMode(DesignMode),
|
||||||
m_objectState(ObjectCreated),
|
m_objectState(ObjectCreated),
|
||||||
m_selectionMarker(0),
|
|
||||||
m_joinMarker(0),
|
|
||||||
m_backgroundBrushStyle(SolidPattern),
|
m_backgroundBrushStyle(SolidPattern),
|
||||||
m_backgroundColor(Qt::white),
|
m_backgroundColor(Qt::white),
|
||||||
m_margin(4),
|
m_margin(4),
|
||||||
@ -82,7 +80,8 @@ BaseDesignIntf::BaseDesignIntf(const QString &storageTypeName, QObject *owner, Q
|
|||||||
m_patternItem(0),
|
m_patternItem(0),
|
||||||
m_fillInSecondPass(false),
|
m_fillInSecondPass(false),
|
||||||
m_watermark(false),
|
m_watermark(false),
|
||||||
m_hovered(false)
|
m_hovered(false),
|
||||||
|
m_joinMarkerOn(false)
|
||||||
{
|
{
|
||||||
setGeometry(QRectF(0, 0, m_width, m_height));
|
setGeometry(QRectF(0, 0, m_width, m_height));
|
||||||
if (BaseDesignIntf *item = dynamic_cast<BaseDesignIntf *>(parent)) {
|
if (BaseDesignIntf *item = dynamic_cast<BaseDesignIntf *>(parent)) {
|
||||||
@ -106,7 +105,7 @@ QRectF BaseDesignIntf::boundingRect() const
|
|||||||
|
|
||||||
BaseDesignIntf::~BaseDesignIntf(void) {
|
BaseDesignIntf::~BaseDesignIntf(void) {
|
||||||
//delete m_selectionMarker;
|
//delete m_selectionMarker;
|
||||||
delete m_joinMarker;
|
//delete m_joinMarker;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseDesignIntf::setParentReportItem(const QString &value)
|
void BaseDesignIntf::setParentReportItem(const QString &value)
|
||||||
@ -391,10 +390,13 @@ void BaseDesignIntf::paint(QPainter *ppainter, const QStyleOptionGraphicsItem *o
|
|||||||
{
|
{
|
||||||
Q_UNUSED(option);
|
Q_UNUSED(option);
|
||||||
Q_UNUSED(widget);
|
Q_UNUSED(widget);
|
||||||
|
ppainter->save();
|
||||||
setupPainter(ppainter);
|
setupPainter(ppainter);
|
||||||
drawBorder(ppainter, rect());
|
drawBorder(ppainter, rect());
|
||||||
if (isSelected()) {drawSelection(ppainter, rect());}
|
if (m_joinMarkerOn) { drawMarker(ppainter, Const::JOIN_COLOR);}
|
||||||
|
if (isSelected() && !m_joinMarkerOn) {drawMarker(ppainter, Const::SELECTION_COLOR);}
|
||||||
drawResizeZone(ppainter);
|
drawResizeZone(ppainter);
|
||||||
|
ppainter->restore();
|
||||||
// if (m_hovered) ppainter->drawImage(
|
// if (m_hovered) ppainter->drawImage(
|
||||||
// QRectF(QPointF(rect().topRight().x()-24, rect().bottomLeft().y()-24),
|
// QRectF(QPointF(rect().topRight().x()-24, rect().bottomLeft().y()-24),
|
||||||
// QSizeF(24, 24)),QImage(":/items/images/settings.png"));
|
// QSizeF(24, 24)),QImage(":/items/images/settings.png"));
|
||||||
@ -573,6 +575,7 @@ void BaseDesignIntf::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
|||||||
moveSelectedItems(tmpPos - pos());
|
moveSelectedItems(tmpPos - pos());
|
||||||
if (page()->selectedItems().count()==1 && (page()->magneticMovement()))
|
if (page()->selectedItems().count()==1 && (page()->magneticMovement()))
|
||||||
page()->itemMoved(this);
|
page()->itemMoved(this);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -673,15 +676,17 @@ QPointF BaseDesignIntf::modifyPosForAlignedItem(const QPointF& pos){
|
|||||||
|
|
||||||
void BaseDesignIntf::turnOnJoinMarker(bool value)
|
void BaseDesignIntf::turnOnJoinMarker(bool value)
|
||||||
{
|
{
|
||||||
if (value){
|
m_joinMarkerOn = value;
|
||||||
m_joinMarker = new Marker(this);
|
update();
|
||||||
m_joinMarker->setColor(Const::JOIN_COLOR);
|
// if (value){
|
||||||
m_joinMarker->setRect(rect());
|
// m_joinMarker = new Marker(this);
|
||||||
m_joinMarker->setVisible(true);
|
// m_joinMarker->setColor(Const::JOIN_COLOR);
|
||||||
} else {
|
// m_joinMarker->setRect(rect());
|
||||||
delete m_joinMarker;
|
// m_joinMarker->setVisible(true);
|
||||||
m_joinMarker = 0;
|
// } else {
|
||||||
}
|
// delete m_joinMarker;
|
||||||
|
// m_joinMarker = 0;
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseDesignIntf::updateItemAlign(){
|
void BaseDesignIntf::updateItemAlign(){
|
||||||
@ -717,20 +722,6 @@ void BaseDesignIntf::updatePossibleDirectionFlags(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseDesignIntf::turnOnSelectionMarker(bool value)
|
|
||||||
{
|
|
||||||
if (value && !m_selectionMarker){
|
|
||||||
m_selectionMarker = new SelectionMarker(this);
|
|
||||||
m_selectionMarker->setColor(selectionMarkerColor());
|
|
||||||
m_selectionMarker->setZValue(zValue()-1);
|
|
||||||
updateSelectionMarker();
|
|
||||||
m_selectionMarker->setVisible(true);
|
|
||||||
} else {
|
|
||||||
delete m_selectionMarker;
|
|
||||||
m_selectionMarker = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BaseDesignIntf::fillInSecondPass() const
|
bool BaseDesignIntf::fillInSecondPass() const
|
||||||
{
|
{
|
||||||
return m_fillInSecondPass;
|
return m_fillInSecondPass;
|
||||||
@ -988,7 +979,6 @@ void BaseDesignIntf::setGeometry(QRectF rect)
|
|||||||
m_leftRect = QRectF(0-resizeHandleSize(), 0-resizeHandleSize(), resizeHandleSize()*2, height()+resizeHandleSize()*2);
|
m_leftRect = QRectF(0-resizeHandleSize(), 0-resizeHandleSize(), resizeHandleSize()*2, height()+resizeHandleSize()*2);
|
||||||
m_rightRect = QRectF(width() - resizeHandleSize(), 0-resizeHandleSize(), resizeHandleSize()*2, height()+resizeHandleSize()*2);
|
m_rightRect = QRectF(width() - resizeHandleSize(), 0-resizeHandleSize(), resizeHandleSize()*2, height()+resizeHandleSize()*2);
|
||||||
m_boundingRect = QRectF();
|
m_boundingRect = QRectF();
|
||||||
updateSelectionMarker();
|
|
||||||
if (!isLoading()){
|
if (!isLoading()){
|
||||||
geometryChangedEvent(geometry(), m_oldGeometry);
|
geometryChangedEvent(geometry(), m_oldGeometry);
|
||||||
emit geometryChanged(this, geometry(), m_oldGeometry);
|
emit geometryChanged(this, geometry(), m_oldGeometry);
|
||||||
@ -1074,11 +1064,9 @@ void BaseDesignIntf::initMode(ItemMode mode)
|
|||||||
QVariant BaseDesignIntf::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value)
|
QVariant BaseDesignIntf::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value)
|
||||||
{
|
{
|
||||||
if (change == QGraphicsItem::ItemPositionHasChanged) {
|
if (change == QGraphicsItem::ItemPositionHasChanged) {
|
||||||
updateSelectionMarker();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (change == QGraphicsItem::ItemSelectedChange) {
|
if (change == QGraphicsItem::ItemSelectedChange) {
|
||||||
turnOnSelectionMarker(value.toBool());
|
|
||||||
emit itemSelectedHasBeenChanged(this, value.toBool());
|
emit itemSelectedHasBeenChanged(this, value.toBool());
|
||||||
}
|
}
|
||||||
if (change == QGraphicsItem::ItemParentHasChanged) {
|
if (change == QGraphicsItem::ItemParentHasChanged) {
|
||||||
@ -1118,24 +1106,13 @@ QPainterPath BaseDesignIntf::shape() const
|
|||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseDesignIntf::drawSelection(QPainter *painter, QRectF /*rect*/) const
|
void BaseDesignIntf::drawMarker(QPainter *painter, QColor color) const
|
||||||
{
|
{
|
||||||
painter->save();
|
painter->save();
|
||||||
// painter->setPen(QPen(Qt::red,m_selectionPenSize));
|
|
||||||
// painter->drawLine(QPointF(m_resizeHandleSize,0),QPointF(0,0));
|
|
||||||
// painter->drawLine(QPointF(0,m_resizeHandleSize),QPointF(0,0));
|
|
||||||
// painter->drawLine(rect.right()-m_resizeHandleSize,0,rect.right(),0);
|
|
||||||
// painter->drawLine(rect.right(),m_resizeHandleSize,rect.right(),0);
|
|
||||||
// painter->drawLine(0,rect.bottom(),0,rect.bottom()-10);
|
|
||||||
// painter->drawLine(0,rect.bottom(),m_resizeHandleSize,rect.bottom());
|
|
||||||
// painter->drawLine(rect.right()-m_resizeHandleSize,rect.bottom(),rect.right(),rect.bottom());
|
|
||||||
// painter->drawLine(rect.right(),rect.bottom()-m_resizeHandleSize,rect.right(),rect.bottom());
|
|
||||||
// painter->setOpacity(Consts::SELECTION_COLOR_OPACITY);
|
|
||||||
// painter->fillRect(rect,selectionColor());
|
|
||||||
|
|
||||||
QPen pen(Qt::red,m_selectionPenSize);
|
QPen pen(color, m_selectionPenSize);
|
||||||
painter->setPen(pen);
|
painter->setPen(pen);
|
||||||
painter->setBrush(QBrush(Qt::red));
|
painter->setBrush(QBrush(color));
|
||||||
painter->setOpacity(1);
|
painter->setOpacity(1);
|
||||||
const int markerSize = Const::RESIZE_HANDLE_SIZE;
|
const int markerSize = Const::RESIZE_HANDLE_SIZE;
|
||||||
painter->drawRect(QRectF(-markerSize,-markerSize,markerSize*2,markerSize*2));
|
painter->drawRect(QRectF(-markerSize,-markerSize,markerSize*2,markerSize*2));
|
||||||
@ -1202,7 +1179,6 @@ void BaseDesignIntf::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
|||||||
QRectF newGeometry = geometry();
|
QRectF newGeometry = geometry();
|
||||||
if (newGeometry != m_oldGeometry) {
|
if (newGeometry != m_oldGeometry) {
|
||||||
geometryChangedEvent(newGeometry, m_oldGeometry);
|
geometryChangedEvent(newGeometry, m_oldGeometry);
|
||||||
updateSelectionMarker();
|
|
||||||
emit(posChanged(this, newGeometry.topLeft(), m_oldGeometry.topLeft()));
|
emit(posChanged(this, newGeometry.topLeft(), m_oldGeometry.topLeft()));
|
||||||
}
|
}
|
||||||
QGraphicsItem::mouseReleaseEvent(event);
|
QGraphicsItem::mouseReleaseEvent(event);
|
||||||
@ -1332,17 +1308,6 @@ void BaseDesignIntf::setMarginSize(int value)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseDesignIntf::updateSelectionMarker()
|
|
||||||
{
|
|
||||||
// if (m_selectionMarker && (itemMode() & DesignMode || itemMode() & EditMode)) {
|
|
||||||
// if ((!m_selectionMarker->scene()) && scene()) scene()->addItem(m_selectionMarker);
|
|
||||||
// if (parentItem()) {
|
|
||||||
// m_selectionMarker->setRect(rect());
|
|
||||||
// m_selectionMarker->setPos(0,0);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
void BaseDesignIntf::drawResizeZone(QPainter* /*painter*/)
|
void BaseDesignIntf::drawResizeZone(QPainter* /*painter*/)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -1585,103 +1550,6 @@ void BaseDesignIntf::notify(const QVector<QString>& propertyNames)
|
|||||||
emit propertyesChanged(propertyNames);
|
emit propertyesChanged(propertyNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
SelectionMarker::SelectionMarker(QGraphicsItem *parent)//, QGraphicsScene *scene)
|
|
||||||
: Marker(parent)
|
|
||||||
{
|
|
||||||
setAcceptHoverEvents(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SelectionMarker::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
|
||||||
{
|
|
||||||
BaseDesignIntf* baseItem = dynamic_cast<BaseDesignIntf*>(parentItem());
|
|
||||||
if(baseItem) baseItem->hoverMoveEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SelectionMarker::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
|
||||||
{
|
|
||||||
BaseDesignIntf* baseItem = dynamic_cast<BaseDesignIntf*>(parentItem());
|
|
||||||
if (baseItem) baseItem->hoverLeaveEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SelectionMarker::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
|
||||||
{
|
|
||||||
BaseDesignIntf* baseItem = dynamic_cast<BaseDesignIntf*>(parentItem());
|
|
||||||
if (baseItem) baseItem->hoverEnterEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SelectionMarker::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
|
||||||
{
|
|
||||||
parentItem()->setSelected(true);
|
|
||||||
BaseDesignIntf* baseItem = dynamic_cast<BaseDesignIntf*>(parentItem());
|
|
||||||
if(baseItem) baseItem->mousePressEvent(event);
|
|
||||||
QGraphicsItem::mousePressEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SelectionMarker::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
|
||||||
{
|
|
||||||
BaseDesignIntf* baseItem = dynamic_cast<BaseDesignIntf*>(parentItem());
|
|
||||||
if(baseItem) baseItem->mouseReleaseEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SelectionMarker::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
|
|
||||||
{
|
|
||||||
BaseDesignIntf* baseItem = dynamic_cast<BaseDesignIntf*>(parentItem());
|
|
||||||
if(baseItem) baseItem->mouseDoubleClickEvent(event);
|
|
||||||
QGraphicsItem::mouseDoubleClickEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SelectionMarker::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
|
||||||
{
|
|
||||||
BaseDesignIntf* baseItem = dynamic_cast<BaseDesignIntf*>(parentItem());
|
|
||||||
if(baseItem) baseItem->mouseMoveEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
QRectF Marker::boundingRect() const
|
|
||||||
{
|
|
||||||
return m_rect.adjusted(-15,-15,15,15);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Marker::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
|
|
||||||
{
|
|
||||||
QPen pen;
|
|
||||||
const int markerSize = Const::RESIZE_HANDLE_SIZE;
|
|
||||||
pen.setColor(color());
|
|
||||||
pen.setWidth(2);
|
|
||||||
pen.setStyle(Qt::DotLine);
|
|
||||||
painter->setPen(pen);
|
|
||||||
painter->setOpacity(Const::SELECTION_COLOR_OPACITY);
|
|
||||||
painter->drawRect(rect());
|
|
||||||
painter->setBrush(color());
|
|
||||||
painter->setPen(Qt::transparent);
|
|
||||||
painter->setOpacity(1);
|
|
||||||
painter->drawRect(QRectF(-markerSize,-markerSize,markerSize*2,markerSize*2));
|
|
||||||
painter->drawRect(QRectF(rect().right()-markerSize,rect().bottom()-markerSize,markerSize*2,markerSize*2));
|
|
||||||
painter->drawRect(QRectF(rect().right()-markerSize,rect().top()-markerSize,markerSize*2,markerSize*2));
|
|
||||||
painter->drawRect(QRectF(rect().left()-markerSize,rect().bottom()-markerSize,markerSize*2,markerSize*2));
|
|
||||||
painter->drawRect(QRectF(rect().left()-markerSize,
|
|
||||||
rect().bottom()-rect().height()/2-markerSize,markerSize*2,markerSize*2));
|
|
||||||
painter->drawRect(QRectF(rect().right()-markerSize,
|
|
||||||
rect().bottom()-rect().height()/2-markerSize,markerSize*2,markerSize*2));
|
|
||||||
painter->drawRect(QRectF(rect().left()+rect().width()/2-markerSize,
|
|
||||||
rect().top()-markerSize,markerSize*2,markerSize*2));
|
|
||||||
painter->drawRect(QRectF(rect().left()+rect().width()/2-markerSize,
|
|
||||||
rect().bottom()-markerSize,markerSize*2,markerSize*2));
|
|
||||||
}
|
|
||||||
|
|
||||||
QRectF Marker::rect() const
|
|
||||||
{
|
|
||||||
return m_rect;
|
|
||||||
}
|
|
||||||
|
|
||||||
QColor Marker::color() const
|
|
||||||
{
|
|
||||||
return m_color;
|
|
||||||
}
|
|
||||||
|
|
||||||
BaseDesignIntf *Marker::object() const
|
|
||||||
{
|
|
||||||
return m_object;
|
|
||||||
}
|
|
||||||
|
|
||||||
QMap<QString, QString> BaseDesignIntf::getStringForTranslation(){
|
QMap<QString, QString> BaseDesignIntf::getStringForTranslation(){
|
||||||
return QMap<QString,QString>();
|
return QMap<QString,QString>();
|
||||||
|
@ -47,37 +47,6 @@ enum ItemModes{ DesignMode=1, PreviewMode=2, PrintMode=4, EditMode=8, LayoutEdit
|
|||||||
|
|
||||||
class ReportEnginePrivate;
|
class ReportEnginePrivate;
|
||||||
class PageDesignIntf;
|
class PageDesignIntf;
|
||||||
class BaseDesignIntf;
|
|
||||||
|
|
||||||
class Marker : public QGraphicsItem{
|
|
||||||
public:
|
|
||||||
Marker(QGraphicsItem* parent=0):QGraphicsItem(parent),m_object(NULL){}
|
|
||||||
QRectF boundingRect() const;
|
|
||||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *);
|
|
||||||
void setRect(QRectF rect){prepareGeometryChange();m_rect=rect;}
|
|
||||||
void setColor(QColor color){m_color=color;}
|
|
||||||
QRectF rect() const;
|
|
||||||
QColor color() const;
|
|
||||||
BaseDesignIntf *object() const;
|
|
||||||
private:
|
|
||||||
QRectF m_rect;
|
|
||||||
QColor m_color;
|
|
||||||
BaseDesignIntf* m_object;
|
|
||||||
};
|
|
||||||
|
|
||||||
class SelectionMarker : public Marker{
|
|
||||||
public:
|
|
||||||
SelectionMarker(QGraphicsItem* parent=0);
|
|
||||||
protected:
|
|
||||||
void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
|
|
||||||
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
|
|
||||||
void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
|
|
||||||
void mousePressEvent(QGraphicsSceneMouseEvent *event);
|
|
||||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
|
|
||||||
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
|
|
||||||
void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
|
|
||||||
};
|
|
||||||
|
|
||||||
class DataSourceManager;
|
class DataSourceManager;
|
||||||
class ReportRender;
|
class ReportRender;
|
||||||
|
|
||||||
@ -334,7 +303,7 @@ protected:
|
|||||||
void drawDesignModeBorder(QPainter* painter, QRectF rect) const;
|
void drawDesignModeBorder(QPainter* painter, QRectF rect) const;
|
||||||
void drawRenderModeBorder(QPainter *painter, QRectF rect) const;
|
void drawRenderModeBorder(QPainter *painter, QRectF rect) const;
|
||||||
void drawResizeZone(QPainter*);
|
void drawResizeZone(QPainter*);
|
||||||
void drawSelection(QPainter* painter, QRectF) const;
|
void drawMarker(QPainter* painter, QColor color) const;
|
||||||
void drawPinArea(QPainter* painter) const;
|
void drawPinArea(QPainter* painter) const;
|
||||||
|
|
||||||
void initResizeZones();
|
void initResizeZones();
|
||||||
@ -361,12 +330,10 @@ protected:
|
|||||||
qreal calcAbsolutePosX(qreal currentOffset, BaseDesignIntf* item);
|
qreal calcAbsolutePosX(qreal currentOffset, BaseDesignIntf* item);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateSelectionMarker();
|
|
||||||
int resizeDirectionFlags(QPointF position);
|
int resizeDirectionFlags(QPointF position);
|
||||||
void moveSelectedItems(QPointF delta);
|
void moveSelectedItems(QPointF delta);
|
||||||
Qt::CursorShape getPossibleCursor(int cursorFlags);
|
Qt::CursorShape getPossibleCursor(int cursorFlags);
|
||||||
void updatePossibleDirectionFlags();
|
void updatePossibleDirectionFlags();
|
||||||
void turnOnSelectionMarker(bool value);
|
|
||||||
private:
|
private:
|
||||||
QPointF m_startPos;
|
QPointF m_startPos;
|
||||||
int m_resizeHandleSize;
|
int m_resizeHandleSize;
|
||||||
@ -401,8 +368,6 @@ private:
|
|||||||
ItemMode m_itemMode;
|
ItemMode m_itemMode;
|
||||||
|
|
||||||
ObjectState m_objectState;
|
ObjectState m_objectState;
|
||||||
SelectionMarker* m_selectionMarker;
|
|
||||||
Marker* m_joinMarker;
|
|
||||||
|
|
||||||
BrushStyle m_backgroundBrushStyle;
|
BrushStyle m_backgroundBrushStyle;
|
||||||
QColor m_backgroundColor;
|
QColor m_backgroundColor;
|
||||||
@ -419,6 +384,7 @@ private:
|
|||||||
bool m_fillInSecondPass;
|
bool m_fillInSecondPass;
|
||||||
bool m_watermark;
|
bool m_watermark;
|
||||||
bool m_hovered;
|
bool m_hovered;
|
||||||
|
bool m_joinMarkerOn;
|
||||||
signals:
|
signals:
|
||||||
void geometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry);
|
void geometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry);
|
||||||
void posChanging(QObject* object, QPointF newPos, QPointF oldPos);
|
void posChanging(QObject* object, QPointF newPos, QPointF oldPos);
|
||||||
|
@ -339,6 +339,15 @@ void PageDesignIntf::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
|||||||
qreal posY = div(pageItem()->mapFromScene(event->scenePos()).y(), verticalGridStep()).quot * verticalGridStep();
|
qreal posY = div(pageItem()->mapFromScene(event->scenePos()).y(), verticalGridStep()).quot * verticalGridStep();
|
||||||
qreal posX = div(pageItem()->mapFromScene(event->scenePos()).x(), verticalGridStep()).quot * horizontalGridStep();
|
qreal posX = div(pageItem()->mapFromScene(event->scenePos()).x(), verticalGridStep()).quot * horizontalGridStep();
|
||||||
m_itemInsertRect->setPos(posX,posY);
|
m_itemInsertRect->setPos(posX,posY);
|
||||||
|
if (magneticMovement()){
|
||||||
|
rectMoved(
|
||||||
|
QRectF(m_itemInsertRect->pos().x(),
|
||||||
|
m_itemInsertRect->pos().y(),
|
||||||
|
m_itemInsertRect->boundingRect().width(),
|
||||||
|
m_itemInsertRect->boundingRect().height()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else { if (m_insertMode) m_itemInsertRect->setVisible(false); }
|
else { if (m_insertMode) m_itemInsertRect->setVisible(false); }
|
||||||
|
|
||||||
@ -1102,9 +1111,53 @@ void PageDesignIntf::endUpdate()
|
|||||||
emit pageUpdateFinished(this);
|
emit pageUpdateFinished(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PageDesignIntf::activateItemToJoin(QRectF itemRect, QList<ItemProjections>& items){
|
||||||
|
QRectF r1(itemRect.x(), itemRect.y()-50, itemRect.width(), itemRect.height()+100);
|
||||||
|
QRectF r2(itemRect.x()-50, itemRect.y(), itemRect.width()+100, itemRect.height());
|
||||||
|
qreal maxSquare = 0;
|
||||||
|
|
||||||
|
if (m_joinItem) {
|
||||||
|
m_joinItem->turnOnJoinMarker(false);
|
||||||
|
m_joinItem = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach(ItemProjections p, items){
|
||||||
|
qreal tmpSquare = qMax(p.square(r1)/itemRect.width(),p.square(r2)/itemRect.height());
|
||||||
|
if (tmpSquare>maxSquare) {
|
||||||
|
maxSquare = tmpSquare;
|
||||||
|
m_joinItem = p.item();
|
||||||
|
if (p.square(r1)/itemRect.width() > p.square(r2) / itemRect.height())
|
||||||
|
m_joinType = Width;
|
||||||
|
else
|
||||||
|
m_joinType = Height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_joinItem) m_joinItem->turnOnJoinMarker(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PageDesignIntf::rectMoved(QRectF itemRect, BaseDesignIntf* container){
|
||||||
|
if (!container){
|
||||||
|
container = bandAt(QPointF(itemRect.topLeft()));
|
||||||
|
if (!container) container = this->pageItem();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (container){
|
||||||
|
m_projections.clear();
|
||||||
|
foreach(BaseDesignIntf* bi, container->childBaseItems()){
|
||||||
|
m_projections.append(ItemProjections(bi));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
activateItemToJoin(itemRect, m_projections);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void PageDesignIntf::itemMoved(BaseDesignIntf *item)
|
void PageDesignIntf::itemMoved(BaseDesignIntf *item)
|
||||||
{
|
{
|
||||||
if (m_movedItem!=item){
|
if (m_movedItem!=item){
|
||||||
|
m_movedItem = item;
|
||||||
BaseDesignIntf* curItem = dynamic_cast<BaseDesignIntf*>(item->parentItem()); ;
|
BaseDesignIntf* curItem = dynamic_cast<BaseDesignIntf*>(item->parentItem()); ;
|
||||||
while (curItem){
|
while (curItem){
|
||||||
m_movedItemContainer = dynamic_cast<BandDesignIntf*>(curItem);
|
m_movedItemContainer = dynamic_cast<BandDesignIntf*>(curItem);
|
||||||
@ -1122,28 +1175,29 @@ void PageDesignIntf::itemMoved(BaseDesignIntf *item)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QRectF r1(item->pos().x(),item->pos().y()-50,item->width(),item->height()+100);
|
activateItemToJoin(item->geometry(), m_projections);
|
||||||
QRectF r2(item->pos().x()-50,item->pos().y(),item->width()+100,item->height());
|
// QRectF r1(item->pos().x(),item->pos().y()-50,item->width(),item->height()+100);
|
||||||
qreal maxSquare = 0;
|
// QRectF r2(item->pos().x()-50,item->pos().y(),item->width()+100,item->height());
|
||||||
|
// qreal maxSquare = 0;
|
||||||
|
|
||||||
if (m_joinItem) {
|
// if (m_joinItem) {
|
||||||
m_joinItem->turnOnJoinMarker(false);
|
// m_joinItem->turnOnJoinMarker(false);
|
||||||
m_joinItem = 0;
|
// m_joinItem = 0;
|
||||||
}
|
// }
|
||||||
|
|
||||||
foreach(ItemProjections p, m_projections){
|
// foreach(ItemProjections p, m_projections){
|
||||||
qreal tmpSquare = qMax(p.square(r1)/item->width(),p.square(r2)/item->height());
|
// qreal tmpSquare = qMax(p.square(r1)/item->width(),p.square(r2)/item->height());
|
||||||
if (tmpSquare>maxSquare) {
|
// if (tmpSquare>maxSquare) {
|
||||||
maxSquare = tmpSquare;
|
// maxSquare = tmpSquare;
|
||||||
m_joinItem = p.item();
|
// m_joinItem = p.item();
|
||||||
if (p.square(r1)/item->width()>p.square(r2)/item->height())
|
// if (p.square(r1)/item->width()>p.square(r2)/item->height())
|
||||||
m_joinType = Width;
|
// m_joinType = Width;
|
||||||
else
|
// else
|
||||||
m_joinType = Height;
|
// m_joinType = Height;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (m_joinItem) m_joinItem->turnOnJoinMarker(true);
|
// if (m_joinItem) m_joinItem->turnOnJoinMarker(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,6 +166,7 @@ namespace LimeReport {
|
|||||||
bool isUpdating(){return m_updating;}
|
bool isUpdating(){return m_updating;}
|
||||||
void endUpdate();
|
void endUpdate();
|
||||||
|
|
||||||
|
void rectMoved(QRectF itemRect, BaseDesignIntf* container = 0);
|
||||||
void itemMoved(BaseDesignIntf* item);
|
void itemMoved(BaseDesignIntf* item);
|
||||||
bool magneticMovement() const;
|
bool magneticMovement() const;
|
||||||
void setMagneticMovement(bool magneticMovement);
|
void setMagneticMovement(bool magneticMovement);
|
||||||
@ -175,6 +176,7 @@ namespace LimeReport {
|
|||||||
|
|
||||||
void setPropertyToSelectedItems(const char *name, const QVariant &value);
|
void setPropertyToSelectedItems(const char *name, const QVariant &value);
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
virtual void keyPressEvent(QKeyEvent *event);
|
virtual void keyPressEvent(QKeyEvent *event);
|
||||||
@ -272,7 +274,7 @@ namespace LimeReport {
|
|||||||
const QVariant& oldPropertyValue,
|
const QVariant& oldPropertyValue,
|
||||||
const QVariant& newPropertyValue);
|
const QVariant& newPropertyValue);
|
||||||
void changeSelectedGroupProperty(const QString& name,const QVariant& value);
|
void changeSelectedGroupProperty(const QString& name,const QVariant& value);
|
||||||
|
void activateItemToJoin(QRectF itemRect, QList<ItemProjections>& items);
|
||||||
private:
|
private:
|
||||||
enum JoinType{Width, Height};
|
enum JoinType{Width, Height};
|
||||||
LimeReport::PageItemDesignIntf::Ptr m_pageItem;
|
LimeReport::PageItemDesignIntf::Ptr m_pageItem;
|
||||||
@ -312,6 +314,7 @@ namespace LimeReport {
|
|||||||
JoinType m_joinType;
|
JoinType m_joinType;
|
||||||
bool m_magneticMovement;
|
bool m_magneticMovement;
|
||||||
ReportSettings* m_reportSettings;
|
ReportSettings* m_reportSettings;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class AbstractPageCommand : public CommandIf{
|
class AbstractPageCommand : public CommandIf{
|
||||||
|
@ -479,7 +479,7 @@ void PageItemDesignIntf::relocateBands()
|
|||||||
{
|
{
|
||||||
if (isLoading()) return;
|
if (isLoading()) return;
|
||||||
|
|
||||||
int bandSpace = (itemMode() & DesignMode)?4:0;
|
int bandSpace = (itemMode() & DesignMode)?0:0;
|
||||||
|
|
||||||
QVector<qreal> posByColumn;
|
QVector<qreal> posByColumn;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user