-
Notifications
You must be signed in to change notification settings - Fork 2
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
Fix data flow #43
Fix data flow #43
Conversation
return 0; | ||
} | ||
|
||
return star; | ||
} | ||
|
||
void WStarRating::mouseReleaseEvent(QMouseEvent* /*unused*/) { | ||
emit ratingChanged(m_starRating.starCount()); | ||
slotSetRating(m_visualStarRating.starCount()); |
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.
This feels wrong: we now store the stars without confirmation, as if it was an update from the owner/mediator. IMO it was correct before: emit the change (don't store it) and wait for the owner to confirm/reject/reset.
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.
Result of this implementation is that you can now set stars in the rating widget of an empty deck.
m_starCount = starCount; | ||
resetVisualRating(); | ||
emit ratingChanged(starCount); |
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.
shouldn't this be updateVisualrating()
?
Also, emitting the signal again with the value we may just received doesn't make sense to me. What for?
It seems emit is required here only because you use slotSetRating
instead of emit in mouseReleaseEvent
.
Thank you for the cleanup/renaming and the StarRating helpers. |
This comment was marked as outdated.
This comment was marked as outdated.
I revisited the code again, but couldn't come up with a consistent solution. You round trip argument doesn't hold, since the mouse release event explicitly sets a new value implicitly. Intermediate, temporary changes when hovering with the mouse over the widget should not be emitted. Giving up, not wasting my time with this convoluted legacy code. Probably better to wait for QML. Since I don't use this feature I cannot even test it properly. |
Okay then, thanks for your time anyway!
Exactly, just the clicked star count is emitted. Imagining the signals are very slow, on LeaveEvent the rating is reset to the previously confirmed value. Then the return signal from BaseTrackPlayer (or DlgTrackInfo) sets (or clears) the visual rating. |
Only the actual rating drives the signal, not the (temporary) visual number of stars.