Tree view that allows drag & drop of document objects. More...
#include <Tree.h>
Public Member Functions | |
void | scrollItemToTop (Gui::Document *) |
void | setItemsSelected (const QList< QTreeWidgetItem * > items, bool select) |
TreeWidget (QWidget *parent=0) | |
~TreeWidget () | |
Static Public Attributes | |
static const int | DocumentType = 1000 |
static const int | ObjectType = 1001 |
Protected Slots | |
void | onActivateDocument (QAction *) |
void | onCreateGroup () |
void | onFinishEditing () |
void | onRelabelObject () |
void | onStartEditing () |
Protected Member Functions | |
void | contextMenuEvent (QContextMenuEvent *e) |
void | dragMoveEvent (QDragMoveEvent *event) |
void | drawRow (QPainter *, const QStyleOptionViewItem &, const QModelIndex &) const |
void | dropEvent (QDropEvent *event) |
bool | dropMimeData (QTreeWidgetItem *parent, int index, const QMimeData *data, Qt::DropAction action) |
QMimeData * | mimeData (const QList< QTreeWidgetItem * > items) const |
void | mouseDoubleClickEvent (QMouseEvent *event) |
void | onSelectionChanged (const SelectionChanges &msg) |
Observer message from the Selection. | |
Qt::DropActions | supportedDropActions () const |
Tree view that allows drag & drop of document objects.
Definition at line 44 of file Tree.h.
TreeWidget::TreeWidget | ( | QWidget * | parent = 0 |
) |
Definition at line 62 of file Gui/Tree.cpp.
References draftlibs::fcgeo::bind(), Gui::BitmapFactory(), draftlibs::fcgeo::connect(), Gui::Application::Instance, onCreateGroup(), onFinishEditing(), onRelabelObject(), Gui::Application::signalActiveDocument, Gui::Application::signalDeleteDocument, Gui::Application::signalNewDocument, Gui::Application::signalRelabelDocument, and Gui::Application::signalRenameDocument.
TreeWidget::~TreeWidget | ( | ) |
Definition at line 123 of file Gui/Tree.cpp.
void TreeWidget::contextMenuEvent | ( | QContextMenuEvent * | e | ) | [protected] |
Definition at line 127 of file Gui/Tree.cpp.
References draftlibs::fcgeo::connect(), DocumentType, App::Application::getActiveDocument(), App::GetApplication(), App::Application::getDocuments(), Gui::MenuManager::getInstance(), Gui::ViewProviderDocumentObject::getObject(), Gui::Application::Instance, Base::BaseClass::isDerivedFrom(), Gui::ViewProvider::isEditing(), Gui::DocumentObjectItem::object(), ObjectType, onActivateDocument(), onStartEditing(), RobotExample::pos, Gui::ViewProvider::setupContextMenu(), Gui::MenuManager::setupContextMenu(), and Gui::Application::setupContextMenu().
void TreeWidget::dragMoveEvent | ( | QDragMoveEvent * | event | ) | [protected] |
Definition at line 330 of file Gui/Tree.cpp.
References DocumentType, App::PropertyContainer::getClassTypeId(), App::DocumentObject::getDocument(), App::PropertyContainer::getTypeId(), Base::Type::isDerivedFrom(), and ObjectType.
void TreeWidget::drawRow | ( | QPainter * | painter, | |
const QStyleOptionViewItem & | options, | |||
const QModelIndex & | index | |||
) | const [protected] |
Definition at line 479 of file Gui/Tree.cpp.
void TreeWidget::dropEvent | ( | QDropEvent * | event | ) | [protected] |
Definition at line 392 of file Gui/Tree.cpp.
References macros::cmd, Gui::Document::commitCommand(), DocumentType, App::PropertyContainer::getClassTypeId(), Gui::Application::getDocument(), App::DocumentObject::getDocument(), App::DocumentObjectGroup::getGroupOfObject(), App::Document::getName(), App::DocumentObject::getNameInDocument(), App::PropertyContainer::getTypeId(), Gui::Application::Instance, Base::Type::isDerivedFrom(), ObjectType, Gui::Document::openCommand(), and Gui::Application::runPythonCode().
bool TreeWidget::dropMimeData | ( | QTreeWidgetItem * | parent, | |
int | index, | |||
const QMimeData * | data, | |||
Qt::DropAction | action | |||
) | [protected] |
Definition at line 285 of file Gui/Tree.cpp.
QMimeData * TreeWidget::mimeData | ( | const QList< QTreeWidgetItem * > | items | ) | const [protected] |
Definition at line 314 of file Gui/Tree.cpp.
References App::DocumentObject::getDocument(), and ObjectType.
void TreeWidget::mouseDoubleClickEvent | ( | QMouseEvent * | event | ) | [protected] |
Definition at line 296 of file Gui/Tree.cpp.
References DocumentType, Gui::Document::getActiveView(), Gui::getMainWindow(), ObjectType, and Gui::MainWindow::setActiveWindow().
void TreeWidget::onActivateDocument | ( | QAction * | active | ) | [protected, slot] |
Definition at line 274 of file Gui/Tree.cpp.
References Gui::Document::getActiveView(), Gui::Application::getDocument(), Gui::getMainWindow(), Gui::Application::Instance, and Gui::MainWindow::setActiveWindow().
Referenced by contextMenuEvent().
void TreeWidget::onCreateGroup | ( | ) | [protected, slot] |
Definition at line 207 of file Gui/Tree.cpp.
References macros::cmd, Gui::Document::commitCommand(), Gui::DocumentItem::document(), DocumentType, App::DocumentObject::getDocument(), Gui::Application::getDocument(), Gui::Document::getDocument(), App::Document::getName(), App::DocumentObject::getNameInDocument(), Gui::ViewProviderDocumentObject::getObject(), Gui::Application::Instance, Gui::DocumentObjectItem::object(), ObjectType, Gui::Document::openCommand(), and Gui::Application::runPythonCode().
Referenced by TreeWidget().
void TreeWidget::onFinishEditing | ( | ) | [protected, slot] |
Definition at line 261 of file Gui/Tree.cpp.
References Gui::Document::getDocument(), App::DocumentObject::getDocument(), Gui::Application::getDocument(), Gui::ViewProviderDocumentObject::getObject(), Gui::Application::Instance, Gui::DocumentObjectItem::object(), ObjectType, App::Document::recompute(), and Gui::Document::resetEdit().
Referenced by TreeWidget().
void TreeWidget::onRelabelObject | ( | ) | [protected, slot] |
Definition at line 238 of file Gui/Tree.cpp.
Referenced by TreeWidget().
void TreeWidget::onSelectionChanged | ( | const SelectionChanges & | msg | ) | [protected, virtual] |
Observer message from the Selection.
Implements Gui::SelectionObserver.
Definition at line 606 of file Gui/Tree.cpp.
References Gui::SelectionChanges::AddSelection, Gui::SelectionObserver::blockConnection(), Gui::SelectionChanges::ClrSelection, Gui::Application::getDocument(), Gui::Application::Instance, Gui::SelectionChanges::pDocName, Gui::SelectionChanges::pObjectName, Gui::SelectionChanges::RmvPreselect, Gui::SelectionChanges::RmvSelection, Gui::SelectionChanges::SetPreselect, Gui::SelectionChanges::SetSelection, and Gui::SelectionChanges::Type.
void TreeWidget::onStartEditing | ( | ) | [protected, slot] |
Definition at line 245 of file Gui/Tree.cpp.
References App::DocumentObject::getDocument(), Gui::Application::getDocument(), Gui::ViewProviderDocumentObject::getObject(), Gui::Application::Instance, Gui::DocumentObjectItem::object(), ObjectType, and Gui::Document::setEdit().
Referenced by contextMenuEvent().
void TreeWidget::scrollItemToTop | ( | Gui::Document * | doc | ) |
Definition at line 565 of file Gui/Tree.cpp.
References ObjectType.
void TreeWidget::setItemsSelected | ( | const QList< QTreeWidgetItem * > | items, | |
bool | select | |||
) |
Definition at line 681 of file Gui/Tree.cpp.
Qt::DropActions TreeWidget::supportedDropActions | ( | ) | const [protected] |
Definition at line 291 of file Gui/Tree.cpp.
const int TreeWidget::DocumentType = 1000 [static] |
Definition at line 55 of file Tree.h.
Referenced by contextMenuEvent(), dragMoveEvent(), dropEvent(), mouseDoubleClickEvent(), and onCreateGroup().
const int TreeWidget::ObjectType = 1001 [static] |
Definition at line 56 of file Tree.h.
Referenced by contextMenuEvent(), dragMoveEvent(), dropEvent(), mimeData(), mouseDoubleClickEvent(), onCreateGroup(), onFinishEditing(), onStartEditing(), and scrollItemToTop().