Commit 61c63195 authored by Ilia Ryabokon's avatar Ilia Ryabokon

Sankore-1001 Background never get object zlayer anymore. BordView dropEvent fix

parent 4772233b
...@@ -1319,14 +1319,20 @@ void UBBoardView::dragMoveEvent(QDragMoveEvent *event) ...@@ -1319,14 +1319,20 @@ void UBBoardView::dragMoveEvent(QDragMoveEvent *event)
void UBBoardView::dropEvent (QDropEvent *event) void UBBoardView::dropEvent (QDropEvent *event)
{ {
if (!itemAt(event->pos().x(),event->pos().y())) { QGraphicsItem *onItem = itemAt(event->pos().x(),event->pos().y());
if (!event->source() || dynamic_cast<UBThumbnailWidget *>(event->source()) || dynamic_cast<QWebView*>(event->source()) || dynamic_cast<UBTGMediaWidget*>(event->source()) || dynamic_cast<QListView *>(event->source()) || dynamic_cast<UBTGDraggableTreeItem*>(event->source())) { if (onItem && onItem->type() == UBGraphicsWidgetItem::Type) {
QGraphicsView::dropEvent(event);
} else {
if (!event->source()
|| qobject_cast<UBThumbnailWidget *>(event->source())
|| qobject_cast<QWebView*>(event->source())
|| qobject_cast<UBTGMediaWidget*>(event->source())
|| qobject_cast<QListView *>(event->source())
|| qobject_cast<UBTGDraggableTreeItem*>(event->source())) {
mController->processMimeData (event->mimeData (), mapToScene (event->pos ())); mController->processMimeData (event->mimeData (), mapToScene (event->pos ()));
event->acceptProposedAction(); event->acceptProposedAction();
} }
} }
else
QGraphicsView::dropEvent(event);
} }
void void
......
...@@ -249,6 +249,11 @@ itemLayerType::Enum UBZLayerController::typeForData(QGraphicsItem *item) const ...@@ -249,6 +249,11 @@ itemLayerType::Enum UBZLayerController::typeForData(QGraphicsItem *item) const
return result; return result;
} }
void UBZLayerController::setLayerType(QGraphicsItem *pItem, itemLayerType::Enum pNewType)
{
pItem->setData(UBGraphicsItemData::itemLayerType, QVariant(pNewType));
}
UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent) UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent)
: UBCoreGraphicsScene(parent) : UBCoreGraphicsScene(parent)
, mEraser(0) , mEraser(0)
...@@ -1637,8 +1642,6 @@ QGraphicsItem* UBGraphicsScene::setAsBackgroundObject(QGraphicsItem* item, bool ...@@ -1637,8 +1642,6 @@ 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);
UBGraphicsItem::assignZValue(item, mZLayerController->generateZLevel(itemLayerType::BackgroundItem));
if (pAdaptTransformation) if (pAdaptTransformation)
{ {
item = scaleToFitDocumentSize(item, true, 0, pExpand); item = scaleToFitDocumentSize(item, true, 0, pExpand);
...@@ -1647,6 +1650,9 @@ QGraphicsItem* UBGraphicsScene::setAsBackgroundObject(QGraphicsItem* item, bool ...@@ -1647,6 +1650,9 @@ QGraphicsItem* UBGraphicsScene::setAsBackgroundObject(QGraphicsItem* item, bool
if (item->scene() != this) if (item->scene() != this)
addItem(item); addItem(item);
mZLayerController->setLayerType(item, itemLayerType::BackgroundItem);
UBGraphicsItem::assignZValue(item, mZLayerController->generateZLevel(item));
mBackgroundObject = item; mBackgroundObject = item;
} }
......
...@@ -87,6 +87,7 @@ public: ...@@ -87,6 +87,7 @@ public:
qreal changeZLevelTo(QGraphicsItem *item, moveDestination dest); qreal changeZLevelTo(QGraphicsItem *item, moveDestination dest);
itemLayerType::Enum typeForData(QGraphicsItem *item) const; itemLayerType::Enum typeForData(QGraphicsItem *item) const;
void setLayerType(QGraphicsItem *pItem, itemLayerType::Enum pNewType);
private: private:
ScopeMap scopeMap; ScopeMap scopeMap;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment