mirror of
https://github.com/mapmapteam/mapmap.git
synced 2026-06-16 12:33:19 +02:00
Merge branch 'develop' of github.com:mapmapteam/mapmap into develop
This commit is contained in:
@@ -145,6 +145,31 @@ QVector<Mapping::ptr> MappingManager::getVisibleMappings() const
|
||||
return visible;
|
||||
}
|
||||
|
||||
/// Returns true iff the mapping is visible.
|
||||
bool MappingManager::mappingIsVisible(Mapping::ptr mapping) const
|
||||
{
|
||||
// Solo mappings are always visible.
|
||||
if (mapping->isSolo())
|
||||
return true;
|
||||
|
||||
// Non-solo invisible mappings are always invisible.
|
||||
else if (!mapping->isVisible())
|
||||
return false;
|
||||
|
||||
// Mapping is non-solo yet visible: check if another mapping is solo (which would thus make it invisible).
|
||||
else
|
||||
{
|
||||
for (QVector<Mapping::ptr>::const_iterator it = mappingVector.begin(); it != mappingVector.end(); ++it)
|
||||
{
|
||||
if ((*it)->isSolo())
|
||||
return false;
|
||||
}
|
||||
|
||||
// Mapping is non-solo yet visible and there are no solo mappings.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
void MappingManager::reorderMappings(QVector<uid> mappingIds)
|
||||
{
|
||||
// Both vector needs to have the same size.
|
||||
|
||||
@@ -100,8 +100,12 @@ public:
|
||||
/// Reorders the mappings according to given list of uids. QVector needs to
|
||||
void reorderMappings(QVector<uid> mappingIds);
|
||||
|
||||
/// Returns the ordered list of visible mappings, using both the "visible" and "solo" properties.
|
||||
QVector<Mapping::ptr> getVisibleMappings() const;
|
||||
|
||||
/// Returns true iff the mapping is visible.
|
||||
bool mappingIsVisible(Mapping::ptr mapping) const;
|
||||
|
||||
void clearAll();
|
||||
};
|
||||
|
||||
|
||||
@@ -38,6 +38,10 @@ bool ShapeGraphicsItem::isMappingCurrent() const {
|
||||
return MainWindow::instance()->getCurrentMappingId() == getMapping()->getId();
|
||||
}
|
||||
|
||||
bool ShapeGraphicsItem::isMappingVisible() const {
|
||||
return MainWindow::instance()->getMappingManager().mappingIsVisible(getMapping());
|
||||
}
|
||||
|
||||
void ShapeGraphicsItem::paint(QPainter *painter,
|
||||
const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||
{
|
||||
|
||||
+1
-1
@@ -75,7 +75,7 @@ public:
|
||||
bool isMappingCurrent() const;
|
||||
|
||||
/// Returns whether the mapping this shape is associated should be visible.
|
||||
bool isMappingVisible() const { return getMapping()->isVisible(); }
|
||||
bool isMappingVisible() const;
|
||||
|
||||
/// Returns the bounding rectangle of this item.
|
||||
virtual QRectF boundingRect() const { return shape().boundingRect(); }
|
||||
|
||||
Reference in New Issue
Block a user