9#include "ProjectItemTreeView.h"
11#include <QAbstractItemView>
18#include <QGuiApplication>
21#include "ProjectItem.h"
22#include "ProjectItemModel.h"
49 setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding);
64 QRect availableSpace = (QGuiApplication::primaryScreen()->availableGeometry());
65 return QSize(.15 * availableSpace.width(), .5 * availableSpace.height());
99 m_treeView->setSelectionMode(QAbstractItemView::ExtendedSelection);
133 if (event->type() == QEvent::DragEnter) {
136 else if (event->type() == QEvent::Drop) {
140 return AbstractProjectItemView::eventFilter(watched, event);
AbstractProjectItemView is a base class for views of a ProjectItemModel in Qt's model-view framework.
virtual ProjectItemModel * model()
Returns the model used by the view.
virtual void setInternalModel(ProjectItemModel *model)
Sets the internal model of the view.
virtual ProjectItemModel * internalModel()
Returns the internal model of the view.
Represents an item of a ProjectItemModel in Qt's model-view framework.
bool isControlList() const
Returns true if a ControlList is stored in the data of the item.
bool isImageList() const
Returns true if an ImageList is stored in the data of the item.
ProjectItem * parent() const
Returns the parent item of this item.
Provides access to data stored in a Project through Qt's model-view framework.
virtual void setInternalModel(ProjectItemModel *model)
Sets the model so that the internal proxy model exactly matches the source model.
~ProjectItemTreeView()
Default destructor.
QTreeView * m_treeView
The tree view (widget)
bool eventFilter(QObject *watched, QEvent *event)
Filters out drag and drop events so that they are handled by the ProjectItemTreeView.
void onItemAdded(ProjectItem *item)
Expands the parent project item in the tree view to show the added item.
QTreeView * treeView()
Returns the tree view.
ProjectItemTreeView(QWidget *parent=0)
Constructs a ProjectItemTreeView.
virtual QSize sizeHint() const
Returns the suggested size.
This is free and unencumbered software released into the public domain.