This looks valid, and compiles fine, but gives astonishing results. It doesn't really work.

if (myQwtText == myQString) ...

When evaluating this comparison expression, a temporary QwtText instance is created from the QString using this constructor:

QwtText (const QString &=QString::null, TextFormat textFormat=AutoText)

If myQwtText happens to have a TextFormat different from AutoText, the comparison will fail even if the text content of the two variables is the same.

One way to resolve this is to religiously call the QwtText::text() method when comparing to a QString, i.e. ...

if (myQwtText.text() == myQString) ...

But it's easy to forget to do that. (The problematic form totally compiles). A better way to handle this is to define these two global functions -- (this is what we've done):

bool operator== (const QwtText& lhs, const QString& rhs) { return (lhs.text() == rhs); }
bool operator== (const QString& lhs, const QwtText& rhs) { return (lhs == rhs.text()); }

Ideally these would be declared in the qwt_text.h header file. Another way to handle this might have been to make the QwtText constructor "explicit" so that the problematic comparison above would not compile.

Something may have shifted from Qwt 5.2.1 and Qwt 5.2.3, and may be an issue for Qwt 6. (Perhaps the default TextFormat variable in the QwtText constructor). Whatever it was, we believe this wasn't a problem for us before (with Qwt 5.2.1).