Skip to content

Commit

Permalink
COMP: Fix endl deprecation warning
Browse files Browse the repository at this point in the history
warning C4996: 'QTextStreamFunctions::endl': Use Qt::endl
  • Loading branch information
jamesobutler authored and jcfr committed Jun 22, 2020
1 parent 5cc267a commit 2966c88
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Libs/Core/ctkFileLogger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,11 @@ void ctkFileLogger::logMessage(const QString& msg)
return;
}
QTextStream s(&f);
#if (QT_VERSION >= QT_VERSION_CHECK(5,14,0))
s << msg << Qt::endl;
#else
s << msg << endl;
#endif
f.close();
}

60 changes: 60 additions & 0 deletions Libs/QtTesting/ctkEventTranslatorPlayerWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,10 +279,17 @@ bool ctkEventTranslatorPlayerWidget::compare(const double &actual,
{
if (actual != expected)
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,14,0))
QTextStream(stderr, QIODevice::WriteOnly)
<< "Line " << line << " - Problem with function " << function << "\n"
<< "\tActual value : '" << actualName << "' = " << actual << " \n"
<< "\tExpected value : '" << expectedName << "' = " << expected << Qt::endl;
#else
QTextStream(stderr, QIODevice::WriteOnly)
<< "Line " << line << " - Problem with function " << function << "\n"
<< "\tActual value : '" << actualName << "' = " << actual << " \n"
<< "\tExpected value : '" << expectedName << "' = " << expected << endl;
#endif
QApplication::exit(EXIT_FAILURE);
return false;
}
Expand All @@ -298,10 +305,17 @@ bool ctkEventTranslatorPlayerWidget::compare(const int &actual,
{
if (actual != expected)
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,14,0))
QTextStream(stderr, QIODevice::WriteOnly)
<< "Line " << line << " - Problem with function " << function << "\n"
<< "\tActual value : '" << actualName << "' = " << actual << " \n"
<< "\tExpected value : '" << expectedName << "' = " << expected << Qt::endl;
#else
QTextStream(stderr, QIODevice::WriteOnly)
<< "Line " << line << " - Problem with function " << function << "\n"
<< "\tActual value : '" << actualName << "' = " << actual << " \n"
<< "\tExpected value : '" << expectedName << "' = " << expected << endl;
#endif
QApplication::exit(EXIT_FAILURE);
return false;
}
Expand All @@ -318,10 +332,17 @@ bool ctkEventTranslatorPlayerWidget::compare(const QString& actual,
{
if (actual != expected)
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,14,0))
QTextStream(stderr, QIODevice::WriteOnly)
<< "Line " << line << " - Problem with function " << function << "\n"
<< "\tActual value : '" << actualName << "' = " << actual << " \n"
<< "\tExpected value : '" << expectedName << "' = " << expected << Qt::endl;
#else
QTextStream(stderr, QIODevice::WriteOnly)
<< "Line " << line << " - Problem with function " << function << "\n"
<< "\tActual value : '" << actualName << "' = " << actual << " \n"
<< "\tExpected value : '" << expectedName << "' = " << expected << endl;
#endif
QApplication::exit(EXIT_FAILURE);
return false;
}
Expand All @@ -338,10 +359,17 @@ bool ctkEventTranslatorPlayerWidget::compare(const QStringList& actual,
{
if (actual != expected)
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,14,0))
QTextStream(stderr, QIODevice::WriteOnly)
<< "Line " << line << " - Problem with function " << function << "\n"
<< "\tActual value : '" << actualName << "' = " << actual.join(" ") << " \n"
<< "\tExpected value : '" << expectedName << "' = " << expected.join(" ") << Qt::endl;
#else
QTextStream(stderr, QIODevice::WriteOnly)
<< "Line " << line << " - Problem with function " << function << "\n"
<< "\tActual value : '" << actualName << "' = " << actual.join(" ") << " \n"
<< "\tExpected value : '" << expectedName << "' = " << expected.join(" ") << endl;
#endif
QApplication::exit(EXIT_FAILURE);
return false;
}
Expand All @@ -358,10 +386,17 @@ bool ctkEventTranslatorPlayerWidget::compare(const QDateTime& actual,
{
if (actual != expected)
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,14,0))
QTextStream(stderr, QIODevice::WriteOnly)
<< "Line " << line << " - Problem with function " << function << "\n"
<< "\tActual value : '" << actualName << "' = " << actual.date().toString() << " \n"
<< "\tExpected value : '" << expectedName << "' = " << expected.date().toString() << Qt::endl;
#else
QTextStream(stderr, QIODevice::WriteOnly)
<< "Line " << line << " - Problem with function " << function << "\n"
<< "\tActual value : '" << actualName << "' = " << actual.date().toString() << " \n"
<< "\tExpected value : '" << expectedName << "' = " << expected.date().toString() << endl;
#endif
QApplication::exit(EXIT_FAILURE);
return false;
}
Expand All @@ -378,10 +413,17 @@ bool ctkEventTranslatorPlayerWidget::compare(const QColor& actual,
{
if (actual != expected)
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,14,0))
QTextStream(stderr, QIODevice::WriteOnly)
<< "Line " << line << " - Problem with function " << function << "\n"
<< "\tActual value : '" << actualName << "' = R:" << actual.red() << " G:"<< actual.green() << " B:" << actual.blue() << "\n"
<< "\tExpected value : '" << expectedName << "' = R:" << expected.red() << " G:"<< expected.green() << " B:" << expected.blue()<< Qt::endl;
#else
QTextStream(stderr, QIODevice::WriteOnly)
<< "Line " << line << " - Problem with function " << function << "\n"
<< "\tActual value : '" << actualName << "' = R:" << actual.red() << " G:"<< actual.green() << " B:" << actual.blue() << "\n"
<< "\tExpected value : '" << expectedName << "' = R:" << expected.red() << " G:"<< expected.green() << " B:" << expected.blue()<< endl;
#endif
QApplication::exit(EXIT_FAILURE);
return false;
}
Expand All @@ -406,18 +448,30 @@ bool ctkEventTranslatorPlayerWidget::compare(const QImage& actual,
// images are not the same if one images contains a null image
if (actual.isNull() || expected.isNull())
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,14,0))
QTextStream(stderr, QIODevice::WriteOnly)
<< "Line " << line << " - 1 image is Null " << function << "\n" << Qt::endl;
#else
QTextStream(stderr, QIODevice::WriteOnly)
<< "Line " << line << " - 1 image is Null " << function << "\n" << endl;
#endif
QApplication::exit(EXIT_FAILURE);
return false;
}
// images do not have the same size
if (actual.size() != expected.size())
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,14,0))
QTextStream(stderr, QIODevice::WriteOnly)
<< "Line " << line << " - The 2 Images don't have the same size " << function << "\n"
<< "\tActual value : '" << actualName << "' = W:" << actual.width() << " H:"<< actual.height() << "\n"
<< "\tExpected value : '" << expectedName << "' = W:" << expected.width() << " H:"<< expected.height() << Qt::endl;
#else
QTextStream(stderr, QIODevice::WriteOnly)
<< "Line " << line << " - The 2 Images don't have the same size " << function << "\n"
<< "\tActual value : '" << actualName << "' = W:" << actual.width() << " H:"<< actual.height() << "\n"
<< "\tExpected value : '" << expectedName << "' = W:" << expected.width() << " H:"<< expected.height() << endl;
#endif
QApplication::exit(EXIT_FAILURE);
return false;
}
Expand All @@ -444,9 +498,15 @@ bool ctkEventTranslatorPlayerWidget::compare(const QImage& actual,
totaldiff = (totaldiff * 100) / (a.width() * a.height());
if (totaldiff >= 0.01)
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,14,0))
QTextStream(stderr, QIODevice::WriteOnly)
<< "Line " << line << " - The 2 Images have "
<< totaldiff << "% differencies \n" << Qt::endl;
#else
QTextStream(stderr, QIODevice::WriteOnly)
<< "Line " << line << " - The 2 Images have "
<< totaldiff << "% differencies \n" << endl;
#endif
QApplication::exit(EXIT_FAILURE);
return false;
}
Expand Down
14 changes: 14 additions & 0 deletions Libs/Visualization/VTK/Core/ctkVTKConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,19 @@ vtkObject* ctkVTKConnection::vtkobject() const
QDebug operator<<(QDebug dbg, const ctkVTKConnection& connection)
{
const ctkVTKConnectionPrivate* d = connection.d_func();
#if (QT_VERSION >= QT_VERSION_CHECK(5,14,0))
dbg.nospace() << "ctkVTKConnection:" << &connection << Qt::endl
<< "Id:" << d->Id << Qt::endl
<< " VTKObject:" << (d->VTKObject ? d->VTKObject->GetClassName() : "<null>")
<< "(" << d->VTKObject << ")" << Qt::endl
<< " QtObject:" << d->QtObject << Qt::endl
<< " VTKEvent:" << d->VTKEvent << Qt::endl
<< " QtSlot:" << d->QtSlot << Qt::endl
<< " SlotType:" << d->SlotType << Qt::endl
<< " Priority:" << d->Priority << Qt::endl
<< " Connected:" << d->Connected << Qt::endl
<< " Blocked:" << d->Blocked;
#else
dbg.nospace() << "ctkVTKConnection:" << &connection << endl
<< "Id:" << d->Id << endl
<< " VTKObject:" << (d->VTKObject ? d->VTKObject->GetClassName() : "<null>")
Expand All @@ -260,6 +273,7 @@ QDebug operator<<(QDebug dbg, const ctkVTKConnection& connection)
<< " Priority:" << d->Priority << endl
<< " Connected:" << d->Connected << endl
<< " Blocked:" << d->Blocked;
#endif
return dbg.space();
}

Expand Down
7 changes: 7 additions & 0 deletions Libs/Visualization/VTK/Core/ctkVTKObjectEventsObserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,17 @@ void ctkVTKObjectEventsObserver::printAdditionalInfo()
{
this->Superclass::dumpObjectInfo();
Q_D(ctkVTKObjectEventsObserver);
#if (QT_VERSION >= QT_VERSION_CHECK(5,14,0))
qDebug() << "ctkVTKObjectEventsObserver:" << this << Qt::endl
<< " AllBlocked:" << d->AllBlocked << Qt::endl
<< " Parent:" << (this->parent()?this->parent()->objectName():"NULL") << Qt::endl
<< " Connection count:" << d->connections().count();
#else
qDebug() << "ctkVTKObjectEventsObserver:" << this << endl
<< " AllBlocked:" << d->AllBlocked << endl
<< " Parent:" << (this->parent()?this->parent()->objectName():"NULL") << endl
<< " Connection count:" << d->connections().count();
#endif

// Loop through all connection
foreach (const ctkVTKConnection* connection, d->connections())
Expand Down
11 changes: 11 additions & 0 deletions Libs/Widgets/ctkAddRemoveComboBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,16 @@ ctkAddRemoveComboBox::~ctkAddRemoveComboBox()
void ctkAddRemoveComboBox::printAdditionalInfo()
{
Q_D(ctkAddRemoveComboBox);
#if (QT_VERSION >= QT_VERSION_CHECK(5,14,0))
qDebug() << "ctkAddRemoveComboBox:" << this << Qt::endl
<< " EmptyText:" << d->EmptyText << Qt::endl
<< " AddingEmptyItem:" << d->AddingEmptyItem << Qt::endl
<< " RemovingEmptyItem:" << d->RemovingEmptyItem << Qt::endl
<< " AddEnabled:" << d->AddEnabled << Qt::endl
<< " RemoveEnabled:" << d->RemoveEnabled << Qt::endl
<< " EditEnabled:" << d->EditEnabled << Qt::endl
<< " HasEmptyItem:" << d->HasEmptyItem;
#else
qDebug() << "ctkAddRemoveComboBox:" << this << endl
<< " EmptyText:" << d->EmptyText << endl
<< " AddingEmptyItem:" << d->AddingEmptyItem << endl
Expand All @@ -158,6 +168,7 @@ void ctkAddRemoveComboBox::printAdditionalInfo()
<< " RemoveEnabled:" << d->RemoveEnabled << endl
<< " EditEnabled:" << d->EditEnabled << endl
<< " HasEmptyItem:" << d->HasEmptyItem;
#endif
}

// --------------------------------------------------------------------------
Expand Down

0 comments on commit 2966c88

Please sign in to comment.