Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix additional warnings #1098

Merged
merged 12 commits into from
Jun 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,9 @@ QVariant ctkPluginResourcesTreeModel::data(const QModelIndex &index, int role) c
Qt::ItemFlags ctkPluginResourcesTreeModel::flags(const QModelIndex &index) const
{
if (!index.isValid())
return 0;
{
return Qt::ItemFlags();
}

return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
}
Expand Down
2 changes: 1 addition & 1 deletion Applications/ctkPluginBrowser/ctkQtResourcesTreeModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ QVariant ctkQtResourcesTreeModel::data(const QModelIndex &index, int role) const
Qt::ItemFlags ctkQtResourcesTreeModel::flags(const QModelIndex &index) const
{
if (!index.isValid())
return 0;
return Qt::ItemFlags();

return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
}
Expand Down
2 changes: 1 addition & 1 deletion CMakeExternals/QtSOAP.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ endif()

if(NOT DEFINED QtSOAP_DIR)

set(revision_tag 9c321151f19c87504eb55d53802eaf42e11bb989)
set(revision_tag 2e967e902c27b4ab76f8dcbffbf6037eac4abd05)
if(${proj}_REVISION_TAG)
set(revision_tag ${${proj}_REVISION_TAG})
endif()
Expand Down
2 changes: 1 addition & 1 deletion CMakeExternals/QtTesting.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if(NOT DEFINED QtTesting_DIR)
if("${CMAKE_CXX_STANDARD}" STREQUAL "98")
set(revision_tag c44b32fdea827be737e8c2f5608ffbc2e3bd08b2)
else()
set(revision_tag b5324a213dc3c4abd7b588575ea926db57aa981e)
set(revision_tag a86bee55104f553a1cb82b9cf0b109d9f1e95dbf) # ctk-2019-03-14-b5324a2
endif()
if(${proj}_REVISION_TAG)
set(revision_tag ${${proj}_REVISION_TAG})
Expand Down
2 changes: 1 addition & 1 deletion Libs/PluginFramework/ctkPluginStorageSQL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ QLibrary::LoadHints ctkPluginStorageSQL::getPluginLoadHints() const
return loadHintsVariant.value<QLibrary::LoadHints>();
}
}
return QLibrary::LoadHints(0);
return QLibrary::LoadHints();
}

//----------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion Libs/PluginFramework/ctkPlugins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ void ctkPlugins::startPlugins(const QList<ctkPlugin*>& slist) const
{
try
{
plugin->start(0);
plugin->start();
}
catch (const ctkPluginException& pe)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ int ctkVTKAbstractViewTest1(int argc, char * argv [] )
CHECK_BOOL(RenderCount == 0, false);

bool sliceViewWasPaused = sliceView.pauseRender();
CHECK_BOOL(sliceViewWasPaused, true);
RenderCount = 0;
sliceView.scheduleRender();
sleep_ms(100);
Expand Down
2 changes: 1 addition & 1 deletion Libs/Visualization/VTK/Widgets/ctkVTKPropertyWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ vtkProperty* ctkVTKPropertyWidget::property()const
ctkVTKPropertyWidget::GroupsState ctkVTKPropertyWidget::groupsState()const
{
Q_D(const ctkVTKPropertyWidget);
ctkVTKPropertyWidget::GroupsState state = 0;
ctkVTKPropertyWidget::GroupsState state;
ctkVTKPropertyWidget* constThis = const_cast<ctkVTKPropertyWidget*>(this);
if (d->RepresentationCollapsibleGroupBox->isVisibleTo(constThis) )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,18 @@ bool ctkVTKRenderViewEventTranslator::translateEvent(QObject *Object,
if(wheelEvent)
{
QSize size = widget->size();
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
double normalized_x = wheelEvent->position().x() / static_cast<double>(size.width() / 2.0);
double normalized_y = wheelEvent->position().y() / static_cast<double>(size.height() / 2.0);
#else
double normalized_x = wheelEvent->x()/static_cast<double>(size.width()/2.0);
double normalized_y = wheelEvent->y()/static_cast<double>(size.height()/2.0);
#endif
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
int numStep = (wheelEvent->angleDelta().y() > 0 ) ? 1 : 0;
#else
int numStep = (wheelEvent->delta() > 0 ) ? 1 : 0;
#endif
int buttons = wheelEvent->buttons();
int modifiers = wheelEvent->modifiers();
emit emit recordEvent(Object, "mouseWheel", QString("(%1,%2,%3,%4,%5)")
Expand Down
2 changes: 1 addition & 1 deletion Libs/Widgets/Plugins/ctkPopupWidgetPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ QWidget *ctkPopupWidgetPlugin::createWidget(QWidget* widgetParent)
{
ctkPopupWidget* newWidget = new ctkPopupWidget(widgetParent);
// if the widget is a tooltip, it wouldn't accept children
newWidget->setWindowFlags(0);
newWidget->setWindowFlags(Qt::WindowFlags());
// if the widget auto hides, it disappear from the workplace and don't allow
// children anymore.
newWidget->setAutoHide(false);
Expand Down
12 changes: 6 additions & 6 deletions Libs/Widgets/Testing/Cpp/ctkErrorLogModelTerminalOutputTest1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ int ctkErrorLogModelTerminalOutputTest1(int argc, char * argv [])
QString errorMsg;

ctkErrorLogModel model;
ctkErrorLogTerminalOutput::TerminalOutputs currentTerminalOutputEnabled = model.terminalOutputs();
errorMsg = checkBoolean(__LINE__, "TerminalOutputEnabled",
currentTerminalOutputEnabled, ctkErrorLogTerminalOutput::None);
ctkErrorLogTerminalOutput::TerminalOutputs currentTerminalOutput = model.terminalOutputs();
errorMsg = checkInteger(__LINE__, "TerminalOutput",
currentTerminalOutput, ctkErrorLogTerminalOutput::None);
if (!errorMsg.isEmpty())
{
model.disableAllMsgHandler();
Expand All @@ -122,9 +122,9 @@ int ctkErrorLogModelTerminalOutputTest1(int argc, char * argv [])

model.setTerminalOutputs(ctkErrorLogTerminalOutput::All);

currentTerminalOutputEnabled = model.terminalOutputs();
errorMsg = checkBoolean(__LINE__, "TerminalOutputEnabled",
currentTerminalOutputEnabled, ctkErrorLogTerminalOutput::All);
currentTerminalOutput = model.terminalOutputs();
errorMsg = checkInteger(__LINE__, "TerminalOutput",
currentTerminalOutput, ctkErrorLogTerminalOutput::All);
if (!errorMsg.isEmpty())
{
model.disableAllMsgHandler();
Expand Down
28 changes: 18 additions & 10 deletions Libs/Widgets/ctkPathLineEdit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,11 @@ class ctkFileCompleter : public QCompleter
// and the global shared file system models are used. If name filters are set then
// a custom custom file system is created for the widget.
void setNameFilters(const QStringList& filters);
QStringList nameFilters() const;

// Since nameFilters() function may be relevant when more work will be done,
// it is commented to quiet the "-Wunused-function" warning.
//
// QStringList nameFilters() const;

protected:
QFileSystemModel* CustomFileSystemModel;
Expand Down Expand Up @@ -209,15 +213,19 @@ void ctkFileCompleter::setNameFilters(const QStringList& filters)
}

//-----------------------------------------------------------------------------
QStringList ctkFileCompleter::nameFilters() const
{
QFileSystemModel* fileSystemModel = this->fileSystemModel();
if (!fileSystemModel)
{
return QStringList();
}
return fileSystemModel->nameFilters();
}
// Since nameFilters() function may be relevant when more work will be done,
// it is commented to quiet the "-Wunused-function" warning.
//
//-----------------------------------------------------------------------------
//QStringList ctkFileCompleter::nameFilters() const
//{
// QFileSystemModel* fileSystemModel = this->fileSystemModel();
// if (!fileSystemModel)
// {
// return QStringList();
// }
// return fileSystemModel->nameFilters();
//}

//-----------------------------------------------------------------------------
QFileSystemModel* ctkFileCompleter::fileSystemModel() const
Expand Down
4 changes: 2 additions & 2 deletions Libs/Widgets/ctkRangeSlider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ ctkRangeSliderPrivate::ctkRangeSliderPrivate(ctkRangeSlider& object)
this->m_SubclassClickOffset = 0;
this->m_SubclassPosition = 0;
this->m_SubclassWidth = 0.0;
this->m_SelectedHandles = 0;
this->m_SelectedHandles = ctkRangeSliderPrivate::Handles();
this->m_SymmetricMoves = false;
}

Expand Down Expand Up @@ -773,7 +773,7 @@ void ctkRangeSlider::mouseReleaseEvent(QMouseEvent* mouseEvent)
this->QSlider::mouseReleaseEvent(mouseEvent);

setSliderDown(false);
d->m_SelectedHandles = 0;
d->m_SelectedHandles = ctkRangeSliderPrivate::Handles();

this->update();
}
Expand Down
11 changes: 10 additions & 1 deletion Libs/Widgets/ctkSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Qt includes
#include <QDialog>
#include <QMainWindow>
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
#include <QGuiApplication>
#include <QScreen>
#else
#include <QDesktopWidget>
#endif

//-----------------------------------------------------------------------------
ctkSettings::ctkSettings(const QString& organization,
Expand Down Expand Up @@ -133,9 +138,13 @@ void ctkSettings::restoreState(const QString& key, QMainWindow& window)
{
QPoint windowTopLeft = this->value("Position").toPoint();
QRect mwRect(windowTopLeft, window.size());


#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
QRect desktopRect = QGuiApplication::primaryScreen()->availableGeometry();
#else
QDesktopWidget desktop;
QRect desktopRect = desktop.availableGeometry( desktop.primaryScreen() );
#endif
// try moving it to keep size
if(!desktopRect.contains(mwRect))
{
Expand Down
8 changes: 8 additions & 0 deletions Libs/Widgets/ctkTreeComboBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@

// Qt includes
#include <QApplication>
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
#include <QScreen>
#else
#include <QDesktopWidget>
#endif
#include <QEvent>
#include <QHeaderView>
#include <QKeyEvent>
Expand Down Expand Up @@ -239,8 +243,12 @@ void ctkTreeComboBox::resizePopup()
this->initStyleOption(&opt);
QRect listRect(style->subControlRect(QStyle::CC_ComboBox, &opt,
QStyle::SC_ComboBoxListBoxPopup, this));
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
QRect screen = this->screen()->availableGeometry();
#else
QRect screen = QApplication::desktop()->availableGeometry(
QApplication::desktop()->screenNumber(this));
#endif
QPoint below = this->mapToGlobal(listRect.bottomLeft());
int belowHeight = screen.bottom() - below.y();
QPoint above = this->mapToGlobal(listRect.topLeft());
Expand Down
3 changes: 3 additions & 0 deletions Plugins/org.commontk.configadmin/Testing/Cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ set(test_executable ${PROJECT_NAME}CppTests)

set(${test_executable}_DEPENDENCIES ${fw_lib} ${fwtestutil_lib} CTKCore)

# Ensure "ctkCompatibility_p.h" included from the export header is found
list(APPEND ${test_executable}_DEPENDENCIES CTKCore)

set(my_includes)
ctkFunctionGetIncludeDirs(my_includes ${test_executable})
include_directories(${my_includes})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,13 @@ void ctkCommandLineModuleAppLogic::onLoadDataClicked()

void ctkCommandLineModuleAppLogic::onCreateSecondaryCapture()
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
QPixmap pixmap = ui.PlaceHolderForImage->pixmap(Qt::ReturnByValue);
if (!pixmap.isNull())
#else
const QPixmap* pixmap = ui.PlaceHolderForImage->pixmap();
if(pixmap!=NULL)
#endif
{
QString templatefilename = QDir(OutputLocation).absolutePath();
if(templatefilename.isEmpty()==false) templatefilename.append('/');
Expand All @@ -325,7 +330,11 @@ void ctkCommandLineModuleAppLogic::onCreateSecondaryCapture()
outputtmp.close();
}

#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
pixmap.save(inputFileName);
#else
pixmap->save(inputFileName);
#endif

ModuleFrontend->setValue("fileVar", inputFileName);
ModuleFrontend->setValue("dirVar", outputFileName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,13 @@ void ctkExampleDicomAppLogic::onLoadDataClicked()

void ctkExampleDicomAppLogic::onCreateSecondaryCapture()
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
QPixmap tmppixmap = ui.PlaceHolderForImage->pixmap(Qt::ReturnByValue);
if (!tmppixmap.isNull())
#else
const QPixmap* pixmap = ui.PlaceHolderForImage->pixmap();
if(pixmap!=NULL)
#endif
{
QStringList preferredProtocols;
preferredProtocols.append("file:");
Expand All @@ -296,7 +301,11 @@ void ctkExampleDicomAppLogic::onCreateSecondaryCapture()
QString filename = QFileInfo(tempfile->fileName()).absoluteFilePath();
qDebug() << "Created file: " << filename;
tempfile->close();
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
// tmppixmap is already set
#else
QPixmap tmppixmap(*pixmap);
#endif
QPainter painter(&tmppixmap);
painter.setPen(Qt::white);
painter.setFont(QFont("Arial", 15));
Expand Down
3 changes: 3 additions & 0 deletions Plugins/org.commontk.eventadmin/Testing/Cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ set(test_executable ${PROJECT_NAME}CppTests)

set(${test_executable}_DEPENDENCIES ${fw_lib} ${fwtestutil_lib})

# Ensure "ctkCompatibility_p.h" included from the export header is found
list(APPEND ${test_executable}_DEPENDENCIES CTKCore)

set(my_includes)
ctkFunctionGetIncludeDirs(my_includes ${test_executable})
include_directories(${my_includes})
Expand Down
3 changes: 3 additions & 0 deletions Plugins/org.commontk.metatype/Testing/Cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ set(test_executable ${PROJECT_NAME}CppTests)

set(${test_executable}_DEPENDENCIES ${fw_lib} ${fwtestutil_lib})

# Ensure "ctkCompatibility_p.h" included from the export header is found
list(APPEND ${test_executable}_DEPENDENCIES CTKCore)

set(my_includes)
ctkFunctionGetIncludeDirs(my_includes ${test_executable})
include_directories(${my_includes})
Expand Down