ctkVTKDataSetArrayComboBox.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*=========================================================================
  2. Library: CTK
  3. Copyright (c) Kitware Inc.
  4. Licensed under the Apache License, Version 2.0 (the "License");
  5. you may not use this file except in compliance with the License.
  6. You may obtain a copy of the License at
  7. http://www.apache.org/licenses/LICENSE-2.0.txt
  8. Unless required by applicable law or agreed to in writing, software
  9. distributed under the License is distributed on an "AS IS" BASIS,
  10. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. See the License for the specific language governing permissions and
  12. limitations under the License.
  13. =========================================================================*/
  14. #ifndef __ctkVTKDataSetArrayComboBox_h
  15. #define __ctkVTKDataSetArrayComboBox_h
  16. // Qt includes
  17. #include <QComboBox>
  18. // CTK includes
  19. #include "ctkVisualizationVTKWidgetsExport.h"
  20. class ctkVTKDataSetArrayComboBoxPrivate;
  21. class vtkDataArray;
  22. class vtkDataSet;
  23. ///
  24. /// QComboBox linked to vtkDataSet field arrays
  25. class CTK_VISUALIZATION_VTK_WIDGETS_EXPORT ctkVTKDataSetArrayComboBox : public QComboBox
  26. {
  27. Q_OBJECT
  28. public:
  29. /// Superclass typedef
  30. typedef QComboBox Superclass;
  31. /// Constructors
  32. explicit ctkVTKDataSetArrayComboBox(QWidget* parent = 0);
  33. virtual ~ctkVTKDataSetArrayComboBox();
  34. vtkDataArray* currentArray()const;
  35. QString currentArrayName()const;
  36. vtkDataSet* dataSet()const;
  37. public slots:
  38. void setDataSet(vtkDataSet* dataSet);
  39. /// The array must exist in the dataset
  40. void setCurrentArray(vtkDataArray* dataArray);
  41. /// the array must exist in the dataset
  42. void setCurrentArray(const QString& name);
  43. signals:
  44. void currentArrayChanged(vtkDataArray*);
  45. void currentArrayChanged(const QString& name);
  46. protected slots:
  47. void onCurrentIndexChanged(int);
  48. protected:
  49. QScopedPointer<ctkVTKDataSetArrayComboBoxPrivate> d_ptr;
  50. private:
  51. Q_DECLARE_PRIVATE(ctkVTKDataSetArrayComboBox);
  52. Q_DISABLE_COPY(ctkVTKDataSetArrayComboBox);
  53. };
  54. #endif