Use Qt's High-DPI scaling on Windows (#4868)

This commit is contained in:
nerix
2024-05-12 13:59:14 +02:00
committed by GitHub
parent 8202cd0d99
commit febcf464fe
21 changed files with 459 additions and 320 deletions
+19 -10
View File
@@ -615,7 +615,7 @@ void ChannelView::scaleChangedEvent(float scale)
if (this->goToBottom_)
{
auto factor = this->qtFontScale();
auto factor = this->scale();
#ifdef Q_OS_MACOS
factor = scale * 80.F /
std::max<float>(
@@ -703,8 +703,10 @@ void ChannelView::layoutVisibleMessages(
{
const auto &message = messages[i];
redrawRequired |= message->layout(layoutWidth, this->scale(), flags,
this->bufferInvalidationQueued_);
redrawRequired |= message->layout(
layoutWidth, this->scale(),
this->scale() * static_cast<float>(this->devicePixelRatio()),
flags, this->bufferInvalidationQueued_);
y += message->getHeight();
}
@@ -738,7 +740,10 @@ void ChannelView::updateScrollbar(
{
auto *message = messages[i].get();
message->layout(layoutWidth, this->scale(), flags, false);
message->layout(
layoutWidth, this->scale(),
this->scale() * static_cast<float>(this->devicePixelRatio()), flags,
false);
h -= message->getHeight();
@@ -1720,9 +1725,11 @@ void ChannelView::wheelEvent(QWheelEvent *event)
}
else
{
snapshot[i - 1]->layout(this->getLayoutWidth(),
this->scale(), this->getFlags(),
false);
snapshot[i - 1]->layout(
this->getLayoutWidth(), this->scale(),
this->scale() *
static_cast<float>(this->devicePixelRatio()),
this->getFlags(), false);
scrollFactor = 1;
currentScrollLeft = snapshot[i - 1]->getHeight();
}
@@ -1755,9 +1762,11 @@ void ChannelView::wheelEvent(QWheelEvent *event)
}
else
{
snapshot[i + 1]->layout(this->getLayoutWidth(),
this->scale(), this->getFlags(),
false);
snapshot[i + 1]->layout(
this->getLayoutWidth(), this->scale(),
this->scale() *
static_cast<float>(this->devicePixelRatio()),
this->getFlags(), false);
scrollFactor = 1;
currentScrollLeft = snapshot[i + 1]->getHeight();