mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-24 19:02:59 +00:00
deal with TODO related to QGraphicsItem data store
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
25aa050192
commit
2de3cc02e2
2 changed files with 6 additions and 18 deletions
|
@ -734,16 +734,6 @@ static inline void _q_adjustRect(QRect *rect)
|
||||||
rect->adjust(0, 0, 0, 1);
|
rect->adjust(0, 0, 0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
### Move this into QGraphicsItemPrivate
|
|
||||||
*/
|
|
||||||
class QGraphicsItemCustomDataStore
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
QMap<const QGraphicsItem *, QMap<int, QVariant> > data;
|
|
||||||
};
|
|
||||||
Q_GLOBAL_STATIC(QGraphicsItemCustomDataStore, qt_dataStore)
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\internal
|
\internal
|
||||||
|
|
||||||
|
@ -1439,9 +1429,6 @@ QGraphicsItem::~QGraphicsItem()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete d_ptr->transformData;
|
delete d_ptr->transformData;
|
||||||
|
|
||||||
if (QGraphicsItemCustomDataStore *dataStore = qt_dataStore())
|
|
||||||
dataStore->data.remove(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -6343,10 +6330,8 @@ bool QGraphicsItem::isUnderMouse() const
|
||||||
*/
|
*/
|
||||||
QVariant QGraphicsItem::data(int key) const
|
QVariant QGraphicsItem::data(int key) const
|
||||||
{
|
{
|
||||||
QGraphicsItemCustomDataStore *store = qt_dataStore();
|
Q_D(const QGraphicsItem);
|
||||||
if (!store->data.contains(this))
|
return d->datastore.value(key);
|
||||||
return QVariant();
|
|
||||||
return store->data.value(this).value(key);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -6360,7 +6345,8 @@ QVariant QGraphicsItem::data(int key) const
|
||||||
*/
|
*/
|
||||||
void QGraphicsItem::setData(int key, const QVariant &value)
|
void QGraphicsItem::setData(int key, const QVariant &value)
|
||||||
{
|
{
|
||||||
qt_dataStore()->data[this][key] = value;
|
Q_D(QGraphicsItem);
|
||||||
|
d->datastore[key] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
|
@ -541,6 +541,8 @@ public:
|
||||||
QGraphicsItem::GraphicsItemFlags flags;
|
QGraphicsItem::GraphicsItemFlags flags;
|
||||||
uint ancestorFlags;
|
uint ancestorFlags;
|
||||||
|
|
||||||
|
QMap<int, QVariant> datastore;
|
||||||
|
|
||||||
// Optional stacking order
|
// Optional stacking order
|
||||||
int globalStackingOrder;
|
int globalStackingOrder;
|
||||||
QGraphicsItem *q_ptr;
|
QGraphicsItem *q_ptr;
|
||||||
|
|
Loading…
Add table
Reference in a new issue