QTreeWidgetItem in Qt5 requires overloading < operator to implement
custom sorting. Use existing compare methods to do that.
Additionally, natural sorting was implemented for strings.
This allows to sort by filenames like file_<number>.
BUG:389130
QTreeWidgetItem in Qt5 requires overloading < operator to implement
custom sorting. Use existing compare methods to do that.
Additionally, natural sorting was implemented for strings.
This allows to sort by filenames like file_<number>.
BUG:389130
Click on columns to sort them.
Columns are sorted by artist, album and track number.
Automatic diff as part of commit; lint not applicable. |
Automatic diff as part of commit; unit tests not applicable. |
playlistitem.cpp | ||
---|---|---|
432 | I'm not sure about this one. Perhaps it would be better to use private member and initialize once in constructor? |
Once the placement of the naturalCompare function is corrected, this is ready to commit. I'll leave the handling of the QCollator to your opinion but I think it's fine to be in the method itself, especially once it is made a "free" function at file scope.
playlistitem.cpp | ||
---|---|---|
432 | Actually I'm not as worried about this as I would have used to be. With C++11 this should be safe at least (and this is a GUI thread method here so we should expect this to be called without concurrent anyways). If I were to move it, I would probably make it a global static inside of playlistitem.cpp instead of moving to the PlaylistItem type. | |
playlistitem.h | ||
209 | There doesn't appear to be anything about this method specific to PlaylistItem as a type. Please make it a static function in playlistitem.cpp at file scope (not class scope) instead, which can also potentially provide the compiler with better opportunity to optimize since the function will not need to be public to other users of the PlaylistItem type. |