From 8b6e00cc6842406f5acc95e13999041b5adc071a Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Wed, 19 Jun 2019 13:26:29 +0200 Subject: [PATCH] debug operator added --- src/layouts/QskLayoutHint.cpp | 17 +++++++++++++++++ src/layouts/QskLayoutHint.h | 32 ++++++++++++++++++++------------ 2 files changed, 37 insertions(+), 12 deletions(-) diff --git a/src/layouts/QskLayoutHint.cpp b/src/layouts/QskLayoutHint.cpp index 1ab5c5f2..fd1df665 100644 --- a/src/layouts/QskLayoutHint.cpp +++ b/src/layouts/QskLayoutHint.cpp @@ -75,3 +75,20 @@ void QskLayoutHint::normalize() m_maximum = qMax( m_minimum, m_maximum ); m_preferred = qBound( m_minimum, m_preferred, m_maximum ); } + +#ifndef QT_NO_DEBUG_STREAM + +#include + +QDebug operator<<( QDebug debug, const QskLayoutHint& hint ) +{ + QDebugStateSaver saver( debug ); + debug.nospace(); + + debug << "LayoutHint" << "( " << hint.minimum() << ", " + << hint.preferred() << ", " << hint.maximum() << " )"; + + return debug; +} + +#endif diff --git a/src/layouts/QskLayoutHint.h b/src/layouts/QskLayoutHint.h index da5a1dfb..3d8c1265 100644 --- a/src/layouts/QskLayoutHint.h +++ b/src/layouts/QskLayoutHint.h @@ -4,6 +4,8 @@ #include "QskGlobal.h" #include +class QDebug; + class QSK_EXPORT QskLayoutHint { public: @@ -35,32 +37,32 @@ class QSK_EXPORT QskLayoutHint }; inline qreal QskLayoutHint::minimum() const -{ +{ return m_minimum; -} - +} + inline void QskLayoutHint::setMinimum( qreal value ) -{ +{ m_minimum = value; -} - +} + inline qreal QskLayoutHint::preferred() const -{ +{ return m_preferred; -} - +} + inline void QskLayoutHint::setPreferred( qreal value ) -{ +{ m_preferred = value; } inline qreal QskLayoutHint::maximum() const -{ +{ return m_maximum; } inline void QskLayoutHint::setMaximum( qreal value ) -{ +{ m_maximum = value; } @@ -76,6 +78,12 @@ inline bool QskLayoutHint::operator!=( const QskLayoutHint& other ) const return !( *this == other ); } +#ifndef QT_NO_DEBUG_STREAM + +QSK_EXPORT QDebug operator<<( QDebug, const QskLayoutHint& ); + +#endif + Q_DECLARE_TYPEINFO( QskLayoutHint, Q_MOVABLE_TYPE ); #endif