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

preferencesAboutTextFull
Ilia Ryabokon 12 years ago
parent 4772233b60
commit 61c6319579
  1. 20
      src/board/UBBoardView.cpp
  2. 10
      src/domain/UBGraphicsScene.cpp
  3. 1
      src/domain/UBGraphicsScene.h

@ -1319,14 +1319,20 @@ void UBBoardView::dragMoveEvent(QDragMoveEvent *event)
void UBBoardView::dropEvent (QDropEvent *event)
{
if (!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())) {
mController->processMimeData (event->mimeData (), mapToScene (event->pos ()));
event->acceptProposedAction();
QGraphicsItem *onItem = itemAt(event->pos().x(),event->pos().y());
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 ()));
event->acceptProposedAction();
}
}
}
else
QGraphicsView::dropEvent(event);
}
void

@ -249,6 +249,11 @@ itemLayerType::Enum UBZLayerController::typeForData(QGraphicsItem *item) const
return result;
}
void UBZLayerController::setLayerType(QGraphicsItem *pItem, itemLayerType::Enum pNewType)
{
pItem->setData(UBGraphicsItemData::itemLayerType, QVariant(pNewType));
}
UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent)
: UBCoreGraphicsScene(parent)
, mEraser(0)
@ -1637,8 +1642,6 @@ QGraphicsItem* UBGraphicsScene::setAsBackgroundObject(QGraphicsItem* item, bool
item->setAcceptedMouseButtons(Qt::NoButton);
item->setData(UBGraphicsItemData::ItemLayerType, UBItemLayerType::FixedBackground);
UBGraphicsItem::assignZValue(item, mZLayerController->generateZLevel(itemLayerType::BackgroundItem));
if (pAdaptTransformation)
{
item = scaleToFitDocumentSize(item, true, 0, pExpand);
@ -1647,6 +1650,9 @@ QGraphicsItem* UBGraphicsScene::setAsBackgroundObject(QGraphicsItem* item, bool
if (item->scene() != this)
addItem(item);
mZLayerController->setLayerType(item, itemLayerType::BackgroundItem);
UBGraphicsItem::assignZValue(item, mZLayerController->generateZLevel(item));
mBackgroundObject = item;
}

@ -87,6 +87,7 @@ public:
qreal changeZLevelTo(QGraphicsItem *item, moveDestination dest);
itemLayerType::Enum typeForData(QGraphicsItem *item) const;
void setLayerType(QGraphicsItem *pItem, itemLayerType::Enum pNewType);
private:
ScopeMap scopeMap;

Loading…
Cancel
Save