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
Renovate usages of QLineF intersections #719
Conversation
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.
what do you think of the alternative I propose?
Engine/RotoContext.cpp
Outdated
@@ -4476,7 +4476,11 @@ RotoContextPrivate::bezulate(double time, | |||
QPointF intersectionPoint; | |||
for (; cur != polygon.end(); ++cur, ++last_pt) { | |||
QLineF polygonSegment( QPointF(last_pt->x, last_pt->y), QPointF(cur->x, cur->y) ); | |||
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) | |||
if (line.intersects(polygonSegment, &intersectionPoint) == QLineF::BoundedIntersection) { |
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'm not a fan of having two open curly braces for one close brace in the code. Does clang-format handle this correctly?
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.
Instead, maybe add at the beginning of each of these 4 files:
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
// https://doc.qt.io/qt-5/qlinef-obsolete.html
#define intersects intersect
#define IntersectionType IntersectType
#endif
I know this is kinda dangerous if "intersects" is used in the code but this seems ok to me
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.
clang-format
can handle this indeed. As for the define
s is better to use using
s, although I prefer to not use them altogether.
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.
actually I don't think "using" is possible, since it's inside a class, not a namespace
4017d92
to
8d2dc81
Compare
note that you can use |
I think that could be done in another PR, as many other parts of the codebase do this too. |
Thanks for submitting a pull request! Please provide enough information so that others can review your pull request. Additionally, make sure you've done all of these things:
PR Description
What type of PR is this? (Check one of the boxes below)
What does this pull request do?
Both
QLineF::intersect
plusQLineF::IntersectType
were deprecated in Qt 5.14 andQLineF::intersects
plusQLineF::IntersectionType
are recommended to be used instead.Show a few screenshots (if this is a visual change)
N/A.
Have you tested your changes (if applicable)? If so, how?
Built Natron and used the node graph editor.
Futher details of this pull request
N/A.