| 156 | } |
| 157 | |
| 158 | void BusyIndicator::paintEvent(QPaintEvent *) |
| 159 | { |
| 160 | QString key = QString("%1:%2:%3:%4:%5") |
| 161 | .arg(metaObject()->className()) |
| 162 | .arg(width()) |
| 163 | .arg(height()) |
| 164 | .arg(startAngle) |
| 165 | .arg(m_style); |
| 166 | |
| 167 | QPixmap pixmap; |
| 168 | pixmap.setDevicePixelRatio(devicePixelRatioF()); |
| 169 | QPainter painter(this); |
| 170 | painter.setRenderHint(QPainter::Antialiasing); |
| 171 | |
| 172 | int side = qMin(width(), height()); |
| 173 | |
| 174 | if (!QPixmapCache::find(key, &pixmap)) { |
| 175 | pixmap = generatePixmap(side * devicePixelRatioF()); |
| 176 | QPixmapCache::insert(key, pixmap); |
| 177 | } |
| 178 | |
| 179 | painter.translate(width() / 2 - side / 2, height() / 2 - side / 2); |
| 180 | |
| 181 | painter.drawPixmap(0, 0, side, side, pixmap); |
| 182 | } |
| 183 | |
| 184 | QSize BusyIndicator::minimumSizeHint() const |
| 185 | { |