Fix flickering when running with Direct2D (#4851)

This commit is contained in:
nerix 2023-10-01 07:13:37 +02:00 committed by GitHub
parent 4d8b62364d
commit 916427a612
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 14 additions and 5 deletions

View file

@ -26,6 +26,7 @@
- Dev: Add `WindowManager::getLastSelectedWindow()` to replace `getMainWindow()`. (#4816)
- Dev: Clarify signal connection lifetimes where applicable. (#4818)
- Dev: Laid the groundwork for advanced input completion strategies. (#4639, #4846)
- Dev: Fixed flickering when running with Direct2D on Windows. (#4851)
## 2.4.5

View file

@ -1117,7 +1117,6 @@ void Notebook::setTabLocation(NotebookTabLocation location)
void Notebook::paintEvent(QPaintEvent *event)
{
BaseWidget::paintEvent(event);
auto scale = this->scale();
QPainter painter(this);

View file

@ -133,7 +133,11 @@ void Button::setMenu(std::unique_ptr<QMenu> menu)
void Button::paintEvent(QPaintEvent *)
{
QPainter painter(this);
this->paintButton(painter);
}
void Button::paintButton(QPainter &painter)
{
painter.setRenderHint(QPainter::SmoothPixmapTransform);
if (!this->pixmap_.isNull())

View file

@ -56,7 +56,13 @@ signals:
void leftMousePress();
protected:
virtual void paintEvent(QPaintEvent *) override;
void paintEvent(QPaintEvent * /*event*/) override;
/// Paint this button.
/// This is intended for child classes that may want to paint the overlay.
/// This function should be used after rendering the custom button,
/// because the painter's state will be modified by this function.
void paintButton(QPainter &painter);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
void enterEvent(QEnterEvent * /*event*/) override;
#else

View file

@ -138,7 +138,7 @@ void NotebookButton::paintEvent(QPaintEvent *event)
default:;
}
Button::paintEvent(event);
this->paintButton(painter);
}
void NotebookButton::mouseReleaseEvent(QMouseEvent *event)

View file

@ -121,8 +121,7 @@ void TitleBarButton::paintEvent(QPaintEvent *event)
default:;
}
Button::paintEvent(event);
// this->fancyPaint(painter);
this->paintButton(painter);
}
} // namespace chatterino