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

Don't shrink the image when the aspect ratio changes #4

Merged
merged 4 commits into from
Jul 10, 2017

Conversation

lucasw
Copy link
Contributor

@lucasw lucasw commented May 5, 2017

Applying changes from ros-visualization/rqt_common_plugins#441 to this new repo for #3

if (outer_layout_)
{
width = outer_layout_->contentsRect().width() - 2;
height = outer_layout_->contentsRect().height() - 2;
Copy link
Contributor

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?

Copy link
Contributor Author

@lucasw lucasw May 9, 2017

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:

image_in_scroll_area

(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());
Copy link
Contributor

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.

@dirk-thomas
Copy link
Contributor

Sorry for the late response and thank you for iterating on this improvement.

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

Successfully merging this pull request may close these issues.

2 participants