From e52dca36559bf7472b8a2394fd9b52058a523c0e Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Wed, 15 Jan 2014 22:51:53 +0200 Subject: [PATCH] Add convenience method QTextFormat::isEmpty() Change-Id: I30e74de6853908d1fec399131637848e3c2faabe Reviewed-by: Lars Knoll --- src/gui/text/qtextformat.cpp | 9 +++++++++ src/gui/text/qtextformat.h | 1 + 2 files changed, 10 insertions(+) diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp index 2389427da0e..3d70befda34 100644 --- a/src/gui/text/qtextformat.cpp +++ b/src/gui/text/qtextformat.cpp @@ -705,6 +705,15 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QTextFormat &fmt) InvalidFormat); otherwise returns \c false. */ +/*! + \fn bool QTextFormat::isEmpty() const + \since 5.3 + + Returns true if the format does not store any properties; false otherwise. + + \sa propertyCount(), properties() +*/ + /*! \fn bool QTextFormat::isCharFormat() const diff --git a/src/gui/text/qtextformat.h b/src/gui/text/qtextformat.h index 20983698115..c04ac3876b9 100644 --- a/src/gui/text/qtextformat.h +++ b/src/gui/text/qtextformat.h @@ -295,6 +295,7 @@ public: void merge(const QTextFormat &other); inline bool isValid() const { return type() != InvalidFormat; } + inline bool isEmpty() const { return propertyCount() == 0; } int type() const;