Add debug utils for QRectF/QPointF

This commit is contained in:
WandererFan
2017-09-13 21:21:29 -04:00
committed by wmayer
parent c6fb629d15
commit 8431ec0fc1
2 changed files with 30 additions and 0 deletions

View File

@@ -32,6 +32,7 @@
# include <QStringList>
# include <QRegExp>
# include <QMessageBox>
#include <QRectF>
#endif
@@ -141,3 +142,21 @@ bool DrawGuiUtil::needView(Gui::Command* cmd, bool partOnly)
}
return haveView;
}
void DrawGuiUtil::dumpRectF(const char* text, const QRectF& r)
{
Base::Console().Message("DUMP - dumpRectF - %s\n",text);
double left = r.left();
double right = r.right();
double top = r.top();
double bottom = r.bottom();
Base::Console().Message("Extents: L: %.3f, R: %.3f, T: %.3f, B: %.3f\n",left,right,top,bottom);
Base::Console().Message("Size: W: %.3f H: %.3f\n",r.width(),r.height());
Base::Console().Message("Centre: (%.3f, %.3f)\n",r.center().x(),r.center().y());
}
void DrawGuiUtil::dumpPointF(const char* text, const QPointF& p)
{
Base::Console().Message("DUMP - dumpPointF - %s\n",text);
Base::Console().Message("Point: (%.3f, %.3f)\n",p.x(),p.y());
}

View File

@@ -24,6 +24,15 @@
#define _DrawGuiUtil_h_
#include <string>
#include <QRectF>
#include <QPointF>
namespace TechDraw {
class DrawPage;
}
namespace Gui {
class Command;
}
namespace TechDrawGui
{
@@ -34,6 +43,8 @@ class TechDrawGuiExport DrawGuiUtil {
static TechDraw::DrawPage* findPage(Gui::Command* cmd);
static bool needPage(Gui::Command* cmd);
static bool needView(Gui::Command* cmd, bool partOnly = true);
static void dumpRectF(const char* text, const QRectF& r);
static void dumpPointF(const char* text, const QPointF& p);
};
} //end namespace TechDrawGui