本文整理汇总了C++中QListViewItem::parent方法的典型用法代码示例。如果您正苦于以下问题:C++ QListViewItem::parent方法的具体用法?C++ QListViewItem::parent怎么用?C++ QListViewItem::parent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QListViewItem
的用法示例。
在下文中一共展示了QListViewItem::parent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: prettyName
QString FavoriteFolderView::prettyName(KMFolderTreeItem *fti)
{
assert(fti);
assert(fti->folder());
QString name = fti->folder()->label();
QListViewItem *accountFti = fti;
while(accountFti->parent())
accountFti = accountFti->parent();
if(fti->type() == KFolderTreeItem::Inbox)
{
if(fti->protocol() == KFolderTreeItem::Local || fti->protocol() == KFolderTreeItem::NONE)
{
name = i18n("Local Inbox");
}
else
{
name = i18n("Inbox of %1").arg(accountFti->text(0));
}
}
else
{
if(fti->protocol() != KFolderTreeItem::Local && fti->protocol() != KFolderTreeItem::NONE)
{
name = i18n("%1 on %2").arg(fti->text(0)).arg(accountFti->text(0));
}
else
{
name = i18n("%1 (local)").arg(fti->text(0));
}
}
return name;
}
示例2: new_channel
void servercontroller::new_channel()
{
QString server;
QListViewItem *citem = ConnectionTree->currentItem(); // get item
if(citem){ // if it exist, ie something is highlighted, continue
if(proc_list[citem->text(0)]){ // If it's a match with a server, ok
server = citem->text(0);
}
// Otherwise, check the parent to see it's perhaps a server.
else if ( citem->parent() ) {
if(proc_list[citem->parent()->text(0)]){
server = citem->parent()->text(0);
}
}
}
if(server.isEmpty())
return;
KSircChannel ci(server, QString::null);
NewWindowDialog w(ci);
connect(&w, SIGNAL(openTopLevel(const KSircChannel &)),
this, SLOT(new_toplevel(const KSircChannel &)));
w.exec();
}
示例3: while
QListViewItem * ListViewDnd::itemAt( QPoint pos )
{
QListView * src = (QListView *) this->src;
int headerHeight = (int)(src->header()->height());
pos.ry() -= headerHeight;
QListViewItem * result = src->itemAt( pos );
if ( result && ( pos.ry() < (src->itemPos(result) + result->height()/2) ) )
result = result->itemAbove();
// Wind back if has parent, and we're in flat mode
while ( result && result->parent() && (dMode & Flat) )
result = result->parent();
// Wind back if has parent, and we're in flat mode
while ( result && !result->isVisible() && result->parent() )
result = result->parent();
if ( !result && src->firstChild() && (pos.y() > src->itemRect(src->firstChild()).bottom()) ) {
result = src->lastItem();
if ( !result->isVisible() )
// Handle special case where last item is actually hidden
result = result->itemAbove();
}
return result;
}
示例4: slotNewAction
void ActionConfigDialog::slotNewAction()
{
QDomDocument doc;
QDomElement el = doc.createElement("action");
el.setAttribute( "name", "user_"+KApplication::randomString(10) );
el.setAttribute( "icon", "ball" );
currentAction = new TagAction(&el, m_mainWindow);
//add the actions to every toolbar xmlguiclient
QDictIterator<ToolbarEntry> it(m_toolbarList);
while (it.current())
{
it.current()->guiClient->actionCollection()->insert(currentAction);
++it;
}
selectedShortcut = KShortcut();
static_cast<TagAction*>(currentAction)->setModified(true);
QListViewItem *currentItem = actionTreeView->currentItem();
QListViewItem *item = new KListViewItem(allActionsItem);
QString actionText = QString("Action_%1").arg(m_mainWindow->actionCollection()->count());
currentAction->setText(actionText);
item->setText(2, currentAction->name());
item->setText(0, actionText);
item->setPixmap(0, SmallIcon("ball"));
allActionsItem->sortChildItems(0, true);
if (currentItem->parent() && currentItem->parent() == allActionsItem)
{
actionTreeView->setCurrentItem(item);
} else
{
QListViewItem *parentItem = currentItem->parent();
if (!parentItem)
parentItem = currentItem;
item = new KListViewItem(parentItem, currentItem);
item->setText(0, actionText);
item->setText(2, currentAction->name());
item->setPixmap(0, SmallIcon("ball"));
actionTreeView->setCurrentItem(item);
if (parentItem != allActionsItem)
{
toolbarListBox->insertItem(parentItem->text(0));
toolbarListBox->setCurrentItem(0);
toolbarListBox->setSelected(0, true);
}
}
actionTreeView->ensureItemVisible(item);
buttonApply->setEnabled(true);
}
示例5: slotEditToolbar
void ActionConfigDialog::slotEditToolbar()
{
QString toolbarName;
QString toolbarId;
QListViewItem *oldItem;
QListViewItem *item = actionTreeView->currentItem();
if (item->parent())
item = item->parent();
toolbarName = item->text(0);
if ( toolbarName != i18n("All"))
{
emit configureToolbars(toolbarName +" <quanta>");
//update the tree view
KAction *action;
KActionCollection *ac = m_mainWindow->actionCollection();
ToolbarTabWidget *tb = ToolbarTabWidget::ref();
for (int i = 0; i < tb->count(); i++)
{
toolbarName = tb->label(i);
toolbarId = tb->id(i);
ToolbarEntry *p_toolbar = m_toolbarList[toolbarId];
if (p_toolbar)
{
oldItem = actionTreeView->findItem(toolbarName, 0);
item = new KListViewItem(actionTreeView, oldItem, toolbarName);
item->setOpen(oldItem->isOpen());
delete oldItem;
QDomNode node = p_toolbar->guiClient->domDocument().firstChild().firstChild().firstChild();
while (!node.isNull())
{
if (node.nodeName() == "Action")
{
action = ac->action(node.toElement().attribute("name"));
if (action)
{
oldItem = new KListViewItem(item, oldItem, action->text().replace(QRegExp("\\&(?!\\&)"),""), action->shortcut().toString(), action->name());
oldItem->setPixmap(0, SmallIcon(action->icon()));
}
}
node = node.nextSibling();
}
}
}
actionTreeView->setCurrentItem(allActionsItem);
actionTreeView->setSelected(allActionsItem, true);
}
}
示例6:
qsamplerInstrumentGroup *qsamplerInstrumentGroup::groupItem (void) const
{
QListViewItem *pParent = QListViewItem::parent();
while (pParent && pParent->rtti() != qsamplerInstrumentList::Group)
pParent = pParent->parent();
return static_cast<qsamplerInstrumentGroup *> (pParent);
}
示例7: buildFlatList
int ListViewDnd::buildFlatList( ListViewItemList & list )
{
bool addKids = FALSE;
QListViewItem *nextSibling = 0;
QListViewItem *nextParent = 0;
QListViewItemIterator it = ((QListView *)src)->firstChild();
for ( ; *it; it++ ) {
// Hit the nextSibling, turn of child processing
if ( (*it) == nextSibling )
addKids = FALSE;
if ( (*it)->isSelected() ) {
if ( (*it)->childCount() == 0 ) {
// Selected, no children
list.append( *it );
} else if ( !addKids ) {
// Children processing not set, so set it
// Also find the item were we shall quit
// processing children...if any such item
addKids = TRUE;
nextSibling = (*it)->nextSibling();
nextParent = (*it)->parent();
while ( nextParent && !nextSibling ) {
nextSibling = nextParent->nextSibling();
nextParent = nextParent->parent();
}
}
} else if ( ((*it)->childCount() == 0) && addKids ) {
// Leaf node, and we _do_ process children
list.append( *it );
}
}
return list.count();
}
示例8: deleteNodes
void DOMTreeView::deleteNodes()
{
// kdDebug(90180) << k_funcinfo << endl;
DOM::Node last;
MultiCommand *cmd = new MultiCommand(i18n("Delete Nodes"));
QListViewItemIterator it(m_listView, QListViewItemIterator::Selected);
for (; *it; ++it) {
DOMListViewItem *item = static_cast<DOMListViewItem *>(*it);
// kdDebug(90180) << " item->node " << item->node().nodeName().string() << " clos " << item->isClosing() << endl;
if (item->isClosing()) continue;
// don't regard node more than once
if (item->node() == last) continue;
// check for selected parent
bool has_selected_parent = false;
for (QListViewItem *p = item->parent(); p; p = p->parent()) {
if (p->isSelected()) { has_selected_parent = true; break; }
}
if (has_selected_parent) continue;
// kdDebug(90180) << " item->node " << item->node().nodeName().string() << ": schedule for removal" << endl;
// remove this node if it isn't already recursively removed by its parent
cmd->addCommand(new RemoveNodeCommand(item->node(), item->node().parentNode(), item->node().nextSibling()));
last = item->node();
}
mainWindow()->executeAndAddCommand(cmd);
}
示例9: while
void Kleo::KeyListView::scatterGathered( QListViewItem * start ) {
QListViewItem * item = start;
while ( item ) {
QListViewItem * cur = item;
item = item->nextSibling();
scatterGathered( cur->firstChild() );
assert( cur->childCount() == 0 );
// ### todo: optimize by suppressing removing/adding the item to the itemMap...
if ( cur->parent() )
cur->parent()->takeItem( cur );
else
takeItem( cur );
insertItem( cur );
}
}
示例10: stringPath
QString VariablesListViewItem::stringPath() {
QListViewItem* item = this;
QString str = item->text(VariablesListView::NameCol);
while((item = item->parent()) != NULL) {
str = item->text(VariablesListView::NameCol) + "/" + str;
}
return str;
}
示例11: slotRemoveToolbar
void ActionConfigDialog::slotRemoveToolbar()
{
QListViewItem *item = actionTreeView->currentItem();
QString s = item->text(0);
if (item->parent())
{
item = item->parent();
s = item->text(0);
}
if (s != i18n("All"))
{
if ( KMessageBox::warningContinueCancel(this, i18n("Do you really want to remove the \"%1\" toolbar?").arg(s),QString::null,KStdGuiItem::del()) == KMessageBox::Continue )
{
m_toolbarItem = item;
connect(m_mainWindow, SIGNAL(toolbarRemoved(const QString&)), SLOT(slotToolbarRemoved(const QString&)));
emit removeToolbar(s.lower());
}
}
}
示例12: slotAddToolbar
void ActionConfigDialog::slotAddToolbar()
{
emit addToolbar();
QString toolbarName;
QListViewItem *item;
ToolbarTabWidget *tb = ToolbarTabWidget::ref();
for (int i = 0; i < tb->count(); i++)
{
toolbarName = tb->label(i);
if (!actionTreeView->findItem(toolbarName, 0))
{
item = actionTreeView->lastItem();
if (item->parent())
item = item->parent();
new KListViewItem(actionTreeView, item, i18n(toolbarName.utf8()));
break;
}
}
}
示例13: server_debug
void servercontroller::server_debug()
{
QListViewItem *citem = ConnectionTree->currentItem(); // get item
if(citem){ // if it exist, ie something is highlighted, continue
QString server;
if(proc_list[citem->text(0)]){ // If it's a match with a server, ok
server = citem->text(0);
}
else if ( citem->parent() ) {
if(proc_list[citem->parent()->text(0)]){
server = citem->parent()->text(0);
}
}
if( !server.isNull() ){
bool sh = proc_list[server]->getIOController()->isDebugTraffic();
proc_list[server]->getIOController()->showDebugTraffic(!sh);
}
}
}
示例14: itemLeftClicked
void ListViewEditor::itemLeftClicked()
{
QListViewItem *i = itemsPreview->currentItem();
if ( !i )
return;
QListViewItemIterator it( i );
QListViewItem *parent = i->parent();
if ( !parent )
return;
parent = parent->parent();
--it;
while ( it.current() ) {
if ( it.current()->parent() == parent )
break;
--it;
}
if ( !it.current() )
return;
QListViewItem *other = it.current();
for ( int c = 0; c < itemsPreview->columns(); ++c ) {
QString s = i->text( c );
i->setText( c, other->text( c ) );
other->setText( c, s );
QPixmap pix;
if ( i->pixmap( c ) )
pix = *i->pixmap( c );
if ( other->pixmap( c ) )
i->setPixmap( c, *other->pixmap( c ) );
else
i->setPixmap( c, QPixmap() );
other->setPixmap( c, pix );
}
itemsPreview->setCurrentItem( other );
itemsPreview->setSelected( other, TRUE );
}
示例15: keyName
QString EditorView::keyName ( const QListViewItem * item ) const
{
QString key = item->text(0);
QListViewItem *parent = item->parent();
while (parent != 0)
{
key = parent->text(0) + RG_KEY_DELIM + key;
parent = parent->parent();
}
return key;
}