Only draw outline for overlay when hovered over (#6140)
This commit is contained in:
@@ -974,14 +974,17 @@ void BaseWindow::scaleChangedEvent(float scale)
|
||||
void BaseWindow::paintEvent(QPaintEvent *)
|
||||
{
|
||||
QPainter painter(this);
|
||||
this->drawOutline(painter);
|
||||
this->drawCustomWindowFrame(painter);
|
||||
}
|
||||
|
||||
void BaseWindow::drawOutline(QPainter &painter)
|
||||
{
|
||||
if (this->frameless_)
|
||||
{
|
||||
painter.setPen(QColor("#999"));
|
||||
painter.drawRect(0, 0, this->width() - 1, this->height() - 1);
|
||||
}
|
||||
|
||||
this->drawCustomWindowFrame(painter);
|
||||
}
|
||||
|
||||
float BaseWindow::desiredScale() const
|
||||
|
||||
@@ -120,6 +120,7 @@ protected:
|
||||
void scaleChangedEvent(float) override;
|
||||
|
||||
void paintEvent(QPaintEvent *) override;
|
||||
virtual void drawOutline(QPainter &);
|
||||
|
||||
void changeEvent(QEvent *) override;
|
||||
void leaveEvent(QEvent *) override;
|
||||
|
||||
@@ -611,4 +611,8 @@ void OverlayWindow::setInert(bool inert)
|
||||
}
|
||||
}
|
||||
|
||||
void OverlayWindow::drawOutline(QPainter & /* painter */)
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -34,6 +34,7 @@ public:
|
||||
bool isInert() const;
|
||||
void setInert(bool inert);
|
||||
void toggleInertia();
|
||||
void drawOutline(QPainter &painter) override;
|
||||
|
||||
protected:
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
|
||||
@@ -85,6 +85,11 @@ bool OverlayInteraction::isInteracting() const
|
||||
|
||||
void OverlayInteraction::paintEvent(QPaintEvent * /*event*/)
|
||||
{
|
||||
if (this->interactionProgress() <= 0.0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QPainter painter(this);
|
||||
QColor highlightColor(
|
||||
255, 255, 255, std::max(int(255.0 * this->interactionProgress()), 50));
|
||||
@@ -94,11 +99,6 @@ void OverlayInteraction::paintEvent(QPaintEvent * /*event*/)
|
||||
auto bounds = this->rect();
|
||||
painter.drawRect(bounds);
|
||||
|
||||
if (this->interactionProgress() <= 0.0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
highlightColor.setAlpha(highlightColor.alpha() / 4);
|
||||
painter.setBrush(highlightColor);
|
||||
painter.setPen(Qt::transparent);
|
||||
|
||||
Reference in New Issue
Block a user