MCPcopy Create free account
hub / github.com/KDAB/GammaRay / updateItemFlags

Method updateItemFlags

plugins/quickinspector/quickitemmodel.cpp:395–437  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

393}
394
395void QuickItemModel::updateItemFlags(QQuickItem *item)
396{
397 QQuickItem *ancestor = item->parentItem();
398 bool outOfView = false;
399 bool partiallyOutOfView = false;
400
401 auto rect = item->mapRectToScene(QRectF(0, 0, item->width(), item->height()));
402
403 if (item->isVisible()) {
404 while (ancestor && ancestor != m_window->contentItem()) {
405 if (ancestor->parentItem() == m_window->contentItem() || ancestor->clip()) {
406 auto ancestorRect = ancestor->mapRectToScene(QRectF(0, 0, ancestor->width(), ancestor->height()));
407
408 partiallyOutOfView |= !ancestorRect.contains(rect);
409 outOfView = partiallyOutOfView && !rect.intersects(ancestorRect);
410
411 if (outOfView) {
412 break;
413 }
414 }
415 ancestor = ancestor->parentItem();
416 }
417 }
418
419 m_itemFlags[item] = (!item->isVisible() || item->opacity() == 0
420 ? QuickItemModelRole::Invisible
421 : QuickItemModelRole::None)
422 | (item->width() == 0 || item->height() == 0
423 ? QuickItemModelRole::ZeroSize
424 : QuickItemModelRole::None)
425 | (partiallyOutOfView
426 ? QuickItemModelRole::PartiallyOutOfView
427 : QuickItemModelRole::None)
428 | (outOfView
429 ? QuickItemModelRole::OutOfView
430 : QuickItemModelRole::None)
431 | (item->hasFocus()
432 ? QuickItemModelRole::HasFocus
433 : QuickItemModelRole::None)
434 | (item->hasActiveFocus()
435 ? QuickItemModelRole::HasActiveFocus
436 : QuickItemModelRole::None);
437}
438
439QuickEventMonitor::QuickEventMonitor(QuickItemModel *parent)
440 : QObject(parent)

Callers

nothing calls this directly

Calls 3

QRectFClass · 0.50
isVisibleMethod · 0.45
clipMethod · 0.45

Tested by

no test coverage detected