This commit is contained in:
Your Name
2024-05-17 11:27:44 -05:00
parent 08f5937937
commit 86fa173408

View File

@@ -14,32 +14,32 @@
#include "common/timing.h"
#include "selfdrive/ui/qt/util.h"
static void drawIcon(QPainter &p, const QPoint &center, const QPixmap &img, const QBrush &bg, float opacity, const int angle = 0) {
p.setRenderHint(QPainter::Antialiasing);
p.setOpacity(1.0); // bg dictates opacity of ellipse
p.setPen(Qt::NoPen);
p.setBrush(bg);
p.drawEllipse(center, btn_size / 2, btn_size / 2);
p.save();
p.translate(center);
p.rotate(-angle);
p.setOpacity(opacity);
p.drawPixmap(-QPoint(img.width() / 2, img.height() / 2), img);
p.setOpacity(1.0);
p.restore();
}
// static void drawIcon(QPainter &p, const QPoint &center, const QPixmap &img, const QBrush &bg, float opacity, const int angle = 0) {
// p.setRenderHint(QPainter::Antialiasing);
// p.setOpacity(1.0); // bg dictates opacity of ellipse
// p.setPen(Qt::NoPen);
// p.setBrush(bg);
// p.drawEllipse(center, btn_size / 2, btn_size / 2);
// p.save();
// p.translate(center);
// p.rotate(-angle);
// p.setOpacity(opacity);
// p.drawPixmap(-QPoint(img.width() / 2, img.height() / 2), img);
// p.setOpacity(1.0);
// p.restore();
// }
static void drawIconGif(QPainter &p, const QPoint &center, const QMovie &img, const QBrush &bg, float opacity) {
p.setRenderHint(QPainter::Antialiasing);
p.setOpacity(1.0); // bg dictates opacity of ellipse
p.setPen(Qt::NoPen);
p.setBrush(bg);
p.drawEllipse(center.x() - btn_size / 2, center.y() - btn_size / 2, btn_size, btn_size);
p.setOpacity(opacity);
QPixmap currentFrame = img.currentPixmap();
p.drawPixmap(center - QPoint(currentFrame.width() / 2, currentFrame.height() / 2), currentFrame);
p.setOpacity(1.0);
}
// static void drawIconGif(QPainter &p, const QPoint &center, const QMovie &img, const QBrush &bg, float opacity) {
// p.setRenderHint(QPainter::Antialiasing);
// p.setOpacity(1.0); // bg dictates opacity of ellipse
// p.setPen(Qt::NoPen);
// p.setBrush(bg);
// p.drawEllipse(center.x() - btn_size / 2, center.y() - btn_size / 2, btn_size, btn_size);
// p.setOpacity(opacity);
// QPixmap currentFrame = img.currentPixmap();
// p.drawPixmap(center - QPoint(currentFrame.width() / 2, currentFrame.height() / 2), currentFrame);
// p.setOpacity(1.0);
// }
OnroadWindow::OnroadWindow(QWidget *parent) : QWidget(parent), scene(uiState()->scene) {
QVBoxLayout *main_layout = new QVBoxLayout(this);