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

pull/21834/head
Dean Lee 4 years ago committed by GitHub
parent 776516d72b
commit 8f7fc61e48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      selfdrive/ui/qt/sidebar.cc

@ -2,7 +2,6 @@
#include <QMouseEvent> #include <QMouseEvent>
#include "selfdrive/ui/qt/qt_window.h"
#include "selfdrive/common/util.h" #include "selfdrive/common/util.h"
#include "selfdrive/hardware/hw.h" #include "selfdrive/hardware/hw.h"
#include "selfdrive/ui/qt/util.h" #include "selfdrive/ui/qt/util.h"
@ -41,9 +40,9 @@ Sidebar::Sidebar(QWidget *parent) : QFrame(parent) {
connect(this, &Sidebar::valueChanged, [=] { update(); }); connect(this, &Sidebar::valueChanged, [=] { update(); });
setAttribute(Qt::WA_OpaquePaintEvent);
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
setFixedWidth(300); setFixedWidth(300);
setMinimumHeight(vwp_h);
setStyleSheet("background-color: rgb(57, 57, 57);");
} }
void Sidebar::mouseReleaseEvent(QMouseEvent *event) { void Sidebar::mouseReleaseEvent(QMouseEvent *event) {
@ -103,6 +102,8 @@ void Sidebar::paintEvent(QPaintEvent *event) {
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
p.setRenderHint(QPainter::Antialiasing); p.setRenderHint(QPainter::Antialiasing);
p.fillRect(rect(), QColor(57, 57, 57));
// static imgs // static imgs
p.setOpacity(0.65); p.setOpacity(0.65);
p.drawImage(settings_btn.x(), settings_btn.y(), settings_img); p.drawImage(settings_btn.x(), settings_btn.y(), settings_img);

Loading…
Cancel
Save