Skip to content

Commit 98dbb11

Browse files
committed
Add MythRect::toString and MythPoint::toString to aid in debugging
1 parent 78f71ee commit 98dbb11

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

mythtv/libs/libmythui/mythrect.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,18 @@ QString MythRect::getHeight(void) const
306306
return stringHeight;
307307
}
308308

309+
QString MythRect::toString(bool details) const
310+
{
311+
QString result = QString("(%1,%2,%3,%4)")
312+
.arg(x()).arg(y()).arg(width()).arg(height());
313+
314+
if (details)
315+
result += QString(" [%1,%2,%3,%4]")
316+
.arg(getX()).arg(getY()).arg(getWidth()).arg(getHeight());
317+
318+
return result;
319+
}
320+
309321
QRect MythRect::toQRect() const
310322
{
311323
return QRect(x(),y(),width(),height());
@@ -479,6 +491,18 @@ QString MythPoint::getY(void) const
479491
return stringY;
480492
}
481493

494+
QString MythPoint::toString(bool details) const
495+
{
496+
QString result = QString("(%1,%2)")
497+
.arg(x()).arg(y());
498+
499+
if (details)
500+
result += QString(" [%1,%2]")
501+
.arg(getX()).arg(getY());
502+
503+
return result;
504+
}
505+
482506
QPoint MythPoint::toQPoint() const
483507
{
484508
return QPoint(x(),y());

mythtv/libs/libmythui/mythrect.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ class MUI_PUBLIC MythRect : public QRect
5454
void moveTop(const QString &sX);
5555
void moveTop(int Y) { QRect::moveTop(Y); }
5656

57+
QString toString(bool details = false) const;
5758
QRect toQRect(void) const;
5859

5960
private:
@@ -102,6 +103,7 @@ class MUI_PUBLIC MythPoint : public QPoint
102103
QString getX(void) const;
103104
QString getY(void) const;
104105

106+
QString toString(bool details = false) const;
105107
QPoint toQPoint(void) const;
106108

107109
private:

0 commit comments

Comments
 (0)