Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QR code is stretched horizontally within its window #8944

Closed
phallobst opened this issue Dec 30, 2022 · 7 comments · Fixed by #9027
Closed

QR code is stretched horizontally within its window #8944

phallobst opened this issue Dec 30, 2022 · 7 comments · Fixed by #9027

Comments

@phallobst
Copy link

Overview

Resizing the QR code display window horizontally distorts the QR code itself, i.e. it's not square anymore.

Steps to Reproduce

  1. Select "TOTP / Show QR Code" from the context menu of an entry.
  2. Resize the window horizontally.

Expected Behavior

The QR code should always be square, centered and as large as possible within the limits of its allocated window are. (If the window is resized vertically, the program behaves correctly.)

Actual Behavior

The QR code is stretched horizontally, covering the whole width of the window. Scanning it with a smartphone camera will not work correctly.

Context

KeePassXC - Version 2.7.4
Revision: 63b2394
Qt 5.15.3

Operating System: Linux
Desktop Env: Cinnamon
Windowing System: X11

@phallobst phallobst added the bug label Dec 30, 2022
@droidmonkey
Copy link
Member

droidmonkey commented Dec 31, 2022

Cannot replicate on Windows so this must be a bug on macOS and Linux only...

@dmaslenko
Copy link
Contributor

I was able to reproduce it on Linux:
stratched-qr-code
At the same time the vertical window sizing does not change the QR code proportion.
Let me check what can we do to fix it...

@droidmonkey
Copy link
Member

Does it need to be fixed? Just don't size the window in one dimension, use the corner resize. I tried to fix it and it seemed impossible no matter what I did.

@dmaslenko
Copy link
Contributor

Right, let's have it as plan B.
For plan A I've got some result but need to find a solution to center the QR code to avoid much space on the right side:
fixed-qr-code-not-centered

@dmaslenko
Copy link
Contributor

Now I have a pretty simple solution for this variant:
fixed-qr-code-centered

    auto svgWidgetLayout = new QBoxLayout(QBoxLayout::LeftToRight);
    svgWidgetLayout->addWidget(m_totpSvgWidget, 0, Qt::AlignCenter);
    m_verticalLayout->addLayout(svgWidgetLayout);

Is it ok to have fixed size QR code or it should be resized to fill window as well?
It is possible but required recalculation and resizing on the fly that may impact on smooth rendering.
Let me know...

@droidmonkey
Copy link
Member

The point of allowing the window to resize is so that the qr code resizes as well. If it stays a fixed size, then this didn't solve the problem.

@dmaslenko
Copy link
Contributor

Sure, I will try...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants