19void QQuickUniversalFocusRectangle::paint(QPainter *painter)
21 if (!isVisible() || width() <= 0 || height() <= 0)
24 QRect bounds = boundingRect().toAlignedRect();
25 const int boundsWidth = bounds.width();
26 const int boundsHeight = bounds.width();
27 const QString key = QStringLiteral(
"qquickuniversalfocusrectangle_%1_%2").arg(QString::number(boundsWidth), QString::number(boundsHeight));
29 QPixmap pixmap(boundsWidth, boundsHeight);
30 if (!QPixmapCache::find(key, &pixmap)) {
31 bounds.adjust(0, 0, -1, -1);
32 pixmap.fill(Qt::transparent);
37 pen.setColor(Qt::white);
41 pen.setColor(Qt::black);
42 pen.setDashPattern(QList<qreal>(2, 1));
46 QPixmapCache::insert(key, pixmap);
48 painter->drawPixmap(0, 0, pixmap);