Comments (2)
It is caused by the fixed dpr in ImageViewerV2, which the value is from the primary monitor. I fixed this issue with the following code updates:
diff --git a/qimgv/gui/viewers/imageviewerv2.cpp b/qimgv/gui/viewers/imageviewerv2.cpp
index 2bf906cd..571c5cfb 100644
--- a/qimgv/gui/viewers/imageviewerv2.cpp
+++ b/qimgv/gui/viewers/imageviewerv2.cpp
@@ -31,7 +31,7 @@ ImageViewerV2::ImageViewerV2(QWidget *parent) : QGraphicsView(parent),
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
setAcceptDrops(false);
- dpr = this->devicePixelRatioF();
+ // dpr = this->devicePixelRatioF();
hs = horizontalScrollBar();
vs = verticalScrollBar();
@@ -235,7 +235,7 @@ bool ImageViewerV2::showAnimationFrame(int frame) {
void ImageViewerV2::updatePixmap(std::unique_ptr<QPixmap> newPixmap) {
pixmap = std::move(newPixmap);
- pixmap->setDevicePixelRatio(dpr);
+ pixmap->setDevicePixelRatio(this->devicePixelRatioF());
pixmapItem.setPixmap(*pixmap);
pixmapItem.show();
pixmapItem.update();
@@ -276,7 +276,7 @@ void ImageViewerV2::showImage(std::unique_ptr<QPixmap> _pixmap) {
if(_pixmap) {
pixmapItemScaled.hide();
pixmap = std::move(_pixmap);
- pixmap->setDevicePixelRatio(dpr);
+ pixmap->setDevicePixelRatio(this->devicePixelRatioF());
pixmapItem.setPixmap(*pixmap);
Qt::TransformationMode mode = Qt::SmoothTransformation;
if(mScalingFilter == QI_FILTER_NEAREST)
@@ -323,11 +323,11 @@ void ImageViewerV2::closeImage() {
}
void ImageViewerV2::setScaledPixmap(std::unique_ptr<QPixmap> newFrame) {
- if(!movie && newFrame->size() != scaledSizeR() * dpr)
+ if(!movie && newFrame->size() != scaledSizeR() * this->devicePixelRatioF())
return;
pixmapScaled = std::move(newFrame);
- pixmapScaled->setDevicePixelRatio(dpr);
+ pixmapScaled->setDevicePixelRatio(this->devicePixelRatioF());
pixmapItemScaled.setPixmap(*pixmapScaled);
pixmapItem.hide();
pixmapItemScaled.show();
@@ -433,7 +433,7 @@ void ImageViewerV2::requestScaling() {
// request "real" scaling when graphicsscene scaling is insufficient
// (it uses a single pass bilinear which is sharp but produces artifacts on low zoom levels)
if(currentScale() < FAST_SCALE_THRESHOLD)
- emit scalingRequested(scaledSizeR() * dpr, mScalingFilter);
+ emit scalingRequested(scaledSizeR() * this->devicePixelRatioF(), mScalingFilter);
}
bool ImageViewerV2::imageFits() const {
@@ -517,7 +517,7 @@ void ImageViewerV2::mouseMoveEvent(QMouseEvent *event) {
} else if(event->buttons() & Qt::RightButton) {
// ------------------- ZOOM ----------------------
// filter out possible mouse jitter by ignoring low delta drags
- if(mouseInteraction == MouseInteractionState::MOUSE_ZOOM || abs(mousePressPos.y() - event->pos().y()) > zoomThreshold / dpr) {
+ if(mouseInteraction == MouseInteractionState::MOUSE_ZOOM || abs(mousePressPos.y() - event->pos().y()) > zoomThreshold / this->devicePixelRatioF()) {
if(cursor().shape() != Qt::SizeVerCursor) {
setCursor(Qt::SizeVerCursor);
}
@@ -677,7 +677,7 @@ void ImageViewerV2::mouseMoveZoom(QMouseEvent *event) {
float stepMultiplier = 0.003f; // this one feels ok
int currentPos = event->pos().y();
int moveDistance = mouseMoveStartPos.y() - currentPos;
- float newScale = currentScale() * (1.0f + stepMultiplier * moveDistance * dpr);
+ float newScale = currentScale() * (1.0f + stepMultiplier * moveDistance * this->devicePixelRatioF());
mouseMoveStartPos = event->pos();
imageFitMode = FIT_FREE;
from qimgv.
If I remember correctly, different scales between monitors aren't supported by X11, so this only affects Wayland.
Until this is fixed qimgv can also be run with enforced usage of X11:
env QT_QPA_PLATFORM=xcb qimgv
Also see https://wiki.archlinux.org/title/Wayland#Qt.
Or just add the environment variable QT_QPA_PLATFORM=xcb
to the .desktop entry.
from qimgv.
Related Issues (20)
- Time to switch HOT 9
- The application crashes when trying to view some JXL files HOT 1
- App crashes on ICO (v1.0.3-alpha-101) HOT 1
- Some SVG images, aren't displayed at all
- [Feature] German translation HOT 1
- [FEATURE] manual labels on the "move to" quick folders.
- How do I designate a quick folder? HOT 2
- [Feature request] Automatically switch to nearest neighbour upscaling for very small pictures (Pixelart)
- Failed to build with exiv2 v0.28.0 HOT 1
- Dark fusion theme [Qt6, Win11] HOT 4
- advices
- Zoom out less than 100% HOT 2
- Some keystroke detection is broken [Qt 6.7.0] HOT 4
- Feature: Add option to use embedded cover as thumbnail (for video files)
- Video playback detaches on mpv v0.38.0 HOT 3
- I can't delete gif file in it
- NEED IMPROVEMENTS FOR WINDOWS 11!
- Touchpad pinch gestures for zoom in/out HOT 1
- ubuntu install does not work HOT 1
- [Feature Request] Use `=` instead of `+` as default keybind for zooming
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from qimgv.