diff --git a/sources/qet.cpp b/sources/qet.cpp index 17715869a..b66f832fa 100644 --- a/sources/qet.cpp +++ b/sources/qet.cpp @@ -683,3 +683,18 @@ QPointF QET::graphicsSceneEventPos(QEvent *event) { } return(event_scene_pos); } + +/** + * @brief QET::eachStrIsEqual + * @param qsl list of string to compare + * @return true if every string is identical, else false; + * The list must not be empty + * If the list can be empty, call isEmpty() before calling this function + */ +bool QET::eachStrIsEqual(const QStringList &qsl) { + if (qsl.size() == 1) return true; + foreach (const QString t, qsl) { + if (qsl.at(0) != t) return false; + } + return true; +} diff --git a/sources/qet.h b/sources/qet.h index f77b2baf0..2e4ab0ee9 100644 --- a/sources/qet.h +++ b/sources/qet.h @@ -154,6 +154,7 @@ namespace QET { QString titleBlockColumnLengthToString(const TitleBlockColumnLength &); bool writeXmlFile(QDomDocument &, const QString &, QString * = 0); QPointF graphicsSceneEventPos(QEvent *); + bool eachStrIsEqual (const QStringList &qsl); } class Qet : public QObject {