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 change current visibility flag of rubberband on updates #1972

Merged
merged 2 commits into from
Apr 7, 2015
Merged

Don`t change current visibility flag of rubberband on updates #1972

merged 2 commits into from
Apr 7, 2015

Conversation

naihil
Copy link
Contributor

@naihil naihil commented Apr 1, 2015

If you hide rubberband and then zoom map, rubberband will be shown again.

@naihil
Copy link
Contributor Author

naihil commented Apr 1, 2015

I dont find any relation of QgsRubberBand and failed TestQgsComposerPicture::pictureRemoteUrl().

@strk
Copy link
Contributor

strk commented Apr 1, 2015

I've restarted travis build, in case it was a temporary glitch.

@@ -567,7 +567,7 @@ void QgsRubberBand::updateRect()
QgsRectangle rect( topLeft.x(), topLeft.y(), topLeft.x() + r.width()*res, topLeft.y() - r.height()*res );

setRect( rect );
setVisible( true );
setVisible( isVisible() );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this ever change the state ? isn't it equivalent to just drop the line ?

@naihil
Copy link
Contributor Author

naihil commented Apr 1, 2015

What is expected behavior after creation of rubberband?

According to Qt docs QGraphicsItem is visible by default (Items are visible by default; it is unnecessary to call setVisible() on a new item.), but QgsRubberBand ctor calls reset(), which set visibility to false.

Should we always manually set visibility to true? Or should it be set on addGeometry() call?

@strk
Copy link
Contributor

strk commented Apr 1, 2015 via email

Visibility behavior stays the same as in QGIS 2.6
Test included
strk pushed a commit that referenced this pull request Apr 7, 2015
Don`t change current visibility flag of rubberband on updates
@strk strk merged commit 892f142 into qgis:master Apr 7, 2015
@strk
Copy link
Contributor

strk commented Apr 7, 2015

I like this new patch better, thanks.

@strk
Copy link
Contributor

strk commented Apr 7, 2015

Actually, I found a missing bit here. The :updateRect function still calls setVisible(false) if there are no points, is that expected ? I guess it should just never change visibility instead ?

@strk
Copy link
Contributor

strk commented Apr 7, 2015

Should you add a test that adds an empty geometry ?

@strk
Copy link
Contributor

strk commented Apr 7, 2015

Sorry, I see the test is there, all fine here then.

strk pushed a commit that referenced this pull request Apr 7, 2015
Visibility behavior stays the same as in QGIS 2.6
Test included.

Fix #12486
Contributed via #1972
@naihil
Copy link
Contributor Author

naihil commented Apr 7, 2015

Actually, I found a missing bit here. The :updateRect function still calls setVisible(false) if there are no points, is that expected ? I guess it should just never change visibility instead ?

If we setting visibility to true on valid geometry then we should set it to false on invalid/empty geometry. And this is not break any user stuff, coz QGIS 2.6 (and early, i think) works that way.

@naihil naihil deleted the rubberband-visibility-fix branch April 7, 2015 09:19
@strk
Copy link
Contributor

strk commented Apr 7, 2015

Backported in 2.8 branch as 7210c4a

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.

2 participants