Set device pixel ratio for counter layer
This commit is contained in:
parent
c9308d04b8
commit
8dee2a1c8b
|
@ -232,6 +232,7 @@ QIcon IconGraphic::trayIcon(
|
||||||
: 16;
|
: 16;
|
||||||
const auto layer = Window::GenerateCounterLayer({
|
const auto layer = Window::GenerateCounterLayer({
|
||||||
.size = layerSize,
|
.size = layerSize,
|
||||||
|
.devicePixelRatio = iconImage.devicePixelRatio(),
|
||||||
.count = counter,
|
.count = counter,
|
||||||
.bg = bg,
|
.bg = bg,
|
||||||
.fg = fg,
|
.fg = fg,
|
||||||
|
|
|
@ -249,7 +249,10 @@ QImage GenerateCounterLayer(CounterLayerArgs &&args) {
|
||||||
}
|
}
|
||||||
}();
|
}();
|
||||||
|
|
||||||
auto result = QImage(d.size, d.size, QImage::Format_ARGB32);
|
auto result = QImage(
|
||||||
|
QSize(d.size, d.size) * d.devicePixelRatio,
|
||||||
|
QImage::Format_ARGB32);
|
||||||
|
result.setDevicePixelRatio(d.devicePixelRatio);
|
||||||
result.fill(Qt::transparent);
|
result.fill(Qt::transparent);
|
||||||
|
|
||||||
auto p = QPainter(&result);
|
auto p = QPainter(&result);
|
||||||
|
|
|
@ -51,6 +51,7 @@ struct CounterLayerArgs {
|
||||||
required<int> count = 1;
|
required<int> count = 1;
|
||||||
required<style::color> bg;
|
required<style::color> bg;
|
||||||
required<style::color> fg;
|
required<style::color> fg;
|
||||||
|
double devicePixelRatio = 1.;
|
||||||
};
|
};
|
||||||
|
|
||||||
[[nodiscard]] QImage GenerateCounterLayer(CounterLayerArgs &&args);
|
[[nodiscard]] QImage GenerateCounterLayer(CounterLayerArgs &&args);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user