27 #include <QDesktopWidget> 28 #include <QDragEnterEvent> 29 #include <QDragMoveEvent> 32 #include <QMainWindow> 34 #include <QSizePolicy> 50 setWindowFlags(Qt::Widget);
52 QSizePolicy policy = sizePolicy();
53 policy.setHorizontalPolicy(QSizePolicy::Expanding);
54 policy.setVerticalPolicy(QSizePolicy::Expanding);
55 setSizePolicy(policy);
71 QDesktopWidget deskTop;
72 QRect availableSpace = deskTop.availableGeometry(deskTop.primaryScreen());
73 return QSize( .89 * availableSpace.width(), .5 * availableSpace.height() );
86 proxyModel->setSourceModel(
model);
100 return proxyModel->sourceModel();
136 0, 0, QModelIndex() ) ) {
137 event->acceptProposedAction();
151 0, 0, QModelIndex() ) ) {
152 event->acceptProposedAction();
165 0, 0, QModelIndex() ) ) {
166 internalModel()->dropMimeData( event->mimeData(),
event->dropAction(),
167 0, 0, QModelIndex() );
168 event->acceptProposedAction();
173 void AbstractProjectItemView::moveEvent(QMoveEvent *event) {
174 QMainWindow::moveEvent(event);
176 emit windowChangeEvent(
false);
180 void AbstractProjectItemView::resizeEvent(QResizeEvent *event) {
181 QMainWindow::resizeEvent(event);
183 emit windowChangeEvent(
false);
211 foreach (
QAction *action, actions()) {
212 action->setDisabled(
true);
221 foreach (
QAction *action, actions()) {
222 action->setEnabled(
true);
266 proxyModel->addItem(item);
280 proxyModel->addItems(items);
295 proxyModel->removeItem(item);
virtual void enterEvent(QEvent *event)
Enables actions when cursor enters the view.
virtual void addItem(ProjectItem *item)
Adds an item to the view.
virtual void leaveEvent(QEvent *event)
Disables actions when cursor leaves the view.
virtual void dropEvent(QDropEvent *event)
Drops the data into the internal model if it can accept the data.
virtual void disableActions()
Disables toolbars and toolpad actions.
virtual void addItems(QList< ProjectItem *> items)
Adds several items to the view.
virtual void removeItems(QList< ProjectItem *> items)
Removes several items from 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 QSize sizeHint() const
Returns the suggested size.
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's model-view framework.
virtual ProjectItem * currentItem()
Returns the current item of the model.
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 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.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
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's model-view framework.
Namespace for ISIS/Bullet specific routines.
virtual void enableActions()
Enables toolbars and toolpad actions.
virtual ProjectItemModel * model()
Returns the model used by the view.