Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "QmitkPropertiesTableEditor.h"
00019
00020 #include "QmitkPropertiesTableModel.h"
00021 #include "QmitkPropertyDelegate.h"
00022
00023 #include "mitkBaseRenderer.h"
00024 #include "mitkFocusManager.h"
00025 #include "mitkGlobalInteraction.h"
00026
00027 #include <QHBoxLayout>
00028 #include <QVBoxLayout>
00029 #include <QHeaderView>
00030 #include <QTableView>
00031 #include <QLineEdit>
00032 #include <QLabel>
00033
00034 #include <vtkRenderWindow.h>
00035
00036 QmitkPropertiesTableEditor::QmitkPropertiesTableEditor(QWidget* parent
00037 , Qt::WindowFlags f,mitk::DataNode::Pointer )
00038 : QWidget(parent, f)
00039 , m_NodePropertiesTableView(0)
00040 , m_Model(0)
00041 {
00042
00043 this->init();
00044
00045
00046 m_Model = new QmitkPropertiesTableModel(m_NodePropertiesTableView, 0);
00047 m_NodePropertiesTableView->setModel(m_Model);
00048 }
00049
00050 QmitkPropertiesTableEditor::~QmitkPropertiesTableEditor()
00051 {
00052 }
00053
00054 void QmitkPropertiesTableEditor::SetPropertyList( mitk::PropertyList::Pointer _List )
00055 {
00056 if(_List.IsNotNull())
00057 {
00058 m_Model->SetPropertyList(_List);
00059 m_NodePropertiesTableView->resizeColumnsToContents();
00060 m_NodePropertiesTableView->resizeRowsToContents();
00061 m_NodePropertiesTableView->horizontalHeader()->setStretchLastSection(true);
00062 m_NodePropertiesTableView->setEditTriggers(QAbstractItemView::CurrentChanged);
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101 }
00102 else
00103 {
00104 m_Model->SetPropertyList(0);
00105 }
00106 }
00107
00108 QmitkPropertiesTableModel* QmitkPropertiesTableEditor::getModel() const
00109 {
00110 return m_Model;
00111 }
00112
00113 void QmitkPropertiesTableEditor::init()
00114 {
00115
00116 QVBoxLayout* _NodePropertiesLayout = new QVBoxLayout;
00117 QWidget* _PropertyFilterKeyWordPane = new QWidget(QWidget::parentWidget());
00118 QHBoxLayout* _PropertyFilterKeyWordLayout = new QHBoxLayout;
00119 QLabel* _LabelPropertyFilterKeyWord = new QLabel("Filter: ",_PropertyFilterKeyWordPane);
00120 m_TxtPropertyFilterKeyWord = new QLineEdit(_PropertyFilterKeyWordPane);
00121 m_NodePropertiesTableView = new QTableView(QWidget::parentWidget());
00122
00123
00124 setLayout(_NodePropertiesLayout);
00125
00126 _PropertyFilterKeyWordPane->setLayout(_PropertyFilterKeyWordLayout);
00127
00128 _PropertyFilterKeyWordLayout->setMargin(0);
00129 _PropertyFilterKeyWordLayout->addWidget(_LabelPropertyFilterKeyWord);
00130 _PropertyFilterKeyWordLayout->addWidget(m_TxtPropertyFilterKeyWord);
00131
00132 _NodePropertiesLayout->setMargin(0);
00133 _NodePropertiesLayout->addWidget(_PropertyFilterKeyWordPane);
00134 _NodePropertiesLayout->addWidget(m_NodePropertiesTableView);
00135
00136 m_NodePropertiesTableView->setSelectionMode( QAbstractItemView::SingleSelection );
00137 m_NodePropertiesTableView->setSelectionBehavior( QAbstractItemView::SelectItems );
00138
00139 m_NodePropertiesTableView->verticalHeader()->hide();
00140 m_NodePropertiesTableView->setItemDelegate(new QmitkPropertyDelegate(this));
00141 m_NodePropertiesTableView->setAlternatingRowColors(true);
00142
00143 m_NodePropertiesTableView->setSortingEnabled(true);
00144 m_NodePropertiesTableView->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents);
00145
00146 QObject::connect( m_TxtPropertyFilterKeyWord, SIGNAL( textChanged(const QString &) )
00147 , this, SLOT( PropertyFilterKeyWordTextChanged(const QString &) ) );
00148
00149 }
00150
00151 void QmitkPropertiesTableEditor::PropertyFilterKeyWordTextChanged( const QString & )
00152 {
00153 m_Model->SetFilterPropertiesKeyWord(m_TxtPropertyFilterKeyWord->text().toStdString());
00154 }
00155
00156 QTableView* QmitkPropertiesTableEditor::getTable() const
00157 {
00158 return m_NodePropertiesTableView;
00159 }
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195