Merge branch 'OEFUniboard' into claudio-dev

preferencesAboutTextFull
Claudio Valerio 12 years ago
commit a1df8390cc
  1. 19
      src/domain/UBGraphicsScene.cpp
  2. 2
      src/domain/UBGraphicsScene.h
  3. 1
      src/domain/UBItem.cpp
  4. 11
      src/domain/UBSelectionFrame.cpp

@ -276,6 +276,18 @@ void UBZLayerController::setLayerType(QGraphicsItem *pItem, itemLayerType::Enum
pItem->setData(UBGraphicsItemData::itemLayerType, QVariant(pNewType)); pItem->setData(UBGraphicsItemData::itemLayerType, QVariant(pNewType));
} }
void UBZLayerController::shiftStoredZValue(QGraphicsItem *item, qreal zValue)
{
itemLayerType::Enum type = typeForData(item);
if (validLayerType(type)) {
ItemLayerTypeData typeData = scopeMap.value(type);
if (typeData.curValue < zValue) {
scopeMap[type].curValue = zValue;
}
}
}
UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent, bool enableUndoRedoStack) UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent, bool enableUndoRedoStack)
: UBCoreGraphicsScene(parent) : UBCoreGraphicsScene(parent)
, mEraser(0) , mEraser(0)
@ -1051,6 +1063,11 @@ UBBoardView *UBGraphicsScene::controlView()
return result; return result;
} }
void UBGraphicsScene::notifyZChanged(QGraphicsItem *item, qreal zValue)
{
mZLayerController->shiftStoredZValue(item, zValue);
}
void UBGraphicsScene::updateSelectionFrame() void UBGraphicsScene::updateSelectionFrame()
{ {
qDebug() << "selected item count" << selectedItems().count(); qDebug() << "selected item count" << selectedItems().count();
@ -1647,6 +1664,8 @@ void UBGraphicsScene::addItem(QGraphicsItem* item)
if(item->zValue() == DEFAULT_Z_VALUE || item->zValue() == UBZLayerController::errorNum()){ if(item->zValue() == DEFAULT_Z_VALUE || item->zValue() == UBZLayerController::errorNum()){
qreal zvalue = mZLayerController->generateZLevel(item); qreal zvalue = mZLayerController->generateZLevel(item);
UBGraphicsItem::assignZValue(item, zvalue); UBGraphicsItem::assignZValue(item, zvalue);
} else {
notifyZChanged(item, item->zValue());
} }
if (!mTools.contains(item)) if (!mTools.contains(item))

@ -96,6 +96,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); void setLayerType(QGraphicsItem *pItem, itemLayerType::Enum pNewType);
void shiftStoredZValue(QGraphicsItem *item, qreal zValue);
private: private:
ScopeMap scopeMap; ScopeMap scopeMap;
@ -311,6 +312,7 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
UBGraphicsPolygonItem* polygonToPolygonItem(const QPolygonF pPolygon); UBGraphicsPolygonItem* polygonToPolygonItem(const QPolygonF pPolygon);
void clearSelectionFrame(); void clearSelectionFrame();
UBBoardView *controlView(); UBBoardView *controlView();
void notifyZChanged(QGraphicsItem *item, qreal zValue);
public slots: public slots:

@ -32,6 +32,7 @@
#include "domain/UBGraphicsStrokesGroup.h" #include "domain/UBGraphicsStrokesGroup.h"
#include "domain/UBGraphicsGroupContainerItem.h" #include "domain/UBGraphicsGroupContainerItem.h"
#include "domain/UBGraphicsWidgetItem.h" #include "domain/UBGraphicsWidgetItem.h"
#include "domain/UBGraphicsScene.h"
#include "tools/UBGraphicsCurtainItem.h" #include "tools/UBGraphicsCurtainItem.h"
#include "domain/UBGraphicsItemDelegate.h" #include "domain/UBGraphicsItemDelegate.h"

@ -191,7 +191,7 @@ void UBSelectionFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
item->update(); item->update();
item->setTransform(ownTransform, false); item->setTransform(ownTransform, false);
int resultAngle = (int)mRotationAngle % 360; // int resultAngle = (int)mRotationAngle % 360;
// setCursorFromAngle(QString::number(resultAngle)); // setCursorFromAngle(QString::number(resultAngle));
qDebug() << "curAngle" << mRotationAngle; qDebug() << "curAngle" << mRotationAngle;
@ -284,9 +284,14 @@ void UBSelectionFrame::increaseZlevelDown()
void UBSelectionFrame::increaseZlevelBottom() void UBSelectionFrame::increaseZlevelBottom()
{ {
foreach (QGraphicsItem *item, sortedByZ(scene()->selectedItems())) { QListIterator<QGraphicsItem*> iter(sortedByZ(scene()->selectedItems()));
ubscene()->changeZLevelTo(item, UBZLayerController::bottom); iter.toBack();
while (iter.hasPrevious()) {
ubscene()->changeZLevelTo(iter.previous(), UBZLayerController::bottom);
} }
// foreach (QGraphicsItem *item, sortedByZ(scene()->selectedItems())) {
// ubscene()->changeZLevelTo(item, UBZLayerController::bottom);
// }
} }
void UBSelectionFrame::translateItem(QGraphicsItem */*item*/, const QPointF &/*translatePoint*/) void UBSelectionFrame::translateItem(QGraphicsItem */*item*/, const QPointF &/*translatePoint*/)

Loading…
Cancel
Save