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

Made user information window resizable #4009

Merged
merged 4 commits into from
Jul 23, 2020

Conversation

awlangham
Copy link
Contributor

Related Ticket(s)

Short roundup of the initial problem

Makes the user information window resizable by the user.

What will change with this Pull Request?

  • Removed the call to setFixedSize (which locked the widget's size as its sizeHint) in UserInfoBox.

Screenshots

Before resizing:
image

After resizing (example):
image

@ebbit1q
Copy link
Member

ebbit1q commented May 20, 2020

It'd be nice if the image would scale with it, currently all this does is allow the text to get more spaced out. This should be possible by setting the size policies.

@awlangham
Copy link
Contributor Author

Sure, I'll look into that.

@tooomm
Copy link
Member

tooomm commented May 21, 2020

Just a thought, I did not test this...
Could it be that the fixed size had a purpose? What happens if somebody has a huge player image? With this change, opening his profile may result in a very big window which we might want to prevent. Do we need a reasonable default size on opening?

@awlangham
Copy link
Contributor Author

I changed it to give the avatar an expanding size policy. However, this doesn't preserve the aspect ratio of the picture, since it's implemented as a QPixmap placed in a QLabel. From what I've found online it seems that to preserve the aspect ratio one must either subclass QLabel or reimplement resizeEvent to adjust the QPixmap's size when the QLabel's size is changed (currently it is handled with setScaledContents allowing the QLabel to adjust the QPixmap size).

@ebbit1q
Copy link
Member

ebbit1q commented Jun 1, 2020

It is preferable to have the image retain its aspect ratio.

@awlangham
Copy link
Contributor Author

My apologies for how long it's taken for me to follow up on this. From everything that I could find online, including other Qt users trying to do something similar, using a QLabel with a QPixmap on top of it does not have a simple, layout-based way to preserve the aspect ratio of the pixmap. I reimplemented the widget's resizeEvent to control the aspect ratio of the pixmap (the alternative seems to be to subclass QLabel to add this behavior). Please let me know if this would be an acceptable approach to solve this.

@ebbit1q
Copy link
Member

ebbit1q commented Jul 23, 2020

Works great! Thanks for coming back to this. I have formatted your pr.

@ZeldaZach ZeldaZach merged commit fe63dfa into Cockatrice:master Jul 23, 2020
@ZeldaZach
Copy link
Member

Thanks for your contribution to my project! We greatly appreciate it :)

@awlangham awlangham deleted the resizeuserinfo branch July 29, 2020 00:16
longagofaraway pushed a commit to longagofaraway/Cockatrice that referenced this pull request Aug 14, 2020
* move db udpate (Cockatrice#4015)

* Remove gitlab config (Cockatrice#4037)

* revert Cockatrice#2345

* remove gitlab yml

* fix message when moving cards to bottom of library (Cockatrice#4006)

* Change method of opening directories to be the same for all oses, including linux (Cockatrice#4046)

* add opening directory in file browser to linux

this uses QDesktopServices to open the url "file://[location]"
by default this is
"file://$HOME/.local/share/Cockatrice/Cockatrice/pics/CUSTOM"

any distro that has a file browser should have an accompanying mime type
specifying the file handler for the file:// protocol using the
inode/directory mime type

see https://specifications.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-latest.html

if a user were to have removed their mime database this will not work and
it will fail with nothing but a log message, this would be rare and not
worth checking in my opinion

* make opening directories the same for all oses

* sort headers

* Made user information window resizable (Cockatrice#4009)

* Added horizontal layout and stretch for player icon (Cockatrice#4052)

* Fix unresolved symbols when link tests to system libgtest-dev (Cockatrice#4055)

* Enable parallel compilation. (Cockatrice#4057)

* travis: update macos 10.15 images (Cockatrice#4059)

* Fix release tests (Cockatrice#4063)

Co-authored-by: tooomm <tooomm@users.noreply.github.com>
Co-authored-by: Lee Tran <54418451+LeeTranMN@users.noreply.github.com>
Co-authored-by: ebbit1q <ebbit1q@gmail.com>
Co-authored-by: awlangham <awlangham@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make the user information window resizable
4 participants