Sidebar: set Qt::WA_OpaquePaintEvent attribute (#21782)

old-commit-hash: 8f7fc61e48
This commit is contained in:
Dean Lee
2021-08-03 12:26:09 +08:00
committed by GitHub
parent 96ee460f96
commit 1d29118e0a
+4 -3
View File
@@ -2,7 +2,6 @@
#include <QMouseEvent>
#include "selfdrive/ui/qt/qt_window.h"
#include "selfdrive/common/util.h"
#include "selfdrive/hardware/hw.h"
#include "selfdrive/ui/qt/util.h"
@@ -41,9 +40,9 @@ Sidebar::Sidebar(QWidget *parent) : QFrame(parent) {
connect(this, &Sidebar::valueChanged, [=] { update(); });
setAttribute(Qt::WA_OpaquePaintEvent);
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
setFixedWidth(300);
setMinimumHeight(vwp_h);
setStyleSheet("background-color: rgb(57, 57, 57);");
}
void Sidebar::mouseReleaseEvent(QMouseEvent *event) {
@@ -103,6 +102,8 @@ void Sidebar::paintEvent(QPaintEvent *event) {
p.setPen(Qt::NoPen);
p.setRenderHint(QPainter::Antialiasing);
p.fillRect(rect(), QColor(57, 57, 57));
// static imgs
p.setOpacity(0.65);
p.drawImage(settings_btn.x(), settings_btn.y(), settings_img);