Commit 32c619a5 authored by Volker Krause's avatar Volker Krause
Browse files

Add method to get all fields in a given area of an U_TLAY block

parent e55cd390
......@@ -197,3 +197,21 @@ QSize Uic9183TicketLayout::size() const
}
return QSize(width, height);
}
std::vector<Uic9183TicketLayoutField> Uic9183TicketLayout::fields(int row, int column, int width, int height) const
{
std::vector<Uic9183TicketLayoutField> result;
for (auto f = firstField(); !f.isNull(); f = f.next()) {
// there's non-compliant samples out there with zero field sizes...
const auto effectiveHeight = std::max(f.height(), 1);
if (f.row() + effectiveHeight - 1 < row || f.row() > row + height - 1) {
continue;
}
const auto effectiveFieldWidth = f.width() > 0 ? f.width() : f.size();
if (f.column() + effectiveFieldWidth - 1 < column || f.column() > column + width - 1) {
continue;
}
result.push_back(f);
}
return result;
}
......@@ -96,6 +96,9 @@ public:
*/
Uic9183TicketLayoutField firstField() const;
/** All fields covering the given area. */
std::vector<Uic9183TicketLayoutField> fields(int row, int column, int width, int height) const;
static constexpr const char RecordId[] = "U_TLAY";
private:
QExplicitlySharedDataPointer<Uic9183TicketLayoutPrivate> d;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment