Commit 49873141 authored by Volker Krause's avatar Volker Krause
Browse files

Add a way to compute the size of a U_TLAY layout block

Needed by KItinerary Workbench.
parent 373cc386
......@@ -20,6 +20,7 @@
#include <QDateTime>
#include <QDebug>
#include <QSize>
#include <cstring>
......@@ -263,3 +264,13 @@ QString Uic9183TicketLayout::text(int row, int column, int width, int height) co
//qDebug() << "Result:" << row << column << width << height << s;
return s.join(QLatin1Char('\n'));
}
QSize Uic9183TicketLayout::size() const
{
int width = 0, height = 0;
for (auto f = d->firstField(); !f.isNull(); f = f.next()) {
width = std::max(width, f.column() + f.width());
height = std::max(height, f.row() + f.height());
}
return QSize(width, height);
}
......@@ -23,6 +23,8 @@
#include <QExplicitlySharedDataPointer>
#include <QMetaType>
class QSize;
namespace KItinerary {
class Uic9183TicketLayoutPrivate;
......@@ -58,6 +60,9 @@ public:
*/
Q_INVOKABLE QString text(int row, int column, int width, int height) const;
/** The size of the layout, as width and height in layout coordinates. */
QSize size() const;
private:
QExplicitlySharedDataPointer<Uic9183TicketLayoutPrivate> d;
};
......
Markdown is supported
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