void QGraphicsWidgetPrivate::updateFont(const QFont &font) { Q_Q(QGraphicsWidget); // Update the local font setting. this->font = font; // Calculate new mask. if (q->isWindow() && !q->testAttribute(Qt::WA_WindowPropagation)) inheritedFontResolveMask = 0; int mask = font.resolve() | inheritedFontResolveMask; // Propagate to children. for (int i = 0; i < children.size(); ++i) { QGraphicsItem *item = children.at(i); if (item->isWidget()) { QGraphicsWidget *w = static_cast<QGraphicsWidget *>(item); if (!w->isWindow() || w->testAttribute(Qt::WA_WindowPropagation)) w->d_func()->resolveFont(mask); } else { item->d_ptr->resolveFont(mask); } } if (!polished) return; // Notify change. QEvent event(QEvent::FontChange); QApplication::sendEvent(q, &event); }
void QGraphicsWidgetPrivate::updatePalette(const QPalette &palette) { Q_Q(QGraphicsWidget); // Update local palette setting. this->palette = palette; // Calculate new mask. if (q->isWindow() && !q->testAttribute(Qt::WA_WindowPropagation)) inheritedPaletteResolveMask = 0; int mask = palette.resolve() | inheritedPaletteResolveMask; // Propagate to children. for (int i = 0; i < children.size(); ++i) { QGraphicsItem *item = children.at(i); if (item->isWidget()) { QGraphicsWidget *w = static_cast<QGraphicsWidget *>(item); if (!w->isWindow() || w->testAttribute(Qt::WA_WindowPropagation)) w->d_func()->resolvePalette(mask); } else { item->d_ptr->resolvePalette(mask); } } // Notify change. QEvent event(QEvent::PaletteChange); QApplication::sendEvent(q, &event); }
/*! \internal */ void QGraphicsWidgetPrivate::clearFocusWidget() { // Reset focus child chain. QGraphicsWidget *parent = static_cast<QGraphicsWidget *>(q_ptr); do { if (parent->d_func()->focusChild != q_ptr) break; parent->d_func()->focusChild = 0; } while (!parent->isWindow() && (parent = parent->parentWidget())); }
/*! \internal */ void QGraphicsWidgetPrivate::setFocusWidget() { // Update focus child chain. QGraphicsWidget *widget = static_cast<QGraphicsWidget *>(q_ptr); QGraphicsWidget *parent = widget; bool hidden = !visible; do { parent->d_func()->focusChild = widget; } while (!parent->isWindow() && (parent = parent->parentWidget()) && (!hidden || !parent->d_func()->visible)); }