实现高亮选中Layer
parent
8a34f57251
commit
f25f2d2a81
|
@ -13,8 +13,21 @@ LayerWrapper *LayerManager::getRoot() const
|
||||||
}
|
}
|
||||||
void LayerManager::paint(QPainter *painter, QSize size,LayerWrapper* selecetedLayer) const
|
void LayerManager::paint(QPainter *painter, QSize size,LayerWrapper* selecetedLayer) const
|
||||||
{
|
{
|
||||||
|
painter->save();
|
||||||
root->getCache();
|
root->getCache();
|
||||||
root->paint(painter);
|
root->paint(painter);
|
||||||
|
painter->restore();
|
||||||
|
painter->save();
|
||||||
|
// painter->setBrush(QBrush(Qt::white));
|
||||||
|
//painter->setCompositionMode(QPainter::CompositionMode_Difference);
|
||||||
|
if (selecetedLayer != nullptr)
|
||||||
|
{
|
||||||
|
painter->setPen(QPen(Qt::gray, 2, Qt::DashLine));
|
||||||
|
selecetedLayer->paintVisualBounding(painter);
|
||||||
|
//painter->setPen(QPen(Qt::gray, 2, Qt::DashDotLine));
|
||||||
|
//selecetedLayer->paintVisualBounding(painter);
|
||||||
|
}
|
||||||
|
painter->restore();
|
||||||
}
|
}
|
||||||
bool LayerManager::singleSelectedCheck() const
|
bool LayerManager::singleSelectedCheck() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -284,7 +284,14 @@ int FolderLayerWrapper::getReferencedBy()const
|
||||||
|
|
||||||
void LayerWrapper::paint(QPainter* painter, QTransform transform, bool force)
|
void LayerWrapper::paint(QPainter* painter, QTransform transform, bool force)
|
||||||
{
|
{
|
||||||
|
// if (this->selected)
|
||||||
|
// {
|
||||||
|
// painter->save();
|
||||||
|
//painter->setPen(QPen(Qt::red, 2));
|
||||||
|
//painter->setTransform(transform);
|
||||||
|
//painter->drawRect(this->cache.getBoundingRect());
|
||||||
|
//painter->restore();
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
void FolderLayerWrapper::paint(QPainter* painter, QTransform transform, bool force)
|
void FolderLayerWrapper::paint(QPainter* painter, QTransform transform, bool force)
|
||||||
|
@ -429,3 +436,20 @@ bool LayerWrapper::canApplyStyles() const
|
||||||
{
|
{
|
||||||
return typeid(*this) == typeid(LeafLayerWrapper) && !referencingGroupElement();
|
return typeid(*this) == typeid(LeafLayerWrapper) && !referencingGroupElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LayerWrapper::paintVisualBounding(QPainter* painter) const
|
||||||
|
{
|
||||||
|
if (hidden)
|
||||||
|
return;
|
||||||
|
QTransform transform;
|
||||||
|
auto layer = this->parent;
|
||||||
|
while (layer != nullptr)
|
||||||
|
{
|
||||||
|
transform = transform * layer->property.transform;
|
||||||
|
layer = layer->parent;
|
||||||
|
}
|
||||||
|
painter->save();
|
||||||
|
painter->setTransform(transform);
|
||||||
|
painter->drawRect(cache.getBoundingRect());
|
||||||
|
painter->restore();
|
||||||
|
}
|
|
@ -75,6 +75,7 @@ class LayerWrapper
|
||||||
virtual size_t referencedCount(bool excludeSelf = false) const;
|
virtual size_t referencedCount(bool excludeSelf = false) const;
|
||||||
virtual bool deleteable(bool excludeSubTree = false) const;
|
virtual bool deleteable(bool excludeSubTree = false) const;
|
||||||
virtual bool referencingGroupElement() const;
|
virtual bool referencingGroupElement() const;
|
||||||
|
virtual void paintVisualBounding(QPainter* painter) const;
|
||||||
bool canApplyStyles() const;
|
bool canApplyStyles() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,8 @@ PixelPath PixelPath::trans(QTransform& mat)const
|
||||||
painter.setTransform(mat);
|
painter.setTransform(mat);
|
||||||
painter.drawPixmap(0, 0, pixmap);
|
painter.drawPixmap(0, 0, pixmap);
|
||||||
result.painterPath.addPath(this->painterPath);
|
result.painterPath.addPath(this->painterPath);
|
||||||
result.boundingRect = mat.mapRect(boundingRect);
|
result.painterPath = mat.map(result.painterPath);
|
||||||
|
result.boundingRect = result.painterPath.boundingRect();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue