Brief description of class still missing. More...
#include <GroupView.h>
Public Types | |
enum | Mode { Browse, Rename, Sort } |
Public Slots | |
void | getSelection (SubSignalPool &sel) |
void | newFolder () |
void | newGraphicWindow () |
void | newMapWindow () |
void | newTableWindow () |
void | newTool () |
void | properties () |
void | remove () |
Public Member Functions | |
GroupView (QWidget *parent=0) | |
void | select (const QRegExp &exp) |
void | setMode (Mode m) |
void | setSignalWindow (GeopsyMainWindow *sw) |
virtual QSize | sizeHint () const |
Protected Member Functions | |
virtual void | contextMenuEvent (QContextMenuEvent *e) |
virtual void | mouseDoubleClickEvent (QMouseEvent *e) |
Brief description of class still missing.
Full description of class still missing
enum GroupView::Mode |
GroupView::GroupView | ( | QWidget * | parent = 0 | ) |
Description of constructor still missing
References Browse, GeopsyCore::GeopsyCoreEngine::currentDB(), GeopsyCore::geopsyCore, getSelection(), GeopsyGui::SignalGroupItem::setDatabase(), SigSelectionDnD::setDropEnabled(), setMode(), and TRACE.
: QTreeView(parent) { TRACE; sigDnD=new SigSelectionDnD(this); viewport()->installEventFilter(sigDnD); sigDnD->setDropEnabled(false); connect(sigDnD, SIGNAL(getSelection(SubSignalPool& )), this, SLOT(getSelection(SubSignalPool& ))); _sw=0; _menu=new QMenu(this); setContextMenuPolicy(Qt::DefaultContextMenu); SignalGroupItem * model=new SignalGroupItem(this); model->setDatabase(geopsyCore->currentDB()); setModel(model); setItemDelegate(new LineEditDelegate(this)); header()->hide(); setSelectionBehavior(QAbstractItemView::SelectRows); setSelectionMode(QAbstractItemView::ExtendedSelection); setAutoExpandDelay(1000); setAnimated(true); setUniformRowHeights(true); // Speedup rendering setMode(Browse); }
void GroupView::contextMenuEvent | ( | QContextMenuEvent * | e | ) | [protected, virtual] |
References ToolFactory::addPopularActions(), getSelection(), group(), newTool(), properties(), GeopsyCore::AbstractSignalGroup::readOnly(), GeopsyMainWindow::toolFactory(), QGpCoreTools::tr(), and TRACE.
{ TRACE; _menu->clear(); QList<AbstractSignalGroup *> selReadWrite=getSelection(true); QList<AbstractSignalGroup *> selAll=getSelection(false); QModelIndex index=indexAt(e->pos()); if(selAll.isEmpty()) { _menu->addAction(_newFolderAction); } else { if(index.isValid()) { AbstractSignalGroup * g=SignalGroupItem::group(index); if(!selAll.contains(g)) { selAll.clear(); selAll.append(g); if(!g->readOnly()) { selReadWrite.append(g); } selectionModel()->select(index, QItemSelectionModel::ClearAndSelect); } if(!selReadWrite.isEmpty()) { _menu->addAction(tr("Properties"), this, SLOT(properties())); _menu->addAction(tr("Remove"), this, SLOT(remove())); _menu->addSeparator(); } _menu->addAction(_tableAction); _menu->addAction(_graphicAction); _menu->addAction(_mapAction); QAction * lastSep=_menu->addSeparator(); if(!_sw->toolFactory()->addPopularActions(_menu, this, SLOT(newTool()))) { _menu->removeAction(lastSep); } if(selAll.count()==1) { _menu->addSeparator(); _menu->addAction(_newFolderAction); } } else { selectionModel()->clear(); } } _menu->addSeparator(); _menu->addAction(_expandAllAction); _menu->addAction(_collapseAllAction); _menu->popup(mapToGlobal(e->pos())); }
void GroupView::getSelection | ( | SubSignalPool & | sel | ) | [slot] |
References GeopsyGui::SignalGroupItem::getSelection(), and TRACE.
Referenced by contextMenuEvent(), GroupView(), newFolder(), newGraphicWindow(), newMapWindow(), newTableWindow(), properties(), and remove().
{ TRACE; model()->getSelection(sel, *selectionModel()); }
void GroupView::mouseDoubleClickEvent | ( | QMouseEvent * | e | ) | [protected, virtual] |
References newGraphicWindow(), and TRACE.
{ TRACE; QModelIndex index=indexAt(e->pos()); if(index.isValid()) newGraphicWindow(); }
void GroupView::newFolder | ( | ) | [slot] |
Called only if the group selection is reduced to one or empty
References getSelection(), GeopsyCore::AbstractSignalGroup::setName(), QGpCoreTools::tr(), and TRACE.
Referenced by setSignalWindow().
{ TRACE; QList<AbstractSignalGroup *> sel=getSelection(false); if(sel.count()!=1) { return; } AbstractSignalGroup * parent=sel.first(); AbstractSignalGroup * g=new SignalGroupFolder(parent); g->setName(tr("New folder")); }
void GroupView::newGraphicWindow | ( | ) | [slot] |
References getSelection(), GeopsyMainWindow::newGraphicWindow(), and TRACE.
Referenced by mouseDoubleClickEvent(), newTool(), and setSignalWindow().
{ TRACE; SubSignalPool sel; getSelection(sel); _sw->newGraphicWindow(sel); }
void GroupView::newMapWindow | ( | ) | [slot] |
References getSelection(), GeopsyMainWindow::newMapWindow(), and TRACE.
Referenced by setSignalWindow().
{ TRACE; SubSignalPool sel; getSelection(sel); _sw->newMapWindow(sel); }
void GroupView::newTableWindow | ( | ) | [slot] |
References getSelection(), GeopsyMainWindow::newTableWindow(), and TRACE.
Referenced by setSignalWindow().
{ TRACE; SubSignalPool sel; getSelection(sel); _sw->newTableWindow(sel); }
void GroupView::newTool | ( | ) | [slot] |
References newGraphicWindow(), ToolFactory::showTool(), GeopsyMainWindow::toolFactory(), and TRACE.
Referenced by contextMenuEvent().
{ TRACE; QAction * a=(QAction * ) sender(); if(a || a->inherits( "QAction" )) { QAction * original=*((QAction **) a->data().toByteArray().data()); newGraphicWindow(); _sw->toolFactory() ->showTool(original); } }
void GroupView::properties | ( | ) | [slot] |
References GroupProperties::Folder, GroupProperties::folder(), getSelection(), QGpGuiTools::PropertyValue::isTouched(), QGpGuiTools::PropertyWidget::propertyValue(), GroupProperties::removeMultiGroup(), QGpGuiTools::Dialog::setMainWidget(), GeopsyCore::AbstractSignalGroup::setParent(), GroupProperties::setProperties(), GroupProperties::setValues(), and TRACE.
Referenced by contextMenuEvent().
{ TRACE; QList<AbstractSignalGroup *> sel=getSelection(true, true); if(sel.isEmpty()) { return; } Dialog * d=new Dialog(this); GroupProperties * dg=new GroupProperties(this); d->setMainWidget(dg); Settings::getWidget(d, "GroupProperties"); dg->removeMultiGroup(); dg->setValues(sel); if(d->exec()==QDialog::Accepted) { Settings::setWidget(d, "GroupProperties"); AbstractSignalGroup * g; foreach(g, sel) { dg->setProperties(g); } if(dg->propertyValue(GroupProperties::Folder)->isTouched()) { AbstractSignalGroup * p=dg->folder(); foreach(g, sel) { g->setParent(p); } } } delete d; }
void GroupView::remove | ( | ) | [slot] |
Unparents all selected groups. Then, it is safe to delete them one by one because they are no longer connected by any parentship.
References getSelection(), and TRACE.
{ TRACE; QList<AbstractSignalGroup *> sel=getSelection(true, true); for(QList<AbstractSignalGroup *>::Iterator it=sel.begin();it!=sel.end();++it) { (*it)->setParent(0); } qDeleteAll(sel); }
void GroupView::select | ( | const QRegExp & | exp | ) |
References GeopsyCore::GeopsyCoreEngine::currentDB(), QGpCoreTools::exp(), GeopsyCore::geopsyCore, GeopsyCore::SignalDB::masterGroup(), and TRACE.
{ TRACE; selectionModel()->clear(); select(geopsyCore->currentDB()->masterGroup(), exp); }
void GroupView::setMode | ( | Mode | m | ) |
References Browse, SigSelectionDnD::disableFilter(), SigSelectionDnD::enableFilter(), Rename, Sort, and TRACE.
Referenced by GroupView().
{ TRACE; switch(m) { case GroupView::Browse: sigDnD->enableFilter(); setDragDropMode(QAbstractItemView::NoDragDrop); setEditTriggers(QAbstractItemView::NoEditTriggers); break; case GroupView::Rename: sigDnD->disableFilter(); setDragDropMode(QAbstractItemView::NoDragDrop); setEditTriggers(QAbstractItemView::AllEditTriggers); break; case GroupView::Sort: sigDnD->disableFilter(); setDragDropMode(QAbstractItemView::DragDrop); setEditTriggers(QAbstractItemView::NoEditTriggers); break; } mode=m; }
void GroupView::setSignalWindow | ( | GeopsyMainWindow * | sw | ) |
References GeopsyMainWindow::newAction(), newFolder(), newGraphicWindow(), newMapWindow(), newTableWindow(), QGpCoreTools::tr(), TRACE, GeopsyMainWindow::viewGraphicAction(), GeopsyMainWindow::viewMapAction(), and GeopsyMainWindow::viewTableAction().
{ TRACE; _sw=sw; // Create actions _tableAction=GeopsyMainWindow::newAction(*_sw->viewTableAction(), this); connect(_tableAction, SIGNAL(triggered()), this, SLOT(newTableWindow()) ); _graphicAction=GeopsyMainWindow::newAction(*_sw->viewGraphicAction(), this); connect(_graphicAction, SIGNAL(triggered()), this, SLOT(newGraphicWindow()) ); _mapAction=GeopsyMainWindow::newAction(*_sw->viewMapAction(), this); connect(_mapAction, SIGNAL(triggered()), this, SLOT(newMapWindow()) ); _newFolderAction=new QAction(this); _newFolderAction->setText(tr("New folder")); connect(_newFolderAction, SIGNAL(triggered()), this, SLOT(newFolder()) ); _expandAllAction=new QAction(this); _expandAllAction->setText(tr("Expand all")); connect(_expandAllAction, SIGNAL(triggered()), this, SLOT(expandAll())); _collapseAllAction=new QAction(this); _collapseAllAction->setText(tr("Collapse all")); connect(_collapseAllAction, SIGNAL(triggered()), this, SLOT(collapseAll())); }
QSize GroupView::sizeHint | ( | ) | const [virtual] |