27 #include "../../datasource/explorer/DataSetGroupItem.h" 
   28 #include "../../datasource/explorer/DataSetCategoryGroupItem.h" 
   29 #include "../../datasource/explorer/DataSetItem.h" 
   46     m_isCategoryModel(true),
 
   47     m_useCheckableItems(true)
 
   49   this->setContextMenuPolicy(Qt::CustomContextMenu);
 
   52   connect(
this, SIGNAL(
clicked(
const QModelIndex&)), 
this, SLOT(
onItemClicked(
const QModelIndex&)));
 
   54   connect(
this, SIGNAL(
entered(
const QModelIndex&)), 
this, SLOT(
onItemEntered(
const QModelIndex&)));
 
   55   connect(
this, SIGNAL(
pressed(
const QModelIndex&)), 
this, SLOT(
onItemPressed(
const QModelIndex&)));
 
   56   connect(
this, SIGNAL(customContextMenuRequested(
const QPoint&)), 
this, SLOT(
customContextMenu(
const QPoint&)));
 
   70   m_useCheckableItems = useCheckableItems;
 
   72   m_treeModel->setCheckable(m_useCheckableItems);
 
   73   m_categoryModel->setCheckable(m_useCheckableItems);
 
   75   this->setModel(m_treeModel.get());
 
   77   m_isCategoryModel = 
true;
 
   82   std::list<DataSetItem*> ditems;
 
   84   QModelIndexList items = selectedIndexes();
 
   86   for(QModelIndexList::iterator it = items.begin(); it != items.end(); ++it)
 
   96       ditems.push_back(ditem);
 
  104   QModelIndexList items = selectedIndexes();
 
  106   for(QModelIndexList::iterator it = items.begin(); it != items.end(); ++it)
 
  133     emit activated(ditem);
 
  139   if(categoryItem != 0)
 
  141     emit activated(categoryItem);
 
  148     emit activated(groupItem);
 
  158   QAbstractItemModel* model = this->model();
 
  166     if(model && !m_useCheckableItems)
 
  169     QVariant value = item->
data(0, Qt::CheckStateRole);
 
  181   if(categoryItem != 0)
 
  183     emit clicked(categoryItem);
 
  185     if(model && !m_useCheckableItems)
 
  188     if(model && !m_useCheckableItems)
 
  191     QVariant value = item->
data(0, Qt::CheckStateRole);
 
  196     emit toggled(categoryItem);
 
  205     emit clicked(groupItem);
 
  207     if(model && !m_useCheckableItems)
 
  210     if(model && !m_useCheckableItems)
 
  213     QVariant value = item->
data(0, Qt::CheckStateRole);
 
  218     emit toggled(groupItem);
 
  235     emit doubleClicked(ditem);
 
  241   if(categoryItem != 0)
 
  243     emit doubleClicked(categoryItem);
 
  250     emit doubleClicked(groupItem);
 
  270   if(categoryItem != 0)
 
  272     emit entered(categoryItem);
 
  279     emit entered(groupItem);
 
  299   if(categoryItem != 0)
 
  301     emit pressed(categoryItem);
 
  308     emit pressed(groupItem);
 
  313   QMenu *menu = 
new QMenu(
"", 
this);
 
  315   QAction * organize = 
new QAction(tr(
"Organize by category"), menu);
 
  316   organize->setCheckable(
true);
 
  318   if(m_isCategoryModel)
 
  319     organize->setChecked(
true);
 
  321   connect(organize, SIGNAL(toggled(
bool)), 
this, SLOT(onModelToggled(
bool)));
 
  322   menu->addAction(organize);
 
  323   menu->exec(QCursor::pos());
 
  329     this->setModel(m_categoryModel.get());
 
  331     this->setModel(m_treeModel.get());
 
  333   m_isCategoryModel = checked;
 
  335   QAbstractItemModel* nmodel = model();
 
  337   QModelIndex idx = nmodel->index(0, 0);
 
  341   if(m_isCategoryModel)
 
  345     for(
int i = 0; i < item->children().size(); i++)
 
  347       QModelIndex idxChild = nmodel->index(i, 0, idx);
 
A tree view for datasets of a data source. 
 
A simple model for datasets belonging to a data source. 
 
boost::shared_ptr< DataSourceInfo > DataSourceInfoPtr