Merge branch 'aleksei_kanash_dev' into develop

preferencesAboutTextFull
Aleksei Kanash 12 years ago
commit 98b639bc42
  1. 12
      src/board/UBBoardController.cpp
  2. 18
      src/domain/UBGraphicsPolygonItem.cpp
  3. 2
      src/domain/UBGraphicsScene.cpp
  4. 13
      src/domain/UBGraphicsStrokesGroup.cpp

@ -553,15 +553,15 @@ void UBBoardController::duplicateItem(UBItem *item)
qreal shifting = UBSettings::settings()->objectFrameWidth; qreal shifting = UBSettings::settings()->objectFrameWidth;
itemPos = commonItem->pos() + QPointF(shifting,shifting); itemPos = commonItem->pos() + QPointF(shifting,shifting);
itemSize = commonItem->boundingRect().size(); itemSize = commonItem->boundingRect().size();
commonItem->setSelected(false);
} }
UBMimeType::Enum itemMimeType; UBMimeType::Enum itemMimeType;
QString contentTypeHeader = UBFileSystemUtils::mimeTypeFromFileName(item->sourceUrl().toLocalFile()); QString contentTypeHeader = UBFileSystemUtils::mimeTypeFromFileName(item->sourceUrl().toLocalFile());
if(NULL != qgraphicsitem_cast<UBGraphicsGroupContainerItem*>(commonItem)){ if(NULL != qgraphicsitem_cast<UBGraphicsGroupContainerItem*>(commonItem))
itemMimeType = UBMimeType::Group; itemMimeType = UBMimeType::Group;
}else{ else
itemMimeType = UBFileSystemUtils::mimeTypeFromString(contentTypeHeader); itemMimeType = UBFileSystemUtils::mimeTypeFromString(contentTypeHeader);
}
switch(static_cast<int>(itemMimeType)) switch(static_cast<int>(itemMimeType))
{ {
@ -633,10 +633,10 @@ void UBBoardController::duplicateItem(UBItem *item)
QGraphicsItem *gitem = dynamic_cast<QGraphicsItem*>(item->deepCopy()); QGraphicsItem *gitem = dynamic_cast<QGraphicsItem*>(item->deepCopy());
if (gitem) if (gitem)
{ {
qDebug() << "Adding a stroke: " << gitem;
mActiveScene->addItem(gitem); mActiveScene->addItem(gitem);
gitem->setPos(itemPos); gitem->setPos(itemPos);
mLastCreatedItem = gitem; mLastCreatedItem = gitem;
gitem->setSelected(true);
} }
return; return;
}break; }break;

@ -143,13 +143,13 @@ QColor UBGraphicsPolygonItem::color() const
UBItem* UBGraphicsPolygonItem::deepCopy() const UBItem* UBGraphicsPolygonItem::deepCopy() const
{ {
UBGraphicsPolygonItem* copy = new UBGraphicsPolygonItem(polygon(), parentItem()); UBGraphicsPolygonItem* copy = new UBGraphicsPolygonItem(polygon(), 0);
UBGraphicsStroke *stroke = new UBGraphicsStroke();
copyItemParameters(copy); copyItemParameters(copy);
copy->mOriginalLine = this->mOriginalLine; copy->setStroke(stroke);
copy->mOriginalWidth = this->mOriginalWidth;
copy->mIsNominalLine = this->mIsNominalLine;
return copy; return copy;
} }
@ -160,17 +160,15 @@ void UBGraphicsPolygonItem::copyItemParameters(UBItem *copy) const
UBGraphicsPolygonItem *cp = dynamic_cast<UBGraphicsPolygonItem*>(copy); UBGraphicsPolygonItem *cp = dynamic_cast<UBGraphicsPolygonItem*>(copy);
if (cp) if (cp)
{ {
cp->mOriginalLine = QLineF(); cp->mOriginalLine = this->mOriginalLine;
cp->mOriginalWidth = -1; cp->mOriginalWidth = this->mOriginalWidth;
cp->mIsNominalLine = false; cp->mIsNominalLine = this->mIsNominalLine;
cp->setStroke(this->stroke()); cp->setTransform(transform());
cp->setStrokesGroup(this->strokesGroup());
cp->setBrush(this->brush()); cp->setBrush(this->brush());
cp->setPen(this->pen()); cp->setPen(this->pen());
cp->mHasAlpha = this->mHasAlpha; cp->mHasAlpha = this->mHasAlpha;
cp->setColorOnDarkBackground(this->colorOnDarkBackground()); cp->setColorOnDarkBackground(this->colorOnDarkBackground());
cp->setColorOnLightBackground(this->colorOnLightBackground()); cp->setColorOnLightBackground(this->colorOnLightBackground());

@ -1615,6 +1615,7 @@ void UBGraphicsScene::addItems(const QSet<QGraphicsItem*>& items)
void UBGraphicsScene::removeItem(QGraphicsItem* item) void UBGraphicsScene::removeItem(QGraphicsItem* item)
{ {
setModified(true); setModified(true);
item->setSelected(false);
UBCoreGraphicsScene::removeItem(item); UBCoreGraphicsScene::removeItem(item);
UBApplication::boardController->freezeW3CWidget(item, true); UBApplication::boardController->freezeW3CWidget(item, true);
@ -2235,7 +2236,6 @@ void UBGraphicsScene::keyReleaseEvent(QKeyEvent * keyEvent)
default: default:
{ {
item->setSelected(false);
UBGraphicsItem *ubgi = dynamic_cast<UBGraphicsItem*>(item); UBGraphicsItem *ubgi = dynamic_cast<UBGraphicsItem*>(item);
if (0 != ubgi) if (0 != ubgi)
ubgi->remove(); ubgi->remove();

@ -65,29 +65,30 @@ void UBGraphicsStrokesGroup::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
UBItem* UBGraphicsStrokesGroup::deepCopy() const UBItem* UBGraphicsStrokesGroup::deepCopy() const
{ {
UBGraphicsStrokesGroup* copy = new UBGraphicsStrokesGroup(); UBGraphicsStrokesGroup* copy = new UBGraphicsStrokesGroup();
QList<QGraphicsItem*> chl = childItems();
QList<QGraphicsItem*> chl = childItems();
foreach(QGraphicsItem *child, chl) foreach(QGraphicsItem *child, chl)
{ {
UBGraphicsPolygonItem *polygon = dynamic_cast<UBGraphicsPolygonItem*>(child); UBGraphicsPolygonItem *polygon = dynamic_cast<UBGraphicsPolygonItem*>(child);
if (polygon) if (polygon)
{
copy->addToGroup(dynamic_cast<QGraphicsItem*>(polygon->deepCopy())); copy->addToGroup(dynamic_cast<QGraphicsItem*>(polygon->deepCopy()));
polygon->setStrokesGroup(copy);
}
} }
copyItemParameters(copy); copyItemParameters(copy);
return copy; return copy;
} }
void UBGraphicsStrokesGroup::copyItemParameters(UBItem *copy) const void UBGraphicsStrokesGroup::copyItemParameters(UBItem *copy) const
{ {
UBGraphicsStrokesGroup *cp = dynamic_cast<UBGraphicsStrokesGroup*>(copy); UBGraphicsStrokesGroup *cp = dynamic_cast<UBGraphicsStrokesGroup*>(copy);
{ {
cp->setPos(this->pos()); cp->setTransform(transform());
cp->setTransform(this->transform());
cp->setFlag(QGraphicsItem::ItemIsMovable, true); cp->setFlag(QGraphicsItem::ItemIsMovable, true);
cp->setFlag(QGraphicsItem::ItemIsSelectable, true); cp->setFlag(QGraphicsItem::ItemIsSelectable, true);
cp->setData(UBGraphicsItemData::ItemLayerType, this->data(UBGraphicsItemData::ItemLayerType)); cp->setData(UBGraphicsItemData::ItemLayerType, this->data(UBGraphicsItemData::ItemLayerType));

Loading…
Cancel
Save