本文整理汇总了C++中setCurrentItem函数的典型用法代码示例。如果您正苦于以下问题:C++ setCurrentItem函数的具体用法?C++ setCurrentItem怎么用?C++ setCurrentItem使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setCurrentItem函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: itemAt
void VDirectoryTree::mousePressEvent(QMouseEvent *event)
{
QTreeWidgetItem *item = itemAt(event->pos());
if (!item) {
setCurrentItem(NULL);
}
VTreeWidget::mousePressEvent(event);
}
示例2: setCurrentItem
void XmlTreeWidget::slotFindPrev()
{
int iCur, iPrev;
iCur = m_foundItems.indexOf(currentItem());
if(iCur != -1 && iCur > 0) {
iPrev = iCur-1;
setCurrentItem(m_foundItems.at(iPrev));
}
}
示例3: findItemByUrl
void ScanGallery::slotSelectImage(const KUrl &url)
{
FileTreeViewItem *found = findItemByUrl(url);
if (found==NULL) found = m_defaultBranch->root();
scrollToItem(found);
setCurrentItem(found);
slotItemActivated(found);
}
示例4: setCurrentItem
void DualEditableTree::itemClicked(QListViewItem *item, const QPoint &, int column)
{
if(item)
{
curCol = column;
if(item == currentItem())
setCurrentItem(item);
}
}
示例5: currentItemFromSelection
void PropertyWidget_PathText::handleSelectionChanged()
{
if (!m_doc || !m_ScMW || m_ScMW->scriptIsRunning())
return;
PageItem* currItem = currentItemFromSelection();
setCurrentItem(currItem);
updateGeometry();
}
示例6: currentItemFromSelection
void PropertiesPalette_Group::handleSelectionChanged()
{
if (!m_haveDoc || !m_ScMW || m_ScMW->scriptIsRunning())
return;
PageItem* currItem = currentItemFromSelection();
if (m_doc->m_Selection->count() > 1)
{
bool widgetEnabled = false;
if (m_haveItem && m_item)
{
if ((m_item->isGroup()) && (!m_item->isSingleSel))
widgetEnabled = true;
}
setEnabled(widgetEnabled);
}
else
{
int itemType = currItem ? (int) currItem->itemType() : -1;
m_haveItem = (itemType != -1);
switch (itemType)
{
case -1:
setEnabled(false);
break;
case PageItem::ImageFrame:
case PageItem::LatexFrame:
case PageItem::OSGFrame:
if (currItem->asOSGFrame())
{
setEnabled(false);
}
break;
case PageItem::Arc:
case PageItem::TextFrame:
case PageItem::Line:
case PageItem::ItemType1:
case PageItem::ItemType3:
case PageItem::Polygon:
case PageItem::PolyLine:
case PageItem::PathText:
case PageItem::RegularPolygon:
setEnabled(false);
break;
case PageItem::Symbol:
setEnabled(true);
break;
}
}
if (currItem)
{
setCurrentItem(currItem);
}
updateGeometry();
repaint();
}
示例7: setCurrentItem
void KCombo::setText( const char *text)
{
setCurrentItem(0);
if (!set_text_called) {
set_text_called = true;
insertItem(text, 0);
}
changeItem(text, 0);
}
示例8: getNoteWithGuid
void NotesWidget::selectNoteWithGuid(QString guid)
{
ListItem *item = getNoteWithGuid(guid);
if (item == NULL)
return;
setCurrentItem(item);
}
示例9: QTreeWidget
/* 构造函数实现 */
_CategoriesTree::_CategoriesTree(QWidget *_Parent)
: QTreeWidget(_Parent)
{
/* "评分" */
m_RatingRootItem = new QTreeWidgetItem(this, QStringList() << wxNote::g_RatingListName);
m_RatingRootItem->setIcon(0, QIcon(":/wxNote_Icons/rating.png"));
m_RatingRootItem->setExpanded(true);
m_ExcellentItem = new QTreeWidgetItem(
m_RatingRootItem, QStringList() << wxNote::g_ExcellentName);
m_ExcellentItem->setIcon(0, QIcon(":/wxNote_Icons/excellent.png"));
m_GoodItem = new QTreeWidgetItem(
m_RatingRootItem, QStringList() << wxNote::g_GoodName);
m_GoodItem->setIcon(0, QIcon(":/wxNote_Icons/good.png"));
m_AverageItem = new QTreeWidgetItem(
m_RatingRootItem, QStringList() << wxNote::g_AverageName);
m_AverageItem->setIcon(0, QIcon(":/wxNote_Icons/average.png"));
m_FairItem = new QTreeWidgetItem(
m_RatingRootItem, QStringList() << wxNote::g_FairName);
m_FairItem->setIcon(0, QIcon(":/wxNote_Icons/fair.png"));
m_PoorItem = new QTreeWidgetItem(
m_RatingRootItem, QStringList() << ("差"));
m_PoorItem->setIcon(0, QIcon(":/wxNote_Icons/poor.png"));
/* "颜色标签" */
m_ColorLabelRootItem = new QTreeWidgetItem(
this, QStringList() << wxNote::g_ColorLabelListName);
m_ColorLabelRootItem->setIcon(0, QIcon(":/wxNote_Icons/colorLabel.png"));
m_ColorLabelRootItem->setExpanded(true);
m_ImportantItem = new QTreeWidgetItem(m_ColorLabelRootItem,
QStringList() << wxNote::g_ImportantName);
m_ImportantItem->setIcon(0, QIcon(":/wxNote_Icons/important.png"));
m_WorkItem = new QTreeWidgetItem(m_ColorLabelRootItem,
QStringList() << wxNote::g_WorkName);
m_WorkItem->setIcon(0, QIcon(":/wxNote_Icons/work.png"));
m_PersonalItem = new QTreeWidgetItem(m_ColorLabelRootItem,
QStringList() << wxNote::g_PersonalName);
m_PersonalItem->setIcon(0, QIcon(":/wxNote_Icons/personal.png"));
m_ToDoItem = new QTreeWidgetItem(m_ColorLabelRootItem,
QStringList() << wxNote::g_ToDoName);
m_ToDoItem->setIcon(0, QIcon(":/wxNote_Icons/toDo.png"));
m_LaterItem = new QTreeWidgetItem(m_ColorLabelRootItem,
QStringList() << wxNote::g_LaterName);
m_LaterItem->setIcon(0, QIcon(":/wxNote_Icons/later.png"));
setCurrentItem(m_RatingRootItem);
setHeaderHidden(true);
}
示例10: setItemExpanded
void ScTreeWidget::handleMousePress(QTreeWidgetItem *item)
{
if (item == 0)
return;
if (item->parent() == 0)
{
if (item->isDisabled())
{
setItemExpanded(item, false);
return;
}
int wide = 0;
int tops = topLevelItemCount();
if (m_toolbox_mode)
{
for (int t = 0; t < tops; t++)
{
setItemExpanded(topLevelItem(t), false);
}
setCurrentItem(item);
setItemExpanded(item, true);
if (item->childCount() != 0)
{
QTreeWidgetItem *child = item->child(0);
if (child != 0)
wide = itemWidget(child, 0)->minimumSizeHint().width()+5;
}
if (wide != 0)
setColumnWidth(0, wide);
else
resizeColumnToContents(0);
}
else
{
setItemExpanded(item, !isItemExpanded(item));
for (int t = 0; t < tops; t++)
{
QTreeWidgetItem *top = topLevelItem(t);
if (isItemExpanded(top))
{
if (top->childCount() != 0)
{
QTreeWidgetItem *child = top->child(0);
if (child != 0)
wide = qMax(wide, itemWidget(child, 0)->minimumSizeHint().width()+5);
}
}
}
}
if (wide != 0)
setColumnWidth(0, wide);
else
resizeColumnToContents(0);
emit currentChanged2(indexOfTopLevelItem(item));
}
}
示例11: setCurrentItem
void ButtonWithMenu::addItem(const Item &item)
{
m_items.append(item);
if (m_items.count() == 1) {
setCurrentItem(item);
}
emit itemAdded(item);
}
示例12: setCurrentItem
void FeedListWidget::handleItemAboutToBeRemoved(RSS::Item *rssItem)
{
rssItem->disconnect(this);
delete m_rssToTreeItemMapping.take(rssItem);
// RSS Item is still valid in this slot so if it is the last
// item we should prevent Unread list populating
if (m_rssToTreeItemMapping.size() == 1)
setCurrentItem(nullptr);
}
示例13: currentItem
void TreeWidget::collapseCurrentConnection()
{
QTreeWidgetItem* item = currentItem();
if (item && item->parent())
item = item->parent();
if (item) {
collapseItem(item);
setCurrentItem(item);
}
}
示例14: setCurrentItem
void StatusPicker::setStatusId( int statusid )
{
QMap<int,int>::Iterator it;
for ( it = index2id.begin(); it != index2id.end(); ++it ) {
if ( it.data() == statusid ) {
setCurrentItem( it.key() );
break;
}
}
}
示例15: currentItemFromSelection
void PropertiesPalette_Shadow::handleSelectionChanged()
{
if (!m_haveDoc || !m_ScMW || m_ScMW->scriptIsRunning())
return;
PageItem* currItem = currentItemFromSelection();
if (currItem)
setCurrentItem(currItem);
updateGeometry();
}