From fbe9366498a14bfb8daaa604037bb27e1d59db64 Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 25 Apr 2023 11:32:55 +0200 Subject: [PATCH] LayoutBuilder: Cut remaining dependency to utils layoutbuilder.{cpp,h} can now be re-used outside Creator Change-Id: I306d2d8168d8a09658ea008f4606ca37a0dbbc01 Reviewed-by: Eike Ziller --- src/libs/utils/layoutbuilder.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/libs/utils/layoutbuilder.cpp b/src/libs/utils/layoutbuilder.cpp index c47be9778db..3633c083e3c 100644 --- a/src/libs/utils/layoutbuilder.cpp +++ b/src/libs/utils/layoutbuilder.cpp @@ -3,8 +3,7 @@ #include "layoutbuilder.h" -#include "qtcassert.h" - +#include #include #include #include @@ -18,6 +17,14 @@ namespace Layouting { +// That's cut down qtcassert.{c,h} to avoid the dependency. +#define QTC_STRINGIFY_HELPER(x) #x +#define QTC_STRINGIFY(x) QTC_STRINGIFY_HELPER(x) +#define QTC_STRING(cond) qDebug("SOFT ASSERT: \"%s\" in %s: %s", cond, __FILE__, QTC_STRINGIFY(__LINE__)) +#define QTC_ASSERT(cond, action) if (Q_LIKELY(cond)) {} else { QTC_STRING(#cond); action; } do {} while (0) +#define QTC_CHECK(cond) if (cond) {} else { QTC_STRING(#cond); } do {} while (0) + + /*! \enum Utils::LayoutBuilder::LayoutType \inmodule QtCreator