本文整理汇总了C++中QTreeWidgetItem::type方法的典型用法代码示例。如果您正苦于以下问题:C++ QTreeWidgetItem::type方法的具体用法?C++ QTreeWidgetItem::type怎么用?C++ QTreeWidgetItem::type使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTreeWidgetItem
的用法示例。
在下文中一共展示了QTreeWidgetItem::type方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
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();
}
}
示例2: isSelectGroupFolder
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;
}
示例3: computeLoadSceneButtonClicked
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());
}
}
}
}
示例4: mousePressEvent
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 );
}
示例5: type
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();
}
示例6: text
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);
}
示例7: mouseDoubleClickEvent
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();
}
示例8: changeState
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 ;
}
示例9: changeEvaluation
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 ;
}
示例10:
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);
}
示例11: itemY
// 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;
}
示例12: slot_TreeLeftClicked
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;
}
}
示例13: showColorDialog
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();
}
}
示例14: changeShading
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();
}
}
}
示例15: deleteModelItem
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();
}
}