|
|
@ -60,6 +60,7 @@ |
|
|
|
#include "UBGraphicsStroke.h" |
|
|
|
#include "UBGraphicsStroke.h" |
|
|
|
|
|
|
|
|
|
|
|
#include "core/memcheck.h" |
|
|
|
#include "core/memcheck.h" |
|
|
|
|
|
|
|
#include "qtlogger.h" |
|
|
|
|
|
|
|
|
|
|
|
qreal UBGraphicsScene::backgroundLayerStart = -20000000.0; |
|
|
|
qreal UBGraphicsScene::backgroundLayerStart = -20000000.0; |
|
|
|
qreal UBGraphicsScene::objectLayerStart = -10000000.0; |
|
|
|
qreal UBGraphicsScene::objectLayerStart = -10000000.0; |
|
|
@ -75,6 +76,8 @@ qreal UBGraphicsScene::toolOffsetEraser = 200; |
|
|
|
qreal UBGraphicsScene::toolOffsetCurtain = 1000; |
|
|
|
qreal UBGraphicsScene::toolOffsetCurtain = 1000; |
|
|
|
qreal UBGraphicsScene::toolOffsetPointer = 1100; |
|
|
|
qreal UBGraphicsScene::toolOffsetPointer = 1100; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
qreal UBGraphicsScene::toolOffsetCache = 1000;//Didier please define offset you want
|
|
|
|
|
|
|
|
|
|
|
|
UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent) |
|
|
|
UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent) |
|
|
|
: UBCoreGraphicsScene(parent) |
|
|
|
: UBCoreGraphicsScene(parent) |
|
|
|
, mEraser(0) |
|
|
|
, mEraser(0) |
|
|
@ -137,6 +140,8 @@ UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
connect(this, SIGNAL(selectionChanged()), this, SLOT(selectionChangedProcessing())); |
|
|
|
connect(this, SIGNAL(selectionChanged()), this, SLOT(selectionChangedProcessing())); |
|
|
|
|
|
|
|
QtLogger::logger().start("/home/ilia/Documents/tmp/2/log.txt"); |
|
|
|
|
|
|
|
QtLogger::logger().finish(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
UBGraphicsScene::~UBGraphicsScene() |
|
|
|
UBGraphicsScene::~UBGraphicsScene() |
|
|
@ -150,12 +155,16 @@ UBGraphicsScene::~UBGraphicsScene() |
|
|
|
|
|
|
|
|
|
|
|
void UBGraphicsScene::selectionChangedProcessing() |
|
|
|
void UBGraphicsScene::selectionChangedProcessing() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
QtLogger::logger().start("/home/ilia/Documents/tmp/2/log.txt"); |
|
|
|
|
|
|
|
QtLogger::logger() << "selection processing started\n" << endl; |
|
|
|
|
|
|
|
|
|
|
|
// if (selectedItems().count())
|
|
|
|
if (selectedItems().count()) |
|
|
|
// UBApplication::showMessage("ZValue is " + QString::number(selectedItems().first()->zValue(), 'f'));
|
|
|
|
UBApplication::showMessage("ZValue is " + QString::number(selectedItems().first()->zValue(), 'f')); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QList<QGraphicsItem *> allItemsList = items(); |
|
|
|
QList<QGraphicsItem *> allItemsList = items(); |
|
|
|
|
|
|
|
QtLogger::logger() << "=====all items searching...======" << endl; |
|
|
|
|
|
|
|
qreal maxZ = 0.; |
|
|
|
for( int i = 0; i < allItemsList.size(); i++ ) |
|
|
|
for( int i = 0; i < allItemsList.size(); i++ ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
QGraphicsItem *nextItem = allItemsList.at(i); |
|
|
|
QGraphicsItem *nextItem = allItemsList.at(i); |
|
|
@ -165,18 +174,29 @@ void UBGraphicsScene::selectionChangedProcessing() |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
//Temporary stub end (sankore 360)
|
|
|
|
//Temporary stub end (sankore 360)
|
|
|
|
// qreal zValue = nextItem->zValue();
|
|
|
|
// qreal zValue = nextItem->zValue();
|
|
|
|
nextItem->setZValue(qreal(1)); |
|
|
|
if (nextItem->zValue() > maxZ) |
|
|
|
|
|
|
|
maxZ = nextItem->zValue(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nextItem->setZValue(nextItem->data(UBGraphicsItemData::ItemOwnZValue).toReal()); |
|
|
|
|
|
|
|
// nextItem->setZValue(qreal(1));
|
|
|
|
|
|
|
|
QtLogger::logger() << "own Z " << QString::number(nextItem->data(UBGraphicsItemData::ItemOwnZValue).toReal(), 'f') |
|
|
|
|
|
|
|
<< " next Z " << QString::number(nextItem->zValue(), 'f')<< endl; |
|
|
|
// qDebug() << QString(" %1 ").arg(i) << QString(" %1 ").arg(zValue);
|
|
|
|
// qDebug() << QString(" %1 ").arg(i) << QString(" %1 ").arg(zValue);
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
QList<QGraphicsItem *> selItemsList = selectedItems(); |
|
|
|
QList<QGraphicsItem *> selItemsList = selectedItems(); |
|
|
|
|
|
|
|
QtLogger::logger() << "=====selected items searching...======" << endl; |
|
|
|
|
|
|
|
// QGraphicsItem *nextItem;
|
|
|
|
for( int i = 0; i < selItemsList.size(); i++ ) |
|
|
|
for( int i = 0; i < selItemsList.size(); i++ ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
QGraphicsItem *nextItem = selItemsList.at(i); |
|
|
|
QGraphicsItem *nextItem = selItemsList.at(i); |
|
|
|
|
|
|
|
QtLogger::logger() << "own Z " << QString::number(nextItem->data(UBGraphicsItemData::ItemOwnZValue).toReal(), 'f') |
|
|
|
|
|
|
|
<< " next Z " << QString::number(nextItem->zValue(), 'f')<< endl; |
|
|
|
// qreal zValue = nextItem->zValue();
|
|
|
|
// qreal zValue = nextItem->zValue();
|
|
|
|
nextItem->setZValue(2); |
|
|
|
nextItem->setZValue(maxZ + 0.0001); |
|
|
|
// qDebug() << QString(" >>> %1 <<< ").arg(i) << QString(" >>> %1 <<< ").arg(zValue);
|
|
|
|
// qDebug() << QString(" >>> %1 <<< ").arg(i) << QString(" >>> %1 <<< ").arg(zValue);
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
QtLogger::logger() << "\nselection processing finished" << endl; |
|
|
|
|
|
|
|
QtLogger::logger().finish(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// MARK: -
|
|
|
|
// MARK: -
|
|
|
@ -407,23 +427,23 @@ void UBGraphicsScene::drawEraser(const QPointF &pPoint, bool isFirstDraw) |
|
|
|
|
|
|
|
|
|
|
|
if(isFirstDraw) |
|
|
|
if(isFirstDraw) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
qreal maxZ = 0.; |
|
|
|
QList<QGraphicsItem *> allItemsList = items(); |
|
|
|
QList<QGraphicsItem *> allItemsList = items(); |
|
|
|
for( int i = 0; i < allItemsList.size(); i++ ) |
|
|
|
for( int i = 0; i < allItemsList.size(); i++ ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
QGraphicsItem *nextItem = allItemsList.at(i); |
|
|
|
QGraphicsItem *nextItem = allItemsList.at(i); |
|
|
|
qreal zValue = nextItem->zValue(); |
|
|
|
qreal zValue = nextItem->zValue(); |
|
|
|
nextItem->setZValue(qreal(1)); |
|
|
|
if (zValue > maxZ) |
|
|
|
qDebug() << QString(" %1 ").arg(i) << QString(" %1 ").arg(zValue); |
|
|
|
maxZ = zValue; |
|
|
|
|
|
|
|
nextItem->setZValue(nextItem->data(UBGraphicsItemData::ItemOwnZValue).toReal()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
mEraser->setZValue(2); |
|
|
|
mEraser->setZValue(maxZ + 0.0001); |
|
|
|
mEraser->show(); |
|
|
|
mEraser->show(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UBGraphicsScene::drawPointer(const QPointF &pPoint, bool isFirstDraw) |
|
|
|
void UBGraphicsScene::drawPointer(const QPointF &pPoint, bool isFirstDraw) |
|
|
|
{ |
|
|
|
{ |
|
|
|
qreal pointerDiameter = UBSettings::pointerDiameter / UBApplication::boardController->currentZoom(); |
|
|
|
qreal pointerDiameter = UBSettings::pointerDiameter / UBApplication::boardController->currentZoom(); |
|
|
@ -439,19 +459,20 @@ void UBGraphicsScene::drawPointer(const QPointF &pPoint, bool isFirstDraw) |
|
|
|
|
|
|
|
|
|
|
|
if(isFirstDraw) |
|
|
|
if(isFirstDraw) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
qreal maxZ = 0.; |
|
|
|
QList<QGraphicsItem *> allItemsList = items(); |
|
|
|
QList<QGraphicsItem *> allItemsList = items(); |
|
|
|
for( int i = 0; i < allItemsList.size(); i++ ) |
|
|
|
for( int i = 0; i < allItemsList.size(); i++ ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
QGraphicsItem *nextItem = allItemsList.at(i); |
|
|
|
QGraphicsItem *nextItem = allItemsList.at(i); |
|
|
|
qreal zValue = nextItem->zValue(); |
|
|
|
qreal zValue = nextItem->zValue(); |
|
|
|
nextItem->setZValue(qreal(1)); |
|
|
|
if (zValue > maxZ) |
|
|
|
qDebug() << QString(" %1 ").arg(i) << QString(" %1 ").arg(zValue); |
|
|
|
maxZ = zValue; |
|
|
|
|
|
|
|
nextItem->setZValue(nextItem->data(UBGraphicsItemData::ItemOwnZValue).toReal()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
mPointer->setZValue(2); |
|
|
|
mPointer->setZValue(maxZ + 0.0001); |
|
|
|
mPointer->show(); |
|
|
|
mPointer->show(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -824,8 +845,8 @@ void UBGraphicsScene::initPolygonItem(UBGraphicsPolygonItem* polygonItem) |
|
|
|
|
|
|
|
|
|
|
|
polygonItem->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Graphic)); |
|
|
|
polygonItem->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Graphic)); |
|
|
|
|
|
|
|
|
|
|
|
polygonItem->setZValue(getNextDrawingZIndex()); |
|
|
|
// polygonItem->setZValue(getNextDrawingZIndex());
|
|
|
|
|
|
|
|
UBGraphicsItem::assignZValue(polygonItem, getNextDrawingZIndex()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1035,7 +1056,8 @@ UBGraphicsPixmapItem* UBGraphicsScene::addPixmap(const QPixmap& pPixmap, const Q |
|
|
|
|
|
|
|
|
|
|
|
pixmapItem->setFlag(QGraphicsItem::ItemIsMovable, true); |
|
|
|
pixmapItem->setFlag(QGraphicsItem::ItemIsMovable, true); |
|
|
|
pixmapItem->setFlag(QGraphicsItem::ItemIsSelectable, true); |
|
|
|
pixmapItem->setFlag(QGraphicsItem::ItemIsSelectable, true); |
|
|
|
pixmapItem->setZValue(getNextObjectZIndex()); |
|
|
|
// pixmapItem->setZValue(getNextObjectZIndex());
|
|
|
|
|
|
|
|
UBGraphicsItem::assignZValue(pixmapItem, getNextObjectZIndex()); |
|
|
|
|
|
|
|
|
|
|
|
pixmapItem->setPixmap(pPixmap); |
|
|
|
pixmapItem->setPixmap(pPixmap); |
|
|
|
|
|
|
|
|
|
|
@ -1083,7 +1105,8 @@ UBGraphicsVideoItem* UBGraphicsScene::addVideo(const QUrl& pVideoFileUrl, bool s |
|
|
|
|
|
|
|
|
|
|
|
videoItem->setFlag(QGraphicsItem::ItemIsMovable, true); |
|
|
|
videoItem->setFlag(QGraphicsItem::ItemIsMovable, true); |
|
|
|
videoItem->setFlag(QGraphicsItem::ItemIsSelectable, true); |
|
|
|
videoItem->setFlag(QGraphicsItem::ItemIsSelectable, true); |
|
|
|
videoItem->setZValue(getNextObjectZIndex()); |
|
|
|
// videoItem->setZValue(getNextObjectZIndex());
|
|
|
|
|
|
|
|
UBGraphicsItem::assignZValue(videoItem, getNextObjectZIndex()); |
|
|
|
|
|
|
|
|
|
|
|
addItem(videoItem); |
|
|
|
addItem(videoItem); |
|
|
|
|
|
|
|
|
|
|
@ -1113,7 +1136,8 @@ UBGraphicsAudioItem* UBGraphicsScene::addAudio(const QUrl& pAudioFileUrl, bool s |
|
|
|
|
|
|
|
|
|
|
|
audioItem->setFlag(QGraphicsItem::ItemIsMovable, true); |
|
|
|
audioItem->setFlag(QGraphicsItem::ItemIsMovable, true); |
|
|
|
audioItem->setFlag(QGraphicsItem::ItemIsSelectable, true); |
|
|
|
audioItem->setFlag(QGraphicsItem::ItemIsSelectable, true); |
|
|
|
audioItem->setZValue(getNextObjectZIndex()); |
|
|
|
// audioItem->setZValue(getNextObjectZIndex());
|
|
|
|
|
|
|
|
UBGraphicsItem::assignZValue(audioItem, getNextObjectZIndex()); |
|
|
|
|
|
|
|
|
|
|
|
addItem(audioItem); |
|
|
|
addItem(audioItem); |
|
|
|
|
|
|
|
|
|
|
@ -1178,7 +1202,8 @@ UBGraphicsW3CWidgetItem* UBGraphicsScene::addW3CWidget(const QUrl& pWidgetUrl, c |
|
|
|
void UBGraphicsScene::addGraphicsWidget(UBGraphicsWidgetItem* graphicsWidget, const QPointF& pPos) |
|
|
|
void UBGraphicsScene::addGraphicsWidget(UBGraphicsWidgetItem* graphicsWidget, const QPointF& pPos) |
|
|
|
{ |
|
|
|
{ |
|
|
|
graphicsWidget->setFlag(QGraphicsItem::ItemIsSelectable, true); |
|
|
|
graphicsWidget->setFlag(QGraphicsItem::ItemIsSelectable, true); |
|
|
|
graphicsWidget->setZValue(getNextObjectZIndex()); |
|
|
|
// graphicsWidget->setZValue(getNextObjectZIndex());
|
|
|
|
|
|
|
|
UBGraphicsItem::assignZValue(graphicsWidget, getNextObjectZIndex()); |
|
|
|
|
|
|
|
|
|
|
|
addItem(graphicsWidget); |
|
|
|
addItem(graphicsWidget); |
|
|
|
|
|
|
|
|
|
|
@ -1238,7 +1263,8 @@ UBGraphicsSvgItem* UBGraphicsScene::addSvg(const QUrl& pSvgFileUrl, const QPoint |
|
|
|
|
|
|
|
|
|
|
|
svgItem->setFlag(QGraphicsItem::ItemIsMovable, true); |
|
|
|
svgItem->setFlag(QGraphicsItem::ItemIsMovable, true); |
|
|
|
svgItem->setFlag(QGraphicsItem::ItemIsSelectable, true); |
|
|
|
svgItem->setFlag(QGraphicsItem::ItemIsSelectable, true); |
|
|
|
svgItem->setZValue(getNextObjectZIndex()); |
|
|
|
// svgItem->setZValue(getNextObjectZIndex());
|
|
|
|
|
|
|
|
UBGraphicsItem::assignZValue(svgItem, getNextObjectZIndex()); |
|
|
|
|
|
|
|
|
|
|
|
qreal sscale = 1 / UBApplication::boardController->systemScaleFactor(); |
|
|
|
qreal sscale = 1 / UBApplication::boardController->systemScaleFactor(); |
|
|
|
svgItem->scale(sscale, sscale); |
|
|
|
svgItem->scale(sscale, sscale); |
|
|
@ -1271,7 +1297,8 @@ UBGraphicsTextItem* UBGraphicsScene::addTextWithFont(const QString& pString, con |
|
|
|
{ |
|
|
|
{ |
|
|
|
UBGraphicsTextItem *textItem = new UBGraphicsTextItem(); |
|
|
|
UBGraphicsTextItem *textItem = new UBGraphicsTextItem(); |
|
|
|
textItem->setPlainText(pString); |
|
|
|
textItem->setPlainText(pString); |
|
|
|
textItem->setZValue(getNextObjectZIndex()); |
|
|
|
// textItem->setZValue(getNextObjectZIndex());
|
|
|
|
|
|
|
|
UBGraphicsItem::assignZValue(textItem, getNextObjectZIndex()); |
|
|
|
|
|
|
|
|
|
|
|
QFont font = textItem->font(); |
|
|
|
QFont font = textItem->font(); |
|
|
|
|
|
|
|
|
|
|
@ -1326,7 +1353,8 @@ UBGraphicsTextItem *UBGraphicsScene::addTextHtml(const QString &pString, const Q |
|
|
|
UBGraphicsTextItem *textItem = new UBGraphicsTextItem(); |
|
|
|
UBGraphicsTextItem *textItem = new UBGraphicsTextItem(); |
|
|
|
textItem->setPlainText(""); |
|
|
|
textItem->setPlainText(""); |
|
|
|
textItem->setHtml(pString); |
|
|
|
textItem->setHtml(pString); |
|
|
|
textItem->setZValue(getNextObjectZIndex()); |
|
|
|
// textItem->setZValue(getNextObjectZIndex());
|
|
|
|
|
|
|
|
UBGraphicsItem::assignZValue(textItem, getNextObjectZIndex()); |
|
|
|
|
|
|
|
|
|
|
|
addItem(textItem); |
|
|
|
addItem(textItem); |
|
|
|
textItem->show(); |
|
|
|
textItem->show(); |
|
|
@ -1337,7 +1365,6 @@ UBGraphicsTextItem *UBGraphicsScene::addTextHtml(const QString &pString, const Q |
|
|
|
connect(textItem, SIGNAL(textUndoCommandAdded(UBGraphicsTextItem *)), |
|
|
|
connect(textItem, SIGNAL(textUndoCommandAdded(UBGraphicsTextItem *)), |
|
|
|
this, SLOT(textUndoCommandAdded(UBGraphicsTextItem *))); |
|
|
|
this, SLOT(textUndoCommandAdded(UBGraphicsTextItem *))); |
|
|
|
|
|
|
|
|
|
|
|
// textItem->setSelected(true);
|
|
|
|
|
|
|
|
textItem->setFocus(); |
|
|
|
textItem->setFocus(); |
|
|
|
|
|
|
|
|
|
|
|
setDocumentUpdated(); |
|
|
|
setDocumentUpdated(); |
|
|
@ -1425,7 +1452,8 @@ QGraphicsItem* UBGraphicsScene::setAsBackgroundObject(QGraphicsItem* item, bool |
|
|
|
item->setAcceptedMouseButtons(Qt::NoButton); |
|
|
|
item->setAcceptedMouseButtons(Qt::NoButton); |
|
|
|
item->setData(UBGraphicsItemData::ItemLayerType, UBItemLayerType::FixedBackground); |
|
|
|
item->setData(UBGraphicsItemData::ItemLayerType, UBItemLayerType::FixedBackground); |
|
|
|
|
|
|
|
|
|
|
|
item->setZValue(backgroundLayerStart); |
|
|
|
// item->setZValue(backgroundLayerStart);
|
|
|
|
|
|
|
|
UBGraphicsItem::assignZValue(item, backgroundLayerStart); |
|
|
|
|
|
|
|
|
|
|
|
if (pAdaptTransformation) |
|
|
|
if (pAdaptTransformation) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -1529,7 +1557,9 @@ void UBGraphicsScene::addRuler(QPointF center) |
|
|
|
QRectF rect = ruler->rect(); |
|
|
|
QRectF rect = ruler->rect(); |
|
|
|
ruler->setRect(center.x() - rect.width()/2, center.y() - rect.height()/2, rect.width(), rect.height()); |
|
|
|
ruler->setRect(center.x() - rect.width()/2, center.y() - rect.height()/2, rect.width(), rect.height()); |
|
|
|
|
|
|
|
|
|
|
|
ruler->setZValue(toolLayerStart + toolOffsetRuler); |
|
|
|
// ruler->setZValue(toolLayerStart + toolOffsetRuler);
|
|
|
|
|
|
|
|
UBGraphicsItem::assignZValue(ruler, toolLayerStart + toolOffsetRuler); |
|
|
|
|
|
|
|
|
|
|
|
ruler->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Tool)); |
|
|
|
ruler->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Tool)); |
|
|
|
|
|
|
|
|
|
|
|
addItem(ruler); |
|
|
|
addItem(ruler); |
|
|
@ -1546,7 +1576,9 @@ void UBGraphicsScene::addProtractor(QPointF center) |
|
|
|
UBGraphicsProtractor* protractor = new UBGraphicsProtractor(); // mem : owned and destroyed by the scene
|
|
|
|
UBGraphicsProtractor* protractor = new UBGraphicsProtractor(); // mem : owned and destroyed by the scene
|
|
|
|
mTools << protractor; |
|
|
|
mTools << protractor; |
|
|
|
|
|
|
|
|
|
|
|
protractor->setZValue(toolLayerStart + toolOffsetProtractor); |
|
|
|
// protractor->setZValue(toolLayerStart + toolOffsetProtractor);
|
|
|
|
|
|
|
|
UBGraphicsItem::assignZValue(protractor, toolLayerStart + toolOffsetProtractor); |
|
|
|
|
|
|
|
|
|
|
|
protractor->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Tool)); |
|
|
|
protractor->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Tool)); |
|
|
|
|
|
|
|
|
|
|
|
addItem(protractor); |
|
|
|
addItem(protractor); |
|
|
@ -1565,7 +1597,9 @@ void UBGraphicsScene::addTriangle(QPointF center) |
|
|
|
UBGraphicsTriangle* triangle = new UBGraphicsTriangle(); // mem : owned and destroyed by the scene
|
|
|
|
UBGraphicsTriangle* triangle = new UBGraphicsTriangle(); // mem : owned and destroyed by the scene
|
|
|
|
mTools << triangle; |
|
|
|
mTools << triangle; |
|
|
|
|
|
|
|
|
|
|
|
triangle->setZValue(toolLayerStart + toolOffsetProtractor); |
|
|
|
// triangle->setZValue(toolLayerStart + toolOffsetProtractor);
|
|
|
|
|
|
|
|
UBGraphicsItem::assignZValue(triangle, toolLayerStart + toolOffsetTriangle); |
|
|
|
|
|
|
|
|
|
|
|
triangle->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Tool)); |
|
|
|
triangle->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Tool)); |
|
|
|
|
|
|
|
|
|
|
|
addItem(triangle); |
|
|
|
addItem(triangle); |
|
|
@ -1700,7 +1734,9 @@ void UBGraphicsScene::addCompass(QPointF center) |
|
|
|
QRectF rect = compass->rect(); |
|
|
|
QRectF rect = compass->rect(); |
|
|
|
compass->setRect(center.x() - rect.width() / 2, center.y() - rect.height() / 2, rect.width(), rect.height()); |
|
|
|
compass->setRect(center.x() - rect.width() / 2, center.y() - rect.height() / 2, rect.width(), rect.height()); |
|
|
|
|
|
|
|
|
|
|
|
compass->setZValue(toolLayerStart + toolOffsetCompass); |
|
|
|
// compass->setZValue(toolLayerStart + toolOffsetCompass);
|
|
|
|
|
|
|
|
UBGraphicsItem::assignZValue(compass, toolLayerStart + toolOffsetCompass); |
|
|
|
|
|
|
|
|
|
|
|
compass->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Tool)); |
|
|
|
compass->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Tool)); |
|
|
|
|
|
|
|
|
|
|
|
compass->setVisible(true); |
|
|
|
compass->setVisible(true); |
|
|
@ -1740,7 +1776,10 @@ void UBGraphicsScene::addMask() |
|
|
|
view = (QGraphicsView*)UBApplication::boardController->controlView(); |
|
|
|
view = (QGraphicsView*)UBApplication::boardController->controlView(); |
|
|
|
|
|
|
|
|
|
|
|
QPolygonF polygon = view->mapToScene(view->rect()); |
|
|
|
QPolygonF polygon = view->mapToScene(view->rect()); |
|
|
|
curtain->setZValue(toolLayerStart + toolOffsetCurtain); |
|
|
|
|
|
|
|
|
|
|
|
// curtain->setZValue(toolLayerStart + toolOffsetCurtain);
|
|
|
|
|
|
|
|
UBGraphicsItem::assignZValue(curtain, toolLayerStart + toolOffsetCurtain); |
|
|
|
|
|
|
|
|
|
|
|
QRectF rect = polygon.boundingRect(); |
|
|
|
QRectF rect = polygon.boundingRect(); |
|
|
|
qreal xScale = view->matrix().m11(); |
|
|
|
qreal xScale = view->matrix().m11(); |
|
|
|
qreal yScale = view->matrix().m22(); |
|
|
|
qreal yScale = view->matrix().m22(); |
|
|
|