Only draw outline for overlay when hovered over (#6140)

This commit is contained in:
teknsl
2025-04-12 12:06:36 +02:00
committed by GitHub
parent 5828df8b73
commit b59124702c
6 changed files with 17 additions and 7 deletions
+1
View File
@@ -5,6 +5,7 @@
- Minor: Add an option for the reduced opacity of message history. (#6121)
- Minor: Make paused chat indicator more visible, and fix its zoom behavior. (#6123)
- Minor: Added WebSocket API for plugins. (#6076)
- Minor: Popup overlay now only draws an outline when being interacted with. (#6140)
- Bugfix: Don't create native messaging manifest file if browser directory doesn't exist. (#6116)
- Bugfix: Fixed scrolling now working on inputs in the settings. (#6128)
- Bugfix: Make reply-cancel button less coarse-grained. (#6106)
+5 -2
View File
@@ -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
+1
View File
@@ -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;
+4
View File
@@ -611,4 +611,8 @@ void OverlayWindow::setInert(bool inert)
}
}
void OverlayWindow::drawOutline(QPainter & /* painter */)
{
}
} // namespace chatterino
+1
View File
@@ -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)
+5 -5
View File
@@ -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);