diff --git a/CMake/CTKConfig.cmake.in b/CMake/CTKConfig.cmake.in index 908f241eef..9b51363c3a 100644 --- a/CMake/CTKConfig.cmake.in +++ b/CMake/CTKConfig.cmake.in @@ -63,17 +63,19 @@ include("${CTK_CMAKE_DIR}/ctkMacroTargetLibraries.cmake") # Import multiple macr include("${CTK_CMAKE_DIR}/ctkFunctionExtractOptionNameAndValue.cmake") include("${CTK_CMAKE_DIR}/ctkMacroValidateBuildOptions.cmake") include("${CTK_CMAKE_DIR}/ctkFunctionGenerateDGraphInput.cmake") +include("${CTK_CMAKE_DIR}/ctkFunctionGetIncludeDirs.cmake") +include("${CTK_CMAKE_DIR}/ctkFunctionGetLibraryDirs.cmake") +include("${CTK_CMAKE_DIR}/ctkMacroGenerateMocs.cmake") + +# PluginFramework include("${CTK_CMAKE_DIR}/ctkFunctionGeneratePluginManifest.cmake") include("${CTK_CMAKE_DIR}/ctkFunctionGeneratePluginUseFile.cmake") include("${CTK_CMAKE_DIR}/ctkMacroGeneratePluginResourceFile.cmake") -include("${CTK_CMAKE_DIR}/ctkFunctionGetIncludeDirs.cmake") -include("${CTK_CMAKE_DIR}/ctkFunctionGetLibraryDirs.cmake") include("${CTK_CMAKE_DIR}/ctkFunctionExtractPluginTargets.cmake") include("${CTK_CMAKE_DIR}/ctkFunctionGetAllPluginTargets.cmake") include("${CTK_CMAKE_DIR}/ctkFunctionGetTargetDependencies.cmake") include("${CTK_CMAKE_DIR}/ctkFunctionGetPluginDependencies.cmake") include("${CTK_CMAKE_DIR}/ctkMacroSetupPlugins.cmake") -include("${CTK_CMAKE_DIR}/ctkMacroGenerateMocs.cmake") include(CMakeFindDependencyMacro) diff --git a/CMake/ctkLinkerAsNeededFlagCheck/CMakeLists.txt b/CMake/ctkLinkerAsNeededFlagCheck/CMakeLists.txt index 0191c1cb4b..c9666ad328 100644 --- a/CMake/ctkLinkerAsNeededFlagCheck/CMakeLists.txt +++ b/CMake/ctkLinkerAsNeededFlagCheck/CMakeLists.txt @@ -1,3 +1,4 @@ +cmake_minimum_required(VERSION 3.0 FATAL_ERROR) project(ctkLinkerAsNeededFlagCheck) add_library(A SHARED A.cpp) add_library(B SHARED B.cpp) diff --git a/CMake/ctkMacroSetupQt.cmake b/CMake/ctkMacroSetupQt.cmake index 3ee9035651..cfd93cf345 100644 --- a/CMake/ctkMacroSetupQt.cmake +++ b/CMake/ctkMacroSetupQt.cmake @@ -20,14 +20,6 @@ #! \ingroup CMakeUtilities macro(ctkMacroSetupQt) - set(CTK_QT_VERSION "5" CACHE STRING "Expected Qt version") - mark_as_advanced(CTK_QT_VERSION) - - set_property(CACHE CTK_QT_VERSION PROPERTY STRINGS 5) - - if(NOT CTK_QT_VERSION VERSION_EQUAL "5") - message(FATAL_ERROR "Expected value for CTK_QT_VERSION is '5'") - endif() if(CTK_QT_VERSION VERSION_EQUAL "5") cmake_minimum_required(VERSION 2.8.12) @@ -61,7 +53,7 @@ macro(ctkMacroSetupQt) if(CTK_LIB_DICOM/Core OR CTK_LIB_DICOM/Widgets - OR Libs/PluginFramework + OR CTK_LIB_PluginFramework ) list(APPEND CTK_QT5_COMPONENTS Sql) endif() @@ -139,6 +131,4 @@ macro(ctkMacroSetupQt) else() message(FATAL_ERROR "Support for Qt${CTK_QT_VERSION} is not implemented") endif() - - mark_as_superbuild(CTK_QT_VERSION) endmacro() diff --git a/CMakeLists.txt b/CMakeLists.txt index 6ba2e9c52b..a2777f6a52 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -102,6 +102,14 @@ mark_as_superbuild( option(CTK_SUPERBUILD "Build ${PROJECT_NAME} and the projects it depends on." ON) mark_as_advanced(CTK_SUPERBUILD) +#----------------------------------------------------------------------------- +# Qt version +# +set(CTK_QT_VERSION "5" CACHE STRING "Expected Qt version") +mark_as_advanced(CTK_QT_VERSION) +set_property(CACHE CTK_QT_VERSION PROPERTY STRINGS 5) +mark_as_superbuild(CTK_QT_VERSION) + #----------------------------------------------------------------------------- # Output directories. # @@ -1131,6 +1139,23 @@ endif() # add_subdirectory( Documentation ) +#--------------------------------------------------------------------------- +# Install rules +# +foreach(file + # PluginFramework + CMake/ctkFunctionGeneratePluginManifest.cmake + CMake/ctkFunctionGeneratePluginUseFile.cmake + CMake/ctkMacroGeneratePluginResourceFile.cmake + CMake/ctkFunctionExtractPluginTargets.cmake + CMake/ctkFunctionGetAllPluginTargets.cmake + CMake/ctkFunctionGetTargetDependencies.cmake + CMake/ctkFunctionGetPluginDependencies.cmake + CMake/ctkMacroSetupPlugins.cmake + ) + install(FILES ${file} DESTINATION ${CTK_INSTALL_CMAKE_DIR} COMPONENT Development) +endforeach() + #----------------------------------------------------------------------------- # The commands in this directory are intended to be executed as # the end of the whole configuration process, as a "last step". diff --git a/Libs/DICOM/Widgets/ctkDICOMBrowser.cpp b/Libs/DICOM/Widgets/ctkDICOMBrowser.cpp index 344810e1f7..22dda34897 100644 --- a/Libs/DICOM/Widgets/ctkDICOMBrowser.cpp +++ b/Libs/DICOM/Widgets/ctkDICOMBrowser.cpp @@ -1092,10 +1092,29 @@ bool ctkDICOMBrowser::confirmDeleteSelectedUIDs(QStringList uids) ctkMessageBox confirmDeleteDialog; QString message = tr("Do you want to delete the following selected items?"); + // calculate maximum number of rows that fit in the browser widget to have a reasonable limit + // on the items to show in the dialog + int browserHeight = this->geometry().height(); + int patientsTableRowHeight = d->dicomTableManager->patientsTable()->tableView()->rowHeight(0); + int maxNumberOfPatientsToShow = browserHeight / patientsTableRowHeight - 3; // subtract 3 due to the checkbox, buttons, and header + if (maxNumberOfPatientsToShow < 3) + { + // make sure there are a meaningful number of items shown + maxNumberOfPatientsToShow = 3; + } + // add the information about the selected UIDs int numUIDs = uids.size(); for (int i = 0; i < numUIDs; ++i) { + if (i >= maxNumberOfPatientsToShow && numUIDs > maxNumberOfPatientsToShow + 1) + { + // displayed when there are additional DICOM items to delete that do not fit on screen + // note: do not show this message if there is only one more to show (the message also takes a line) + message += QString("\n") + tr("(and %1 more)").arg(numUIDs - maxNumberOfPatientsToShow); + break; + } + QString uid = uids.at(i); // try using the given UID to find a descriptive string diff --git a/Libs/Visualization/VTK/Widgets/ctkVTKAbstractView.cpp b/Libs/Visualization/VTK/Widgets/ctkVTKAbstractView.cpp index 965108b671..2a44ce1991 100644 --- a/Libs/Visualization/VTK/Widgets/ctkVTKAbstractView.cpp +++ b/Libs/Visualization/VTK/Widgets/ctkVTKAbstractView.cpp @@ -64,6 +64,9 @@ ctkVTKAbstractViewPrivate::ctkVTKAbstractViewPrivate(ctkVTKAbstractView& object) this->PauseRenderCount = 0; } +// -------------------------------------------------------------------------- +ctkVTKAbstractViewPrivate::~ctkVTKAbstractViewPrivate() = default; + // -------------------------------------------------------------------------- void ctkVTKAbstractViewPrivate::init() { diff --git a/Libs/Visualization/VTK/Widgets/ctkVTKAbstractView_p.h b/Libs/Visualization/VTK/Widgets/ctkVTKAbstractView_p.h index 76693d7508..e2f9ff863f 100644 --- a/Libs/Visualization/VTK/Widgets/ctkVTKAbstractView_p.h +++ b/Libs/Visualization/VTK/Widgets/ctkVTKAbstractView_p.h @@ -52,6 +52,7 @@ class ctkVTKAbstractViewPrivate : public QObject public: ctkVTKAbstractViewPrivate(ctkVTKAbstractView& object); + virtual ~ctkVTKAbstractViewPrivate(); /// Convenient setup methods virtual void init(); diff --git a/Libs/Visualization/VTK/Widgets/ctkVTKRenderView.cpp b/Libs/Visualization/VTK/Widgets/ctkVTKRenderView.cpp index 620bccc95c..0ce88a8f16 100644 --- a/Libs/Visualization/VTK/Widgets/ctkVTKRenderView.cpp +++ b/Libs/Visualization/VTK/Widgets/ctkVTKRenderView.cpp @@ -60,6 +60,21 @@ ctkVTKRenderViewPrivate::ctkVTKRenderViewPrivate(ctkVTKRenderView& object) this->Orientation->SetOrientationMarker(this->Axes); } +// -------------------------------------------------------------------------- +ctkVTKRenderViewPrivate::~ctkVTKRenderViewPrivate() = default; + +// -------------------------------------------------------------------------- +void ctkVTKRenderViewPrivate::init() +{ + this->ctkVTKAbstractViewPrivate::init(); + + // The interactor in RenderWindow exists after the renderwindow is set to + // the QVTKWidet + this->Orientation->SetInteractor(this->RenderWindow->GetInteractor()); + this->Orientation->SetEnabled(1); + this->Orientation->InteractiveOff(); +} + // -------------------------------------------------------------------------- void ctkVTKRenderViewPrivate::setupCornerAnnotation() { @@ -204,18 +219,21 @@ ctkVTKRenderView::ctkVTKRenderView(QWidget* parentWidget) { Q_D(ctkVTKRenderView); d->init(); +} - // The interactor in RenderWindow exists after the renderwindow is set to - // the QVTKWidet - d->Orientation->SetInteractor(d->RenderWindow->GetInteractor()); - d->Orientation->SetEnabled(1); - d->Orientation->InteractiveOff(); +// -------------------------------------------------------------------------- +ctkVTKRenderView::ctkVTKRenderView(ctkVTKRenderViewPrivate* pimpl, QWidget* parentWidget) + : Superclass(pimpl, parentWidget) +{ + // derived classes must call init manually. Calling init() here may results in + // actions on a derived public class not yet finished to be created } //---------------------------------------------------------------------------- ctkVTKRenderView::~ctkVTKRenderView() { } + //---------------------------------------------------------------------------- void ctkVTKRenderView::setInteractor(vtkRenderWindowInteractor* newInteractor) { diff --git a/Libs/Visualization/VTK/Widgets/ctkVTKRenderView.h b/Libs/Visualization/VTK/Widgets/ctkVTKRenderView.h index 2f2ce2c09e..73273593a0 100644 --- a/Libs/Visualization/VTK/Widgets/ctkVTKRenderView.h +++ b/Libs/Visualization/VTK/Widgets/ctkVTKRenderView.h @@ -145,7 +145,7 @@ public Q_SLOTS: /// Set window interactor /// Reimplemented to propagate interaction to Orientation widget - virtual void setInteractor(vtkRenderWindowInteractor* interactor); + void setInteractor(vtkRenderWindowInteractor* interactor) override; /// Return pitch, roll or yaw increment (in degree) double pitchRollYawIncrement()const; @@ -186,6 +186,9 @@ public Q_SLOTS: /// Return zoom factor double zoomFactor()const; +protected: + ctkVTKRenderView(ctkVTKRenderViewPrivate* pimpl, QWidget* parent); + private: Q_DECLARE_PRIVATE(ctkVTKRenderView); Q_DISABLE_COPY(ctkVTKRenderView); diff --git a/Libs/Visualization/VTK/Widgets/ctkVTKRenderView_p.h b/Libs/Visualization/VTK/Widgets/ctkVTKRenderView_p.h index bc2695d63f..d03b572beb 100644 --- a/Libs/Visualization/VTK/Widgets/ctkVTKRenderView_p.h +++ b/Libs/Visualization/VTK/Widgets/ctkVTKRenderView_p.h @@ -43,17 +43,19 @@ class vtkRenderWindowInteractor; //----------------------------------------------------------------------------- /// \ingroup Visualization_VTK_Widgets -class ctkVTKRenderViewPrivate : public ctkVTKAbstractViewPrivate +class CTK_VISUALIZATION_VTK_WIDGETS_EXPORT ctkVTKRenderViewPrivate : public ctkVTKAbstractViewPrivate { Q_OBJECT Q_DECLARE_PUBLIC(ctkVTKRenderView); public: ctkVTKRenderViewPrivate(ctkVTKRenderView& object); + virtual ~ctkVTKRenderViewPrivate(); /// Convenient setup methods - virtual void setupCornerAnnotation(); - virtual void setupRendering(); + void init() override; + void setupCornerAnnotation() override; + void setupRendering() override; void zoom(double zoomFactor); diff --git a/Libs/Visualization/VTK/Widgets/ctkVTKSliceView.cpp b/Libs/Visualization/VTK/Widgets/ctkVTKSliceView.cpp index eadd1e0706..b1aea4c146 100644 --- a/Libs/Visualization/VTK/Widgets/ctkVTKSliceView.cpp +++ b/Libs/Visualization/VTK/Widgets/ctkVTKSliceView.cpp @@ -50,6 +50,18 @@ ctkVTKSliceViewPrivate::ctkVTKSliceViewPrivate(ctkVTKSliceView& object) this->OverlayRenderer = vtkSmartPointer::New(); } +// -------------------------------------------------------------------------- +ctkVTKSliceViewPrivate::~ctkVTKSliceViewPrivate() = default; + +// -------------------------------------------------------------------------- +void ctkVTKSliceViewPrivate::init() +{ + Q_Q(ctkVTKSliceView); + this->ctkVTKAbstractViewPrivate::init(); + + q->VTKWidget()->installEventFilter(q); +} + // -------------------------------------------------------------------------- void ctkVTKSliceViewPrivate::setupCornerAnnotation() { @@ -100,7 +112,14 @@ ctkVTKSliceView::ctkVTKSliceView(QWidget* parentWidget) { Q_D(ctkVTKSliceView); d->init(); - this->VTKWidget()->installEventFilter(this); +} + +// -------------------------------------------------------------------------- +ctkVTKSliceView::ctkVTKSliceView(ctkVTKSliceViewPrivate* pimpl, QWidget* parentWidget) + : Superclass(pimpl, parentWidget) +{ + // derived classes must call init manually. Calling init() here may results in + // actions on a derived public class not yet finished to be created } // -------------------------------------------------------------------------- diff --git a/Libs/Visualization/VTK/Widgets/ctkVTKSliceView.h b/Libs/Visualization/VTK/Widgets/ctkVTKSliceView.h index 4d4d85a44f..6d5ad29b37 100644 --- a/Libs/Visualization/VTK/Widgets/ctkVTKSliceView.h +++ b/Libs/Visualization/VTK/Widgets/ctkVTKSliceView.h @@ -71,11 +71,11 @@ class CTK_VISUALIZATION_VTK_WIDGETS_EXPORT ctkVTKSliceView : public ctkVTKAbstra /// Set background color /// \sa vtkLightBoxRendererManager::SetBackgroundColor - virtual void setBackgroundColor(const QColor& newBackgroundColor); + void setBackgroundColor(const QColor& newBackgroundColor) override; /// Get background color /// \sa setBackgroundColor(); - virtual QColor backgroundColor()const; + QColor backgroundColor()const override; /// Get highlightedBox color /// \sa setHighlightedBoxColor(); @@ -133,7 +133,8 @@ public Q_SLOTS: void resized(const QSize& size); protected: - virtual bool eventFilter(QObject *object, QEvent *event); + ctkVTKSliceView(ctkVTKSliceViewPrivate* pimpl, QWidget* parent); + bool eventFilter(QObject *object, QEvent *event) override; private: Q_DECLARE_PRIVATE(ctkVTKSliceView); diff --git a/Libs/Visualization/VTK/Widgets/ctkVTKSliceView_p.h b/Libs/Visualization/VTK/Widgets/ctkVTKSliceView_p.h index 8f9812b001..6ab2097e5c 100644 --- a/Libs/Visualization/VTK/Widgets/ctkVTKSliceView_p.h +++ b/Libs/Visualization/VTK/Widgets/ctkVTKSliceView_p.h @@ -41,15 +41,19 @@ class vtkRenderWindowInteractor; //----------------------------------------------------------------------------- /// \ingroup Visualization_VTK_Widgets -class ctkVTKSliceViewPrivate : public ctkVTKAbstractViewPrivate +class CTK_VISUALIZATION_VTK_WIDGETS_EXPORT ctkVTKSliceViewPrivate : public ctkVTKAbstractViewPrivate { Q_OBJECT + Q_DECLARE_PUBLIC(ctkVTKSliceView); + public: ctkVTKSliceViewPrivate(ctkVTKSliceView&); + virtual ~ctkVTKSliceViewPrivate(); /// Convenient setup methods - void setupCornerAnnotation(); - void setupRendering(); + void init() override; + void setupCornerAnnotation() override; + void setupRendering() override; vtkSmartPointer LightBoxRendererManager; bool RenderPending;