PianoRoll: fix getKey and remove dead code#8008
Conversation
JohannesLorenz
left a comment
There was a problem hiding this comment.
Only 2 editorials.
Checked:
- Code logic
- Code style
- Partial testing: I checked that the dead code cannot be reached
Suggesting to test the other points of the OP.
I glanced through the various |
JohannesLorenz
left a comment
There was a problem hiding this comment.
Rework check OK, only grammar issues.
This PR can be tested.
I can recreate this! The PR does indeed fix this! Approving as a tester. |
|
Looked at the code. Again, I'm just starting out reviewing, but this looks great! Gonna just sum up my understanding of the code and ask @allejok96 to confirm:
As for my questions, I'm gonna make them in the code viewer. |
| y, | ||
| width() - 10, | ||
| m_keyLineHeight + 1, | ||
| m_keyLineHeight, |
There was a problem hiding this comment.
Why was the + 1 there in the first place?
There was a problem hiding this comment.
My guess is it compensated for the - 1 a few lines earlier.
|
Actually, other than that, I've no other questions, the comments are terrific! |
|
@bratpeki thank's for the testing. You're right about the relative and absolute values, although I just call them "distances from bottom" and not "coordinates" since Qt always measures coordinates from the upper left corner of the widget. So with that in mind |
|
Thanks for the clarification! @regulus79 can we get a brief look at this and then merge? |
regulus79
left a comment
There was a problem hiding this comment.
I have not tested this, nor can I confirm that the code block removed cannot be reached. But, just from a brief look, the changes look fine. If other people have tested it, I'm fine with it.
|
@allejok96: Yeah, could you delve a bit into that bit of code that can't be reached? How are you sure that such a big chunk of code is unreachable? |
|
@bratpeki This is the outer shell of the if statement, starting on line 2459 // If mouse is below timeline OR user is performing an action
if( me->y() > PR_TOP_MARGIN || m_action != Action::None )
{
...
}
else
{
// If left button is pressed AND select mode is active AND is performing select action
if( me->buttons() & Qt::LeftButton &&
m_editMode == EditMode::Select &&
m_action == Action::SelectNotes )
{
// This cannot be reached since if action == SelectNotes it will always match the first statement
}
} |
|
Thanks for the clarification, @allejok96. I see @regulus79 also thinks this is okay, @messmerd is okay with the code changes, @JohannesLorenz too. There have been no changes since my approval, so @regulus79 can we get this merged? |
getKey()is off by 2 pixelsyCoordOfKey()which is the reverse ofgetKey()