Isis 3.0 Programmer Reference
Back | Home
AbstractProjectItemView.cpp
Go to the documentation of this file.
1 
24 
25 #include <QAction>
26 #include <QDebug>
27 #include <QDragEnterEvent>
28 #include <QDragMoveEvent>
29 #include <QDropEvent>
30 #include <QList>
31 #include <QWidget>
32 
33 #include "ProjectItem.h"
34 #include "ProjectItemModel.h"
35 #include "ProjectItemProxyModel.h"
36 
37 namespace Isis {
38 
46  setAcceptDrops(true);
47  }
48 
49 
57  if (ProjectItemProxyModel *proxyModel =
58  qobject_cast<ProjectItemProxyModel *>( internalModel() ) ) {
59  proxyModel->setSourceModel(model);
60  }
61  }
62 
63 
71  if (ProjectItemProxyModel *proxyModel =
72  qobject_cast<ProjectItemProxyModel *>( internalModel() ) ) {
73  return proxyModel->sourceModel();
74  }
75  return internalModel();
76  }
77 
78 
86  }
87 
88 
96  return m_internalModel;
97  }
98 
99 
106  void AbstractProjectItemView::dragEnterEvent(QDragEnterEvent *event) {
107  if (internalModel()->canDropMimeData( event->mimeData(),
108  event->dropAction(),
109  0, 0, QModelIndex() ) ) {
110  event->acceptProposedAction();
111  }
112  }
113 
114 
121  void AbstractProjectItemView::dragMoveEvent(QDragMoveEvent *event) {
122  if (internalModel()->canDropMimeData( event->mimeData(),
123  event->dropAction(),
124  0, 0, QModelIndex() ) ) {
125  event->acceptProposedAction();
126  }
127  }
128 
129 
135  void AbstractProjectItemView::dropEvent(QDropEvent *event) {
136  if (internalModel()->canDropMimeData( event->mimeData(),
137  event->dropAction(),
138  0, 0, QModelIndex() ) ) {
139  internalModel()->dropMimeData( event->mimeData(), event->dropAction(),
140  0, 0, QModelIndex() );
141  event->acceptProposedAction();
142  }
143  }
144 
145 
152  return QList<QAction *>();
153  }
154 
155 
162  return QList<QAction *>();
163  }
164 
165 
172  return QList<QAction *>();
173  }
174 
175 
182  return QList<QAction *>();
183  }
184 
185 
192  return QList<QAction *>();
193  }
194 
195 
202  return QList<QAction *>();
203  }
204 
205 
212  return QList<QAction *>();
213  }
214 
215 
222  return QList<QAction *>();
223  }
224 
225 
232  return QList<QAction *>();
233  }
234 
235 
242  return QList<QAction *>();
243  }
244 
245 
252  return model()->currentItem();
253  }
254 
255 
262  return model()->selectedItems();
263  }
264 
265 
274  if (ProjectItemProxyModel *proxyModel =
275  qobject_cast<ProjectItemProxyModel *>( internalModel() ) ) {
276  proxyModel->addItem(item);
277  }
278  }
279 
280 
288  foreach (ProjectItem *item, items) {
289  addItem(item);
290  }
291  }
292 
293 
302  if (ProjectItemProxyModel *proxyModel =
303  qobject_cast<ProjectItemProxyModel *>( internalModel() ) ) {
304 // qDebug()<<"AbstractProjectItemView::removeItem";
305  proxyModel->removeItem(item);
306  }
307  }
308 
309 
317  foreach (ProjectItem *item, items) {
318  removeItem(item);
319  }
320  }
321 }
$Revision$ $Date$
virtual void addItem(ProjectItem *item)
Adds an item to the view.
$Date$ $Revision$
virtual QList< QAction * > projectMenuActions()
Returns a list of actions appropriate for a project menu.
virtual void dropEvent(QDropEvent *event)
Drops the data into the internal model if it can accept the data.
virtual void addItems(QList< ProjectItem * > items)
Adds several items to the view.
virtual void setInternalModel(ProjectItemModel *model)
Sets the internal model of the view.
virtual void setModel(ProjectItemModel *model)
Sets the model used by the view.
virtual QList< QAction * > helpMenuActions()
Returns a list of actions appropriate for a help menu.
virtual QList< QAction * > editMenuActions()
Returns a list of actions appropriate for an edit menu.
ProjectItem * currentItem()
Returns the current item of the internal selection model.
virtual void removeItem(ProjectItem *item)
Removes an item to the view.
Provides access to data stored in a Project through Qt&#39;s model-view framework.
virtual ProjectItem * currentItem()
Returns the current item of the model.
virtual QList< QAction * > settingsMenuActions()
Returns a list of actions appropriate for a settings menu.
virtual ProjectItemModel * internalModel()
Returns the internal model of the view.
Allows access to items in a ProjectItemModel through a proxy model.
virtual QList< QAction * > contextMenuActions()
Returns a list of actions appropriate for a context menu.
virtual void dragMoveEvent(QDragMoveEvent *event)
Accepts the drag event if the internal model can accept the mime data.
ProjectItemModel * m_internalModel
The internal model used by the view.
virtual QList< QAction * > activeToolBarActions()
Returns a list of actions appropriate for the active tool bar.
virtual void dragEnterEvent(QDragEnterEvent *event)
Accepts the drag enter event if the internal model can accept the mime data.
AbstractProjectItemView(QWidget *parent=0)
Constructs the AbstractProjectItemView.
virtual QList< QAction * > viewMenuActions()
Returns a list of actions appropriate for a view menu.
$Date$ $Revision$
virtual QList< ProjectItem * > selectedItems()
Return the selected items of the model.
QList< ProjectItem * > selectedItems()
Returns a list of the selected items of the internal selection model.
Represents an item of a ProjectItemModel in Qt&#39;s model-view framework.
Definition: ProjectItem.h:113
virtual void removeItems(QList< ProjectItem * > items)
Removes several items from the view.
virtual QList< QAction * > fileMenuActions()
Returns a list of actions appropriate for a file menu.
virtual QList< QAction * > permToolBarActions()
Returns a list of actions appropriate for the permanent tool bar.
$Date$ $Revision$
virtual QList< QAction * > toolPadActions()
Returns a list of actions appropriate for the tool pad.
virtual ProjectItemModel * model()
Returns the model used by the view.

U.S. Department of the Interior | U.S. Geological Survey
ISIS | Privacy & Disclaimers | Astrogeology Research Program
To contact us, please post comments and questions on the ISIS Support Center
File Modified: 07/12/2023 23:13:46