bool operator< (const QTreeWidgetItem &other) const
 {
     // Probably not needed.
     if (other.type() != packet_type_) return QTreeWidgetItem::operator< (other);
     const ExpertPacketTreeWidgetItem *other_expert = static_cast<const ExpertPacketTreeWidgetItem *>(&other);
     // Force ascending.
     if (treeWidget()->header()->sortIndicatorOrder() == Qt::DescendingOrder) {
         return packet_num_ > other_expert->packetNum();
     } else {
         return packet_num_ < other_expert->packetNum();
     }
 }
Example #2
0
bool CWizFolderSelector::isSelectGroupFolder()
{
    QTreeWidgetItem* item = m_folderView->currentItem();

    if (item->type() > QTreeWidgetItem::UserType)
    {
        CWizCategoryViewItemBase* baseItem = dynamic_cast<CWizCategoryViewItemBase*>(item);
        if (!baseItem)
            return false;

        int nPermission = m_app.databaseManager().db(baseItem->kbGUID()).permission();
        if (nPermission > m_nMinPermission)
        {
            if (nPermission >= WIZ_USERGROUP_READER)
            {
                CWizMessageBox::warning(this, tr("Info"), tr("You have no permission to create note in this group!"));
            }
            else if (nPermission >= WIZ_USERGROUP_EDITOR)
            {
                CWizMessageBox::warning(this, tr("Info"), tr("You have no permission to create folder in this group!"));
            }
            return false;
        }
    }

    if (!m_bAcceptRoot)
        return item->type() == Category_GroupNoTagItem || item->type() == Category_GroupItem;

    return item->type() == Category_GroupRootItem || item->type() == Category_GroupNoTagItem
            || item->type() == Category_GroupItem;
}
void MotionPlanningFrame::computeLoadSceneButtonClicked()
{
  if (planning_scene_storage_)
  {
    QList<QTreeWidgetItem *> sel = ui_->planning_scene_tree->selectedItems();
    if (!sel.empty())
    {
      QTreeWidgetItem *s = sel.front();
      if (s->type() == ITEM_TYPE_SCENE)
      {
        std::string scene = s->text(0).toStdString();
        ROS_DEBUG("Attempting to load scene '%s'", scene.c_str());
        moveit_warehouse::PlanningSceneWithMetadata scene_m;
        bool got_ps = false;
        try
        {
          got_ps = planning_scene_storage_->getPlanningScene(scene_m, scene);
        }
        catch (std::runtime_error &ex)
        {
          ROS_ERROR("%s", ex.what());
        }

        if (got_ps)
        {
          ROS_INFO("Loaded scene '%s'", scene.c_str());
          if (planning_display_->getPlanningSceneMonitor())
          {
            if (scene_m->robot_model_name != planning_display_->getRobotModel()->getName())
            {
              ROS_INFO("Scene '%s' was saved for robot '%s' but we are using robot '%s'. Using scene geometry only",
                       scene.c_str(), scene_m->robot_model_name.c_str(),
                       planning_display_->getRobotModel()->getName().c_str());
              planning_scene_world_publisher_.publish(scene_m->world);
              // publish the parts that are not in the world
              moveit_msgs::PlanningScene diff;
              diff.is_diff = true;
              diff.name = scene_m->name;
              planning_scene_publisher_.publish(diff);
            }
            else
              planning_scene_publisher_.publish(static_cast<const moveit_msgs::PlanningScene&>(*scene_m));
          }
          else
            planning_scene_publisher_.publish(static_cast<const moveit_msgs::PlanningScene&>(*scene_m));
        }
        else
          ROS_WARN("Failed to load scene '%s'. Has the message format changed since the scene was saved?", scene.c_str());
      }
    }
  }
}
Example #4
0
void ViewListTreeWidget::mousePressEvent ( QMouseEvent *event )
{
    if ( event->button() == Qt::RightButton ) {
        QTreeWidgetItem *item = itemAt( event->pos() );
        if ( item && item->type() == ViewListItem::ItemType_Category ) {
            setCurrentItem( item );
            emit customContextMenuRequested( event->pos() );
            event->accept();
            return;
        }
    }
    QTreeWidget::mousePressEvent( event );
}
Example #5
0
bool FileItem::operator<(const QTreeWidgetItem& other) const {
	if (type() == other.type()) {
		bool ok;
		FileInfo* info = (FileInfo*)other.data(0, Qt::UserRole).toULongLong(&ok);

		if (!ok)
			return QTreeWidgetItem::operator <(other);

		QTreeWidget* tree = treeWidget();
		int column = tree->sortColumn();

		if (column == 0)
			return m_fileInfo.filename < info->filename;

		if (column == 1)
			return m_fileInfo.filesize < info->filesize;

		if (column == 2)
			return m_fileInfo.filetime < info->filetime;
	}

	return type() < other.type();
}
 bool operator<(const QTreeWidgetItem &other) const
 {
     QString thisId = text(1);
     QString thatId = other.text(1);
     if (thisId.isNull())
         return true;
     if (thatId.isNull())
         return false;
     if (m_fBuiltIn)
         return true;
     if (other.type() == UILanguageItemType && ((UILanguageItem*)&other)->m_fBuiltIn)
         return false;
     return QTreeWidgetItem::operator<(other);
 }
Example #7
0
void ChannelsJoinDialogTreeWidget::mouseDoubleClickEvent(QMouseEvent *e)
{
	QTreeWidgetItem * it = itemAt(e->pos());
	ChannelsJoinDialog *pDialog = (ChannelsJoinDialog*) parentWidget();
	if(!it || !pDialog || !(e->button() & Qt::LeftButton))
		return;

	if(it->type() == ChannelsJoinDialog::HeaderItem)
		return;

	setCurrentItem(it);
	pDialog->itemSelected();
	pDialog->joinClicked();
}
 bool BookmarkGui::changeState( QString new_state )
 {
     Bookmark bk ;
     QueryResult favorite ;
     QTreeWidgetItem *item ;

     bk.getFavoriteFullData( favorite , this->current_favorite );

     QList<QTreeWidgetItem *> list =
             ui->treeStates->findItems ( favorite.getField( "Titolo" , favorite.begin() ) , Qt::MatchExactly|Qt::MatchRecursive ) ;

     if ( list.size() > 1 ) return false ;

     QList<QTreeWidgetItem *> list_state =
             ui->treeStates->findItems ( new_state , Qt::MatchExactly ) ;


     if ( list_state.isEmpty() || list_state.size() > 1 ) return false ;

     QTreeWidgetItem *state = list_state.first() ;

     if ( state->type() != BookmarkGui::item_state ) return false ;

     item = list.first() ;

     if ( item->type() != BookmarkGui::item_article ) return false ;

     int index = item->parent()->indexOfChild( item ) ;
     item = item->parent()->takeChild( index ) ;

     state->addChild( item );
     state->setExpanded( true );

     ui->treeStates->setCurrentItem( item );

     return true ;
 }
 bool BookmarkGui::changeEvaluation( QString stars )
 {
     Bookmark bk ;
     QueryResult favorite ;
     QTreeWidgetItem *item ;

     bk.getFavoriteFullData( favorite , this->current_favorite );

     QList<QTreeWidgetItem *> list =
             ui->treeEvaluations->findItems ( favorite.getField( "Titolo" , favorite.begin() ) , Qt::MatchExactly|Qt::MatchRecursive ) ;

     if ( list.size() > 1 ) return false ;

     QList<QTreeWidgetItem *> list_evaluations =
             ui->treeEvaluations->findItems ( stars , Qt::MatchExactly , 1 ) ;

     if ( list_evaluations.isEmpty() || list_evaluations.size() > 1 ) return false ;

     QTreeWidgetItem *evaluation = list_evaluations.first() ;

     if ( evaluation->type() != BookmarkGui::item_evaluation ) return false ;

     item = list.first() ;

     if ( item->type() != BookmarkGui::item_article ) return false ;

     int index = item->parent()->indexOfChild( item ) ;
     item = item->parent()->takeChild( index ) ;

     evaluation->addChild( item );
     evaluation->setExpanded( true );

     ui->treeEvaluations->setCurrentItem( item );

     return true ;
 }
Example #10
0
void
Athlete::rideTreeWidgetSelectionChanged()
{
    if (treeWidget->selectedItems().isEmpty())
        context->ride = NULL;
    else {
        QTreeWidgetItem *which = treeWidget->selectedItems().first();
        if (which->type() != RIDE_TYPE) return; // ignore!
        else
            context->ride = (RideItem*) which;
    }

    // emit signal!
    context->notifyRideSelected(context->ride);
}
Example #11
0
// Legal client/port item position helper.
int qjackctlConnectorView::itemY ( QTreeWidgetItem *pItem ) const
{
	QRect rect;
	QTreeWidget *pList = pItem->treeWidget();
	QTreeWidgetItem *pParent = pItem->parent();
	qjackctlClientItem *pClientItem = NULL;
	if (pParent && pParent->type() == QJACKCTL_CLIENTITEM)
		pClientItem = static_cast<qjackctlClientItem *> (pParent);
	if (pClientItem && !pClientItem->isOpen()) {
		rect = pList->visualItemRect(pClientItem);
	} else {
		rect = pList->visualItemRect(pItem);
	}
	return rect.top() + rect.height() / 2;
}
void UI_LinkNameDialog::slot_TreeLeftClicked(QTreeWidgetItem *pItem, int)
{
    QTreeWidgetItem *pCurrentItem = (QTreeWidgetItem *)pItem;/// 设置当前的树节点
    if (pCurrentItem == NULL)
    {
        return;
    }
    qDebug()<<__func__<<__LINE__<<pCurrentItem->type()<<pCurrentItem->text(0);
    if (pCurrentItem->type() == CGI_SCADA_DLL_I::TreeItemType_Undefined)
    {
        return;
    }
    CGI_SCADA_DLL_TreeItemDevice *pCGI_SCADA_DLL_TreeItemDevice = (CGI_SCADA_DLL_TreeItemDevice*)m_TreeWidgetItemCorrespond.key(pItem);
    switch (pItem->type()) {
    case CGI_SCADA_DLL_I::TreeItemType_ChanneM_COM_Device:
        qDebug()<<__func__<<__LINE__<<"ComDevice";
        m_pStringListModel = new QStringListModel;
        ui->listView->setModel(pCGI_SCADA_DLL_TreeItemDevice->GetListModel(m_pStringListModel));

        break;
    case CGI_SCADA_DLL_I::TreeItemType_ChanneM_CAN_Device:
        qDebug()<<__func__<<__LINE__<<"CanDevice";
        m_pStringListModel = new QStringListModel;
        ui->listView->setModel(pCGI_SCADA_DLL_TreeItemDevice->GetListModel(m_pStringListModel));

        break;
    case CGI_SCADA_DLL_I::TreeItemType_ChanneM_NET_Link_Device:
        qDebug()<<__func__<<__LINE__<<"NetLinkDevice";
        m_pStringListModel = new QStringListModel;
        ui->listView->setModel(pCGI_SCADA_DLL_TreeItemDevice->GetListModel(m_pStringListModel));

        break;
    default:
        break;
    }
}
void LVRMainWindow::showColorDialog()
{
	QColor c = QColorDialog::getColor();
	QList<QTreeWidgetItem*> items = treeWidget->selectedItems();
	if(items.size() > 0)
	{
		QTreeWidgetItem* item = items.first();
		if(item->type() == LVRPointCloudItemType)
		{
			LVRPointCloudItem* pc_item = static_cast<LVRPointCloudItem*>(item);
			pc_item->setColor(c);
		}
		else if(item->type() == LVRMeshItemType)
		{
		    LVRMeshItem* mesh_item = static_cast<LVRMeshItem*>(item);
		    mesh_item->setColor(c);
		}
		else {
			return;
		}

		refreshView();
	}
}
void LVRMainWindow::changeShading(int shader)
{
    QList<QTreeWidgetItem*> items = treeWidget->selectedItems();
    if(items.size() > 0)
    {
        QTreeWidgetItem* item = items.first();

        if(item->type() == LVRMeshItemType)
        {
            LVRMeshItem* model_item = static_cast<LVRMeshItem*>(item);
            model_item->setShading(shader);
            refreshView();
        }
    }
}
void LVRMainWindow::deleteModelItem()
{
    QList<QTreeWidgetItem*> items = treeWidget->selectedItems();
    if(items.size() > 0)
    {
        QTreeWidgetItem* item = items.first();

        if(item->type() == LVRModelItemType)
        {
            QTreeWidgetItemIterator it(item);

            while(*it)
            {
                QTreeWidgetItem* child_item = *it;
                if(child_item->type() == LVRPointCloudItemType && child_item->parent() == item)
                {
                    LVRPointCloudItem* pc_item = getPointCloudItem(item);
                    if(pc_item != NULL) m_renderer->RemoveActor(pc_item->getActor());
                }
                else if(child_item->type() == LVRMeshItemType && child_item->parent() == item)
                {
                    LVRMeshItem* mesh_item = getMeshItem(item);
                    if(mesh_item != NULL)
                    {
                        m_renderer->RemoveActor(mesh_item->getWireframeActor());
                        m_renderer->RemoveActor(mesh_item->getActor());
                    }
                }

                ++it;
            }
        }
        else
        {
            // Remove model from view
            LVRPointCloudItem* pc_item = getPointCloudItem(item);
            if(pc_item != NULL) m_renderer->RemoveActor(pc_item->getActor());

            LVRMeshItem* mesh_item = getMeshItem(item);
            if(mesh_item != NULL) m_renderer->RemoveActor(mesh_item->getActor());
        }

        // Remove list item (safe according to http://stackoverflow.com/a/9399167)
        delete item;

        refreshView();
    }
}
Example #16
0
bool FileBrowser::filterItems( const QString & filter, QTreeWidgetItem * item )
{
	// call with item=NULL to filter the entire tree
	bool anyMatched = false;

	int numChildren = item ? item->childCount() : m_l->topLevelItemCount();
	for( int i = 0; i < numChildren; ++i )
	{
		QTreeWidgetItem * it = item ? item->child( i ) : m_l->topLevelItem(i);

		// is directory?
		if( it->childCount() )
		{
			// matches filter?
			if( it->text( 0 ).
				contains( filter, Qt::CaseInsensitive ) )
			{
				// yes, then show everything below
				it->setHidden( false );
				filterItems( QString::null, it );
				anyMatched = true;
			}
			else
			{
				// only show if item below matches filter
				bool didMatch = filterItems( filter, it );
				it->setHidden( !didMatch );
				anyMatched = anyMatched || didMatch;
			}
		}
		// a standard item (i.e. no file or directory item?)
		else if( it->type() == QTreeWidgetItem::Type )
		{
			// hide if there's any filter
			it->setHidden( !filter.isEmpty() );
		}
		else
		{
			// file matches filter?
			bool didMatch = it->text( 0 ).
				contains( filter, Qt::CaseInsensitive );
			it->setHidden( !didMatch );
			anyMatched = anyMatched || didMatch;
		}
	}

	return anyMatched;
}
Example #17
0
// Client:port hilite update stabilization.
void qjackctlClientList::hiliteClientPorts (void)
{
	qjackctlClientItem *pClient;
	qjackctlPortItem *pPort;

	QTreeWidgetItem *pItem = m_pListView->currentItem();

	// Dehilite the previous selected items.
	if (m_pHiliteItem && pItem != m_pHiliteItem) {
		if (m_pHiliteItem->type() == QJACKCTL_CLIENTITEM) {
			pClient = static_cast<qjackctlClientItem *> (m_pHiliteItem);
			QListIterator<qjackctlPortItem *> iter(pClient->ports());
			while (iter.hasNext()) {
				pPort = iter.next();
				QListIterator<qjackctlPortItem *> it(pPort->connects());
				while (it.hasNext())
					(it.next())->setHilite(false);
			}
		} else {
			pPort = static_cast<qjackctlPortItem *> (m_pHiliteItem);
			QListIterator<qjackctlPortItem *> it(pPort->connects());
			while (it.hasNext())
				(it.next())->setHilite(false);
		}
	}

	// Hilite the now current selected items.
	if (pItem) {
		if (pItem->type() == QJACKCTL_CLIENTITEM) {
			pClient = static_cast<qjackctlClientItem *> (pItem);
			QListIterator<qjackctlPortItem *> iter(pClient->ports());
			while (iter.hasNext()) {
				pPort = iter.next();
				QListIterator<qjackctlPortItem *> it(pPort->connects());
				while (it.hasNext())
					(it.next())->setHilite(true);
			}
		} else {
			pPort = static_cast<qjackctlPortItem *> (pItem);
			QListIterator<qjackctlPortItem *> it(pPort->connects());
			while (it.hasNext())
				(it.next())->setHilite(true);
		}
	}

	// Do remember this one, ever.
	m_pHiliteItem = pItem;
}
Example #18
0
void FileBrowser::filterItems( const QString & filter )
{
	const bool show_all = filter.isEmpty();

	for( int i = 0; i < m_l->topLevelItemCount(); ++i )
	{
		QTreeWidgetItem * it = m_l->topLevelItem( i );
		// show all items if filter is empty
		if( show_all )
		{
			it->setHidden( false );
			if( it->childCount() )
			{
				filterItems( it, filter );
			}
		}
		// is directory?
		else if( it->childCount() )
		{
			// matches filter?
			if( it->text( 0 ).
				contains( filter, Qt::CaseInsensitive ) )
			{
				// yes, then show everything below
				it->setHidden( false );
				filterItems( it, QString::null );
			}
			else
			{
				// only show if item below matches filter
				it->setHidden( !filterItems( it, filter ) );
			}
		}
		// a standard item (i.e. no file or directory item?)
		else if( it->type() == QTreeWidgetItem::Type )
		{
			// hide in every case when filtering
			it->setHidden( true );
		}
		else
		{
			// file matches filter?
			it->setHidden( !it->text( 0 ).
				contains( filter, Qt::CaseInsensitive ) );
		}
	
	}
}
Example #19
0
void ChatLobbyWidget::unsubscribeItem()
{
	QTreeWidgetItem *item = lobbyTreeWidget->currentItem();
	if (item == NULL && item->type() != TYPE_LOBBY) {
		return;
	}

	const ChatLobbyId id = item->data(COLUMN_DATA, ROLE_ID).toULongLong();

	std::string vpeer_id;
	if (rsMsgs->getVirtualPeerId(id, vpeer_id)) {
		ChatDialog::closeChat(vpeer_id);
	}

	rsMsgs->unsubscribeChatLobby(id);
}
const QString LteMacStatisticsDialog::filterExpression()
{
    QString filter_expr;
    if (statsTreeWidget()->selectedItems().count() > 0) {
        QTreeWidgetItem *ti = statsTreeWidget()->selectedItems()[0];

        if (ti->type() == mac_whole_ue_row_type_) {
            MacUETreeWidgetItem *mac_ue_ti = static_cast<MacUETreeWidgetItem*>(ti);
            filter_expr = mac_ue_ti->filterExpression();
        } else {
            MacULDLTreeWidgetItem *mac_channels_ti = static_cast<MacULDLTreeWidgetItem*>(ti);
            filter_expr = mac_channels_ti->filterExpression();
        }
    }
    return filter_expr;
}
Example #21
0
/** Saves the changes on this page */
bool SoundPage::save(QString &/*errmsg*/)
{
	QTreeWidgetItemIterator itemIterator(ui.eventTreeWidget);
	QTreeWidgetItem *item = NULL;
	while ((item = *itemIterator) != NULL) {
		itemIterator++;

		if (item->type() == TYPE_ITEM) {
			const QString event = item->data(COLUMN_DATA, ROLE_EVENT).toString();
			soundManager->setEventEnabled(event, item->checkState(COLUMN_NAME) == Qt::Checked);
			soundManager->setEventFilename(event, item->text(COLUMN_FILENAME));
		}
	}

	return true;
}
const QString ServiceResponseTimeDialog::filterExpression()
{
    QString filter_expr;
    if (statsTreeWidget()->selectedItems().count() > 0) {
        QTreeWidgetItem *ti = statsTreeWidget()->selectedItems()[0];
        if (ti->type() == srt_row_type_) {
            SrtTableTreeWidgetItem *srtt_ti = static_cast<SrtTableTreeWidgetItem *>(ti->parent());
            QString field = srtt_ti->filterField();
            QString value = ti->text(SRT_COLUMN_INDEX);
            if (srtt_ti && !field.isEmpty() && !value.isEmpty()) {
                filter_expr = QString("%1==%2").arg(srtt_ti->filterField()).arg(value);
            }
        }
    }
    return filter_expr;
}
void MotionPlanningFrame::computeLoadQueryButtonClicked()
{
  if (planning_scene_storage_)
  {
    QList<QTreeWidgetItem *> sel = ui_->planning_scene_tree->selectedItems();
    if (!sel.empty())
    {
      QTreeWidgetItem *s = sel.front();
      if (s->type() == ITEM_TYPE_QUERY)
      {
        std::string scene = s->parent()->text(0).toStdString();
        std::string query_name = s->text(0).toStdString();
        moveit_warehouse::MotionPlanRequestWithMetadata mp;
        bool got_q = false;
        try
        {
          got_q = planning_scene_storage_->getPlanningQuery(mp, scene, query_name);
        }
        catch (std::runtime_error &ex)
        {
          ROS_ERROR("%s", ex.what());
        }
        
        if (got_q)
        {
          robot_state::RobotStatePtr start_state(new robot_state::RobotState(*planning_display_->getQueryStartState()));
          robot_state::robotStateMsgToRobotState(planning_display_->getPlanningSceneRO()->getTransforms(), mp->start_state, *start_state);
          planning_display_->setQueryStartState(*start_state);
          
          robot_state::RobotStatePtr goal_state(new robot_state::RobotState(*planning_display_->getQueryGoalState()));
          for (std::size_t i = 0 ; i < mp->goal_constraints.size() ; ++i)
            if (mp->goal_constraints[i].joint_constraints.size() > 0)
            {
              std::map<std::string, double> vals;
              for (std::size_t j = 0 ; j < mp->goal_constraints[i].joint_constraints.size() ; ++j)
                vals[mp->goal_constraints[i].joint_constraints[j].joint_name] = mp->goal_constraints[i].joint_constraints[j].position;
              goal_state->setVariablePositions(vals);
              break;
            }
          planning_display_->setQueryGoalState(*goal_state);
        }
        else
          ROS_ERROR("Failed to load planning query '%s'. Has the message format changed since the query was saved?", query_name.c_str());
      }
    }
  }
}
//---------------------------------------------------------------------------------------
// Process tap info from a new packet.
// Returns TRUE if a redraw is needed.
gboolean LteMacStatisticsDialog::tapPacket(void *ws_dlg_ptr, struct _packet_info *, epan_dissect *, const void *mac_lte_tap_info_ptr)
{
    // Look up dialog and tap info.
    LteMacStatisticsDialog *ws_dlg = static_cast<LteMacStatisticsDialog *>(ws_dlg_ptr);
    const mac_lte_tap_info *mlt_info  = (mac_lte_tap_info *) mac_lte_tap_info_ptr;
    if (!ws_dlg || !mlt_info) {
        return FALSE;
    }

    // Update common stats.
    ws_dlg->updateCommonStats(mlt_info);

    // Nothing more to do if tap entry isn't for a UE.
    if ((mlt_info->rntiType != C_RNTI) && (mlt_info->rntiType != SPS_RNTI)) {
        return FALSE;
    }

    // Look for an existing UE to match this tap info.
    MacUETreeWidgetItem *mac_ue_ti = NULL;
    for (int i = 0; i < ws_dlg->statsTreeWidget()->topLevelItemCount(); i++) {
        QTreeWidgetItem *ti = ws_dlg->statsTreeWidget()->topLevelItem(i);
        // Make sure we're looking at a UE entry
        if (ti->type() != mac_whole_ue_row_type_) {
            continue;
        }

        // See if current item matches tap.
        MacUETreeWidgetItem *cur_muds_ti = static_cast<MacUETreeWidgetItem*>(ti);
        if (cur_muds_ti->isMatch(mlt_info)) {
            mac_ue_ti = cur_muds_ti;
            break;
        }
    }

    // If don't find matching UE, create a new one.
    if (!mac_ue_ti) {
        mac_ue_ti = new MacUETreeWidgetItem(ws_dlg->statsTreeWidget(), mlt_info);
        for (int col = 0; col < ws_dlg->statsTreeWidget()->columnCount(); col++) {
            mac_ue_ti->setTextAlignment(col, ws_dlg->statsTreeWidget()->headerItem()->textAlignment(col));
        }
    }

    // Update the UE item with info from tap!
    mac_ue_ti->update(mlt_info);
    return TRUE;
}
Example #25
0
void HandleViewList::addView( XmdvTool::VISTYPE visType) {
	// Get the current item
	QTreeWidgetItem * current = m_viewListDock->m_viewTree->currentItem ();

	if (!current) {
		return;
	}
	switch ( current->type() ) {
	case DatasetItemType :
		break;
	case PipelineItemType :
		addViewForPipeline( current, visType );
		break;
	case ViewItemType :
		break;
	}
}
void LVRMainWindow::toggleMeshes(bool checkboxState)
{
	QTreeWidgetItemIterator it(treeWidget);

	while(*it)
	{
		QTreeWidgetItem* item = *it;
		if(item->type() == LVRMeshItemType)
		{
            LVRModelItem* model_item = static_cast<LVRModelItem*>(item->parent());
            if(model_item->isEnabled()) model_item->setVisibility(checkboxState);
		}
		++it;
	}

	refreshView();
}
void LVRMainWindow::toggleNormals(bool checkboxState)
{
    QTreeWidgetItemIterator it(treeWidget);

    while(*it)
    {
        QTreeWidgetItem* item = *it;
        if(item->type() == LVRPointCloudItemType)
        {
            LVRModelItem* model_item = static_cast<LVRModelItem*>(item->parent());
            if(model_item->isEnabled()) return; // TODO: functions to show/hide normals
        }
        ++it;
    }

    refreshView();
}
/*! store displayed tree widget item data in model
*/
void
CQPropertyDelegate::
setModelData(QWidget *, QAbstractItemModel *model, const QModelIndex &index) const
{
  QTreeWidgetItem *item = getModelItem(index);
  assert(item);

  if (CQPropertyItem::isType(item->type())) {
    CQPropertyItem *item1 = dynamic_cast<CQPropertyItem *>(item);
    assert(item1);

    QVariant var = item1->getEditorData();

    model->setData(index, var);
  }
  else
    assert(false);
}
void ServiceResponseTimeDialog::statsTreeWidgetItemChanged()
{
    QString procedure_title = service_response_time_get_column_name(SRT_COLUMN_PROCEDURE);

    if (statsTreeWidget()->selectedItems().count() > 0) {
        QTreeWidgetItem *ti = statsTreeWidget()->selectedItems()[0];
        SrtTableTreeWidgetItem *srtt_ti = NULL;
        if (ti->type() == srt_row_type_) {
            srtt_ti = static_cast<SrtTableTreeWidgetItem *>(ti->parent());
        } else {
            srtt_ti = static_cast<SrtTableTreeWidgetItem *>(ti);
        }
        if (srtt_ti) {
            procedure_title = srtt_ti->columnTitle();
        }
    }
    statsTreeWidget()->headerItem()->setText(SRT_COLUMN_PROCEDURE, procedure_title);
}
void LVRMainWindow::exportSelectedModel()
{
    // Get selected point cloud
    QList<QTreeWidgetItem*> items = treeWidget->selectedItems();
    if(items.size() > 0)
    {
        QTreeWidgetItem* item = items.first();
        if(item->type() == LVRPointCloudItemType)
        {
            if(item->parent() && item->parent()->type() == LVRModelItemType)
            {
                QString qFileName = QFileDialog::getSaveFileName(this, tr("Export Point Cloud As..."), "", tr("Point cloud Files(*.ply *.3d)"));

                LVRModelItem* model_item = static_cast<LVRModelItem*>(item->parent());
                LVRPointCloudItem* pc_item = static_cast<LVRPointCloudItem*>(item);
                PointBufferPtr points = pc_item->getPointBuffer();

                // Get transformation matrix
                Pose p = model_item->getPose();
                Matrix4f mat(Vertexf(p.x, p.y, p.z), Vertexf(p.r, p.t, p.p));

                // Allocate target buffer and insert transformed points
                size_t n;
                floatArr transformedPoints(new float[3 * points->getNumPoints()]);
                floatArr pointArray = points->getPointArray(n);
                for(size_t i = 0; i < points->getNumPoints(); i++)
                {
                    Vertexf v(pointArray[3 * i], pointArray[3 * i + 1], pointArray[3 * i + 2]);
                    Vertexf vt = mat * v;

                    transformedPoints[3 * i    ] = vt[0];
                    transformedPoints[3 * i + 1] = vt[1];
                    transformedPoints[3 * i + 2] = vt[2];
                }

                // Save transformed points
                PointBufferPtr trans(new PointBuffer);
                trans->setPointArray(transformedPoints, n);
                ModelPtr model(new Model(trans));
                ModelFactory::saveModel(model, qFileName.toStdString());
            }
        }
    }
}