bool operator instead of optional + qobject_cast

This commit is contained in:
allejok96
2022-07-03 17:21:10 +02:00
parent 8cb41f01d8
commit 98c56a96cf
3 changed files with 13 additions and 9 deletions

View File

@@ -253,16 +253,22 @@ private:
typedef QVector<Note *> NoteVector;
/*! \brief Bounding box of notes
*
* Defaults to all zero, and will in that case evaluate to false if converted to bool.
*/
struct NoteBounds
{
TimePos start;
TimePos end;
int lowest;
int highest;
operator bool() { return start.getTicks() || end.getTicks() || lowest || highest; }
};
std::optional<NoteBounds> boundsForNotes(const NoteVector& notes);
NoteBounds boundsForNotes(const NoteVector& notes);
} // namespace lmms