remove now unused QGraphicsItemPrivate bits

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2023-10-21 11:05:32 +03:00
parent 84dde53fd8
commit dc84af4866
8 changed files with 18 additions and 236 deletions

View file

@ -3,7 +3,7 @@
# https://wiki.archlinux.org/index.php/Arch_package_guidelines
pkgname=katie-git
pkgver=4.14.0.r8005.14dedd943
pkgver=4.14.0.r8111.84dde53fd
pkgrel=1
pkgdesc='C++ toolkit derived from the Qt 4.8 framework'
arch=('i486' 'i686' 'pentium4' 'x86_64' 'arm')

View file

@ -1117,7 +1117,6 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent, const Q
}
p->d_ptr->focusScopeItem = newFocusScopeItem;
newFocusScopeItem->d_ptr->focusScopeItemChange(true);
// Ensure the new item is no longer the subFocusItem. The
// only way to set focus on a child of a focus scope is
// by setting focus on the scope itself.
@ -1183,12 +1182,6 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent, const Q
}
dirtySceneTransform = true;
if (!inDestructor && (transformData || (newParent && newParent->d_ptr->transformData)))
transformChanged();
// Reparenting is finished, now safe to notify the previous focusScopeItem about changes
if (parentFocusScopeItem)
parentFocusScopeItem->d_ptr->focusScopeItemChange(false);
// Restore the sub focus chain.
if (subFocusItem) {
@ -2967,9 +2960,6 @@ void QGraphicsItemPrivate::setFocusHelper(Qt::FocusReason focusReason, bool clim
if (p->flags() & QGraphicsItem::ItemIsFocusScope) {
QGraphicsItem *oldFocusScopeItem = p->d_ptr->focusScopeItem;
p->d_ptr->focusScopeItem = q_ptr;
if (oldFocusScopeItem)
oldFocusScopeItem->d_ptr->focusScopeItemChange(false);
focusScopeItemChange(true);
if (!p->focusItem() && !focusFromHide) {
// Calling setFocus() on a child of a focus scope that does
// not have focus changes only the focus scope pointer,
@ -3041,8 +3031,6 @@ void QGraphicsItemPrivate::clearFocusHelper(bool giveFocusToParent)
if (p->flags() & QGraphicsItem::ItemIsFocusScope) {
if (p->d_ptr->focusScopeItem == q_ptr) {
p->d_ptr->focusScopeItem = 0;
if (!subFocusItem->hasFocus()) //if it has focus, focusScopeItemChange is called elsewhere
focusScopeItemChange(false);
}
if (subFocusItem->hasFocus())
p->d_ptr->setFocusHelper(Qt::OtherFocusReason, /* climb = */ false,
@ -3388,7 +3376,6 @@ void QGraphicsItemPrivate::setTransformHelper(const QTransform &transform)
q_ptr->prepareGeometryChange();
transformData->transform = transform;
dirtySceneTransform = true;
transformChanged();
}
/*!
@ -3583,8 +3570,6 @@ void QGraphicsItem::setRotation(qreal angle)
if (d_ptr->isObject)
emit static_cast<QGraphicsObject *>(this)->rotationChanged();
d_ptr->transformChanged();
}
/*!
@ -3649,8 +3634,6 @@ void QGraphicsItem::setScale(qreal factor)
if (d_ptr->isObject)
emit static_cast<QGraphicsObject *>(this)->scaleChanged();
d_ptr->transformChanged();
}
@ -3706,7 +3689,6 @@ void QGraphicsItem::setTransformations(const QList<QGraphicsTransform *> &transf
transformations.at(i)->d_func()->setItem(this);
d_ptr->transformData->onlyTransform = false;
d_ptr->dirtySceneTransform = true;
d_ptr->transformChanged();
}
/*!
@ -3723,7 +3705,6 @@ void QGraphicsItemPrivate::prependGraphicsTransform(QGraphicsTransform *t)
t->d_func()->setItem(q);
transformData->onlyTransform = false;
dirtySceneTransform = true;
transformChanged();
}
/*!
@ -3740,7 +3721,6 @@ void QGraphicsItemPrivate::appendGraphicsTransform(QGraphicsTransform *t)
t->d_func()->setItem(q);
transformData->onlyTransform = false;
dirtySceneTransform = true;
transformChanged();
}
/*!
@ -4415,12 +4395,6 @@ void QGraphicsItem::stackBefore(const QGraphicsItem *sibling)
++index;
}
d_ptr->siblingIndex = siblingIndex;
for (int i = 0; i < siblings->size(); ++i) {
int &index = siblings->at(i)->d_ptr->siblingIndex;
if (i != siblingIndex && index >= siblingIndex && index <= myIndex)
siblings->at(i)->d_ptr->siblingOrderChange();
}
d_ptr->siblingOrderChange();
}
}
@ -5248,27 +5222,6 @@ void QGraphicsItemPrivate::resetFocusProxy()
focusProxyRefs.clear();
}
/*!
\internal
Subclasses can reimplement this function to be notified when an item
becomes a focusScopeItem (or is no longer a focusScopeItem).
*/
void QGraphicsItemPrivate::focusScopeItemChange(bool isSubFocusItem)
{
Q_UNUSED(isSubFocusItem);
}
/*!
\internal
Subclasses can reimplement this function to be notified when its
siblingIndex order is changed.
*/
void QGraphicsItemPrivate::siblingOrderChange()
{
}
/*!
\internal

View file

@ -430,7 +430,6 @@ private:
friend class QGraphicsSceneIndexPrivate;
friend class QGraphicsSceneBspTreeIndex;
friend class QGraphicsSceneBspTreeIndexPrivate;
friend class QGraphicsItemEffectSourcePrivate;
friend class QGraphicsTransformPrivate;
friend class ::tst_QGraphicsItem;
friend bool qt_closestLeaf(const QGraphicsItem *, const QGraphicsItem *);

View file

@ -134,7 +134,6 @@ public:
ignoreOpacity(false),
filtersDescendantEvents(false),
sceneTransformTranslateOnly(false),
mouseSetsFocus(true),
explicitActivate(false),
wantsActive(false),
holesInSiblingIndex(false),
@ -145,7 +144,6 @@ public:
acceptedMouseButtons(Qt::LeftButton | Qt::RightButton | Qt::MiddleButton),
flags(0),
ancestorFlags(0),
globalStackingOrder(-1),
q_ptr(0)
{
}
@ -176,11 +174,11 @@ public:
void combineTransformToParent(QTransform *x, const QTransform *viewTransform = 0) const;
void combineTransformFromParent(QTransform *x, const QTransform *viewTransform = 0) const;
virtual void updateSceneTransformFromParent();
void updateSceneTransformFromParent();
static bool movableAncestorIsSelected(const QGraphicsItem *item);
virtual void setPosHelper(const QPointF &pos);
void setPosHelper(const QPointF &pos);
void setTransformHelper(const QTransform &transform);
void prependGraphicsTransform(QGraphicsTransform *t);
void appendGraphicsTransform(QGraphicsTransform *t);
@ -188,7 +186,6 @@ public:
void setEnabledHelper(bool newEnabled, bool explicitly, bool update = true);
bool discardUpdateRequest(bool ignoreVisibleBit = false,
bool ignoreDirtyBit = false, bool ignoreOpacity = false) const;
virtual void transformChanged() {}
int depth() const;
void invalidateDepthRecursively();
void resolveDepth();
@ -368,14 +365,12 @@ public:
void setSubFocus(QGraphicsItem *rootItem = 0, QGraphicsItem *stopItem = 0);
void clearSubFocus(QGraphicsItem *rootItem = 0, QGraphicsItem *stopItem = 0);
void resetFocusProxy();
virtual void focusScopeItemChange(bool isSubFocusItem);
inline QTransform transformToParent() const;
inline void ensureSortedChildren();
static inline bool insertionOrder(QGraphicsItem *a, QGraphicsItem *b);
void ensureSequentialSiblingIndex();
inline void sendScenePosChange();
virtual void siblingOrderChange();
QRectF childrenBoundingRect;
QRectF needsRepaint;
@ -428,7 +423,6 @@ public:
bool ignoreOpacity;
bool filtersDescendantEvents;
bool sceneTransformTranslateOnly;
bool mouseSetsFocus;
bool explicitActivate;
bool wantsActive;
bool holesInSiblingIndex;
@ -443,8 +437,6 @@ public:
QMap<int, QVariant> datastore;
// Optional stacking order
int globalStackingOrder;
QGraphicsItem *q_ptr;
};
@ -491,28 +483,6 @@ struct QGraphicsItemPrivate::TransformData
}
};
struct QGraphicsItemPaintInfo
{
inline QGraphicsItemPaintInfo(const QTransform *const xform1, const QTransform *const xform2,
const QTransform *const xform3,
QRegion *r, QWidget *w, QStyleOptionGraphicsItem *opt,
QPainter *p, qreal o, bool b1, bool b2)
: viewTransform(xform1), transformPtr(xform2), effectTransform(xform3), exposedRegion(r), widget(w),
option(opt), painter(p), opacity(o), wasDirtySceneTransform(b1), drawItem(b2)
{}
const QTransform *viewTransform;
const QTransform *transformPtr;
const QTransform *effectTransform;
QRegion *exposedRegion;
QWidget *widget;
QStyleOptionGraphicsItem *option;
QPainter *painter;
qreal opacity;
bool wasDirtySceneTransform;
bool drawItem;
};
/*!
Returns true if \a item1 is on top of \a item2.
The items don't need to be siblings.

View file

@ -1251,7 +1251,7 @@ void QGraphicsScenePrivate::mousePressEventHandler(QGraphicsSceneMouseEvent *mou
if (item->isEnabled() && ((item->flags() & QGraphicsItem::ItemIsFocusable))) {
if (!item->isWidget() || ((QGraphicsWidget *)item)->focusPolicy() & Qt::ClickFocus) {
setFocus = true;
if (item != q->focusItem() && item->d_ptr->mouseSetsFocus)
if (item != q->focusItem())
q->setFocusItem(item, Qt::MouseFocusReason);
break;
}
@ -4005,7 +4005,7 @@ void QGraphicsScene::wheelEvent(QGraphicsSceneWheelEvent *wheelEvent)
bool hasSetFocus = false;
foreach (QGraphicsItem *item, wheelCandidates) {
if (!hasSetFocus && item->isEnabled()
&& ((item->flags() & QGraphicsItem::ItemIsFocusable) && item->d_ptr->mouseSetsFocus)) {
&& (item->flags() & QGraphicsItem::ItemIsFocusable)) {
if (item->isWidget() && static_cast<QGraphicsWidget *>(item)->focusPolicy() == Qt::WheelFocus) {
hasSetFocus = true;
if (item != focusItem())

View file

@ -282,7 +282,6 @@ private:
friend class QGraphicsSceneIndexPrivate;
friend class QGraphicsSceneBspTreeIndex;
friend class QGraphicsSceneBspTreeIndexPrivate;
friend class QGraphicsItemEffectSourcePrivate;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QGraphicsScene::SceneLayers)

View file

@ -82,9 +82,7 @@ QGraphicsSceneBspTreeIndexPrivate::QGraphicsSceneBspTreeIndexPrivate(QGraphicsSc
restartIndexTimer(false),
regenerateIndex(true),
lastItemCount(0),
purgePending(false),
sortCacheEnabled(false),
updatingSortCache(false)
purgePending(false)
{
}
@ -97,7 +95,7 @@ QGraphicsSceneBspTreeIndexPrivate::QGraphicsSceneBspTreeIndexPrivate(QGraphicsSc
\internal
*/
void QGraphicsSceneBspTreeIndexPrivate::_q_updateIndex()
void QGraphicsSceneBspTreeIndexPrivate::updateIndex()
{
Q_Q(QGraphicsSceneBspTreeIndex);
if (!indexTimerId)
@ -216,70 +214,6 @@ void QGraphicsSceneBspTreeIndexPrivate::resetIndex()
startIndexTimer();
}
/*!
\internal
*/
void QGraphicsSceneBspTreeIndexPrivate::climbTree(QGraphicsItem *item, int *stackingOrder)
{
if (!item->d_ptr->children.isEmpty()) {
QList<QGraphicsItem *> childList = item->d_ptr->children;
qSort(childList.begin(), childList.end(), qt_closestLeaf);
for (int i = 0; i < childList.size(); ++i) {
QGraphicsItem *item = childList.at(i);
if (!(item->flags() & QGraphicsItem::ItemStacksBehindParent))
climbTree(childList.at(i), stackingOrder);
}
item->d_ptr->globalStackingOrder = (*stackingOrder)++;
for (int i = 0; i < childList.size(); ++i) {
QGraphicsItem *item = childList.at(i);
if (item->flags() & QGraphicsItem::ItemStacksBehindParent)
climbTree(childList.at(i), stackingOrder);
}
} else {
item->d_ptr->globalStackingOrder = (*stackingOrder)++;
}
}
/*!
\internal
*/
void QGraphicsSceneBspTreeIndexPrivate::_q_updateSortCache()
{
Q_Q(QGraphicsSceneBspTreeIndex);
_q_updateIndex();
if (!sortCacheEnabled || !updatingSortCache)
return;
updatingSortCache = false;
int stackingOrder = 0;
QList<QGraphicsItem *> topLevels;
const QList<QGraphicsItem *> items = q->items();
for (int i = 0; i < items.size(); ++i) {
QGraphicsItem *item = items.at(i);
if (item && !item->d_ptr->parent)
topLevels << item;
}
qSort(topLevels.begin(), topLevels.end(), qt_closestLeaf);
for (int i = 0; i < topLevels.size(); ++i)
climbTree(topLevels.at(i), &stackingOrder);
}
/*!
\internal
*/
void QGraphicsSceneBspTreeIndexPrivate::invalidateSortCache()
{
Q_Q(QGraphicsSceneBspTreeIndex);
if (!sortCacheEnabled || updatingSortCache)
return;
updatingSortCache = true;
QMetaObject::invokeMethod(q, "_q_updateSortCache", Qt::QueuedConnection);
}
void QGraphicsSceneBspTreeIndexPrivate::addItem(QGraphicsItem *item, bool recursive)
{
if (!item)
@ -288,11 +222,6 @@ void QGraphicsSceneBspTreeIndexPrivate::addItem(QGraphicsItem *item, bool recurs
// Prevent reusing a recently deleted pointer: purge all removed item from our lists.
purgeRemovedItems();
// Invalidate any sort caching; arrival of a new item means we need to resort.
// Update the scene's sort cache settings.
item->d_ptr->globalStackingOrder = -1;
invalidateSortCache();
// Indexing requires sceneBoundingRect(), but because \a item might
// not be completely constructed at this point, we need to store it in
// a temporary list and schedule an indexing for later.
@ -337,7 +266,6 @@ void QGraphicsSceneBspTreeIndexPrivate::removeItem(QGraphicsItem *item, bool rec
} else {
unindexedItems.removeOne(item);
}
invalidateSortCache(); // ### Only do this when removing from BSP?
Q_ASSERT(item->d_ptr->index == -1);
Q_ASSERT(!indexedItems.contains(item));
@ -361,7 +289,7 @@ QList<QGraphicsItem *> QGraphicsSceneBspTreeIndexPrivate::estimateItems(const QR
return q->QGraphicsSceneIndex::estimateTopLevelItems(rect, order);
purgeRemovedItems();
_q_updateSortCache();
updateIndex();
Q_ASSERT(unindexedItems.isEmpty());
QList<QGraphicsItem *> rectItems = bsp.items(rect, onlyTopLevelItems);
@ -380,7 +308,7 @@ QList<QGraphicsItem *> QGraphicsSceneBspTreeIndexPrivate::estimateItems(const QR
rectItems += untransformableItems;
}
sortItems(&rectItems, order, sortCacheEnabled, onlyTopLevelItems);
sortItems(&rectItems, order, onlyTopLevelItems);
return rectItems;
}
@ -390,7 +318,7 @@ QList<QGraphicsItem *> QGraphicsSceneBspTreeIndexPrivate::estimateItems(const QR
\internal
*/
void QGraphicsSceneBspTreeIndexPrivate::sortItems(QList<QGraphicsItem *> *itemList, Qt::SortOrder order,
bool sortCacheEnabled, bool onlyTopLevelItems)
bool onlyTopLevelItems)
{
if (order == Qt::SortOrder(-1))
return;
@ -403,18 +331,10 @@ void QGraphicsSceneBspTreeIndexPrivate::sortItems(QList<QGraphicsItem *> *itemLi
return;
}
if (sortCacheEnabled) {
if (order == Qt::DescendingOrder) {
qSort(itemList->begin(), itemList->end(), closestItemFirst_withCache);
} else if (order == Qt::AscendingOrder) {
qSort(itemList->begin(), itemList->end(), closestItemLast_withCache);
}
} else {
if (order == Qt::DescendingOrder) {
qSort(itemList->begin(), itemList->end(), qt_closestItemFirst);
} else if (order == Qt::AscendingOrder) {
qSort(itemList->begin(), itemList->end(), qt_closestItemLast);
}
if (order == Qt::DescendingOrder) {
qSort(itemList->begin(), itemList->end(), qt_closestItemFirst);
} else if (order == Qt::AscendingOrder) {
qSort(itemList->begin(), itemList->end(), qt_closestItemLast);
}
}
@ -548,7 +468,7 @@ QList<QGraphicsItem *> QGraphicsSceneBspTreeIndex::items(Qt::SortOrder order) co
}
}
d->sortItems(&itemList, order, d->sortCacheEnabled);
d->sortItems(&itemList, order);
return itemList;
}
@ -636,10 +556,8 @@ void QGraphicsSceneBspTreeIndex::itemChange(const QGraphicsItem *item, QGraphics
break;
}
case QGraphicsItem::ItemZValueChange:
d->invalidateSortCache();
break;
case QGraphicsItem::ItemParentChange: {
d->invalidateSortCache();
// Handle ItemIgnoresTransformations
const QGraphicsItem *newParent = static_cast<const QGraphicsItem *>(value);
bool ignoredTransform = item->d_ptr->itemIsUntransformable();
@ -679,7 +597,7 @@ bool QGraphicsSceneBspTreeIndex::event(QEvent *event)
d->restartIndexTimer = false;
} else {
// this call will kill the timer
d->_q_updateIndex();
d->updateIndex();
}
}
}

View file

@ -82,8 +82,6 @@ protected:
private :
Q_DECLARE_PRIVATE(QGraphicsSceneBspTreeIndex)
Q_DISABLE_COPY(QGraphicsSceneBspTreeIndex)
Q_PRIVATE_SLOT(d_func(), void _q_updateSortCache())
Q_PRIVATE_SLOT(d_func(), void _q_updateIndex())
friend class QGraphicsScene;
friend class QGraphicsScenePrivate;
@ -112,73 +110,18 @@ public:
QSet<QGraphicsItem *> removedItems;
void purgeRemovedItems();
void _q_updateIndex();
void updateIndex();
void startIndexTimer(int interval = QGRAPHICSSCENE_INDEXTIMER_TIMEOUT);
void resetIndex();
void _q_updateSortCache();
bool sortCacheEnabled;
bool updatingSortCache;
void invalidateSortCache();
void addItem(QGraphicsItem *item, bool recursive = false);
void removeItem(QGraphicsItem *item, bool recursive = false, bool moveToUnindexedItems = false);
QList<QGraphicsItem *> estimateItems(const QRectF &, Qt::SortOrder, bool b = false);
static void climbTree(QGraphicsItem *item, int *stackingOrder);
static inline bool closestItemFirst_withCache(const QGraphicsItem *item1, const QGraphicsItem *item2)
{
return item1->d_ptr->globalStackingOrder < item2->d_ptr->globalStackingOrder;
}
static inline bool closestItemLast_withCache(const QGraphicsItem *item1, const QGraphicsItem *item2)
{
return item1->d_ptr->globalStackingOrder >= item2->d_ptr->globalStackingOrder;
}
static void sortItems(QList<QGraphicsItem *> *itemList, Qt::SortOrder order,
bool cached, bool onlyTopLevelItems = false);
bool onlyTopLevelItems = false);
};
static inline bool QRectF_intersects(const QRectF &s, const QRectF &r)
{
qreal xp = s.left();
qreal yp = s.top();
qreal w = s.width();
qreal h = s.height();
qreal l1 = xp;
qreal r1 = xp;
if (w < 0)
l1 += w;
else
r1 += w;
qreal l2 = r.left();
qreal r2 = r.left();
if (w < 0)
l2 += r.width();
else
r2 += r.width();
if (l1 >= r2 || l2 >= r1)
return false;
qreal t1 = yp;
qreal b1 = yp;
if (h < 0)
t1 += h;
else
b1 += h;
qreal t2 = r.top();
qreal b2 = r.top();
if (r.height() < 0)
t2 += r.height();
else
b2 += r.height();
return !(t1 >= b2 || t2 >= b1);
}
QT_END_NAMESPACE
#endif // QT_NO_GRAPHICSVIEW