-
Notifications
You must be signed in to change notification settings - Fork 59
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
Don't shrink the image when the aspect ratio changes #4
Conversation
if (outer_layout_) | ||
{ | ||
width = outer_layout_->contentsRect().width() - 2; | ||
height = outer_layout_->contentsRect().height() - 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is the value 2
coming from?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I was trying to center the image within the widget that came before the scroll area. As it is now I removed them and the image is not centered by much more than 2 pixels:
(look at the bottom of the image)
What I would like to do is a separate pr that gets rid of that border and the oversized margins of some of the layouts- I think after that the image will be centered (or it won't be as obvious that it isn't), and much precious screen real estate will recovered as well.
… center the image within the previous containter (what came before the scroll area), and should have been query some margin instead of hardcoding. The image is not currently centered within the scroll area, whichever edge is the constraining one is abutting the scrollarea border, while the other edges are many pixels separated.
@@ -136,6 +158,7 @@ void RatioLayoutedFrame::paintEvent(QPaintEvent* event) | |||
qimage_mutex_.lock(); | |||
if (!qimage_.isNull()) | |||
{ | |||
setAspectRatio(qimage_.width(), qimage_.height()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the paint event can happen multiple times for the same image I don't think this command should be repeated every time but only be done once when a new image is received.
Sorry for the late response and thank you for iterating on this improvement. |
Applying changes from ros-visualization/rqt_common_plugins#441 to this new repo for #3