ctkDICOMServerNodeWidget.cpp 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*=========================================================================
  2. Library: CTK
  3. Copyright (c) 2010 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.commontk.org/LICENSE
  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. #include <iostream>
  15. /// CTK includes
  16. #include <ctkCheckableHeaderView.h>
  17. // ctkDICOMWidgets includes
  18. #include "ctkDICOMServerNodeWidget.h"
  19. #include "ui_ctkDICOMServerNodeWidget.h"
  20. //----------------------------------------------------------------------------
  21. class ctkDICOMServerNodeWidgetPrivate: public ctkPrivate<ctkDICOMServerNodeWidget>,
  22. public Ui_ctkDICOMServerNodeWidget
  23. {
  24. public:
  25. ctkDICOMServerNodeWidgetPrivate(){}
  26. };
  27. //----------------------------------------------------------------------------
  28. // ctkDICOMServerNodeWidgetPrivate methods
  29. //----------------------------------------------------------------------------
  30. // ctkDICOMServerNodeWidget methods
  31. //----------------------------------------------------------------------------
  32. ctkDICOMServerNodeWidget::ctkDICOMServerNodeWidget(QWidget* _parent):Superclass(_parent)
  33. {
  34. CTK_INIT_PRIVATE(ctkDICOMServerNodeWidget);
  35. CTK_D(ctkDICOMServerNodeWidget);
  36. d->setupUi(this);
  37. // checkable headers.
  38. d->nodeTable->model()->setHeaderData(0, Qt::Horizontal, Qt::Unchecked, Qt::CheckStateRole);
  39. QHeaderView* previousHeaderView = d->nodeTable->horizontalHeader();
  40. ctkCheckableHeaderView* headerView = new ctkCheckableHeaderView(Qt::Horizontal, d->nodeTable);
  41. headerView->setClickable(previousHeaderView->isClickable());
  42. headerView->setMovable(previousHeaderView->isMovable());
  43. headerView->setHighlightSections(previousHeaderView->highlightSections());
  44. //headerView->setModel(previousHeaderView->model());
  45. //headerView->setSelectionModel(previousHeaderView->selectionModel());
  46. headerView->setPropagateToItems(true);
  47. d->nodeTable->setHorizontalHeader(headerView);
  48. d->removeButton->setEnabled(false);
  49. connect(d->addButton,SIGNAL(clicked()), this, SLOT(addNode()));
  50. connect(d->nodeTable,SIGNAL(cellActivated(int,int)), this, SLOT(updateState(int,int)));
  51. }
  52. //----------------------------------------------------------------------------
  53. ctkDICOMServerNodeWidget::~ctkDICOMServerNodeWidget()
  54. {
  55. }
  56. //----------------------------------------------------------------------------
  57. void ctkDICOMServerNodeWidget::addNode()
  58. {
  59. CTK_D(ctkDICOMServerNodeWidget);
  60. std::cerr << "add server node\n";
  61. }
  62. //----------------------------------------------------------------------------
  63. void ctkDICOMServerNodeWidget::updateState(int row, int column)
  64. {
  65. CTK_D(ctkDICOMServerNodeWidget);
  66. d->removeButton->setEnabled(true);
  67. }
  68. //----------------------------------------------------------------------------
  69. void ctkDICOMServerNodeWidget::populateQuery(/*ctkDICOMQuery &query*/)
  70. {
  71. CTK_D(ctkDICOMServerNodeWidget);
  72. std::cerr << "server node populate\n";
  73. }