本文整理汇总了C++中QListViewItem::depth方法的典型用法代码示例。如果您正苦于以下问题:C++ QListViewItem::depth方法的具体用法?C++ QListViewItem::depth怎么用?C++ QListViewItem::depth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QListViewItem
的用法示例。
在下文中一共展示了QListViewItem::depth方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: slotDeleteAction
void ActionConfigDialog::slotDeleteAction()
{
if ( KMessageBox::warningContinueCancel(this, i18n("<qt>Removing the action removes all the references to it.\nAre you sure you want to remove the <b>%1</b> action?</qt>").arg(currentAction->text()),QString::null,KStdGuiItem::del()) == KMessageBox::Continue )
{
QString actionName = currentAction->name();
emit deleteUserAction(currentAction);
currentAction = 0L;
//update the tree view
QListViewItem *listItem;
QListViewItemIterator it(actionTreeView);
while (it.current())
{
listItem = it.current();
if (listItem->depth() > 0 && listItem->text(2) == actionName)
{
++it;
delete listItem;
} else
{
++it;
}
}
slotSelectionChanged(actionTreeView->currentItem());
}
}
示例2: dropEvent
bool ListViewDnd::dropEvent( QDropEvent * event )
{
if ( dragInside ) {
if ( dMode & NullDrop ) { // combined with Move, a NullDrop will delete an item
event->accept();
emit dropped( 0 ); // a NullDrop
return TRUE;
}
QPoint pos = event->pos();
ListViewItemDrag::DropRelation dr = ListViewItemDrag::Sibling;
QListViewItem *item = itemAt( pos );
int dpos = dropDepth( item, pos );
if ( item ) {
if ( dpos > item->depth() && !(dMode & Flat) ) {
// Child node
dr = ListViewItemDrag::Child;
} else if ( dpos < item->depth() ) {
// Parent(s) Sibling
while ( item && (item->depth() > dpos) )
item = item->parent();
}
}
if ( ListViewItemDrag::decode( event, (QListView *) src, item, dr ) ) {
event->accept();
emit dropped( 0 ); // Use ID instead of item?
}
}
line->hide();
dragInside = FALSE;
return TRUE;
}
示例3: contentsMousePressEvent
void DirectoryView::contentsMousePressEvent( QMouseEvent* e )
{
QListView::contentsMousePressEvent(e);
QPoint p( contentsToViewport( e->pos() ) );
QListViewItem *i = itemAt( p );
if ( i ) {
// if the user clicked into the root decoration of the item, don't try to start a drag!
if ( p.x() > header()->cellPos( header()->mapToActual( 0 ) ) +
treeStepSize() * ( i->depth() + ( rootIsDecorated() ? 1 : 0) ) + itemMargin() ||
p.x() < header()->cellPos( header()->mapToActual( 0 ) ) ) {
presspos = e->pos();
mousePressed = TRUE;
}
}
}
示例4: slotLevelCapabilityButtonClicked
void VCSliderProperties::slotLevelCapabilityButtonClicked()
{
QListViewItem* item = NULL;
QStringList list;
item = m_levelList->currentItem();
if (item == NULL || item->depth() != 2)
return;
list = QStringList::split("-", item->text(KColumnRange));
Q_ASSERT(list.size() == 2);
m_levelLowLimitSpin->setValue(list[0].toInt());
m_levelHighLimitSpin->setValue(list[1].toInt());
}
示例5: contentsMousePressEvent
void KOTodoListView::contentsMousePressEvent(QMouseEvent* e)
{
QListView::contentsMousePressEvent(e);
QPoint p(contentsToViewport(e->pos()));
QListViewItem *i = itemAt(p);
if (i) {
// if the user clicked into the root decoration of the item, don't
// try to start a drag!
if (p.x() > header()->sectionPos(header()->mapToIndex(0)) +
treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) +
itemMargin() ||
p.x() < header()->sectionPos(header()->mapToIndex(0))) {
if (e->button()==Qt::LeftButton) {
mPressPos = e->pos();
mMousePressed = true;
}
}
}
}
示例6: r
ActionConfigDialog::ActionConfigDialog(const QDict<ToolbarEntry> &toolbarList, KMainWindow* parent, const char* name, bool modal, WFlags fl, const QString& defaultAction )
:ActionConfigDialogS( parent, name, modal, fl )
{
m_mainWindow = parent;
m_toolbarList = toolbarList;
buttonOk->setIconSet(SmallIconSet("button_ok"));
buttonCancel->setIconSet(SmallIconSet("button_cancel"));
buttonApply->setIconSet(SmallIconSet("apply"));
//buttonHelp->setIconSet(SmallIconSet("help"));
currentAction = 0L;
m_toolbarItem = 0L;
connect(actionTreeView, SIGNAL(contextMenu(KListView *,QListViewItem *,const QPoint &)),
SLOT(slotContextMenu(KListView *,QListViewItem *,const QPoint &)));
connect(actionTreeView, SIGNAL(selectionChanged(QListViewItem *)),
SLOT(slotSelectionChanged(QListViewItem *)));
connect(shortcutKeyButton, SIGNAL(capturedShortcut(const KShortcut &)),
SLOT(slotShortcutCaptured(const KShortcut &)));
connect(scriptPath, SIGNAL(activated(const QString&)),
SLOT(slotTextChanged(const QString&)));
connect(this, SIGNAL(addToolbar()), m_mainWindow, SLOT(slotAddToolbar()));
connect(this, SIGNAL(removeToolbar(const QString&)), m_mainWindow, SLOT(slotRemoveToolbar(const QString&)));
connect(this, SIGNAL(deleteUserAction(KAction*)), m_mainWindow, SLOT(slotDeleteAction(KAction*)));
connect(this, SIGNAL(configureToolbars(const QString&)), m_mainWindow, SLOT(slotConfigureToolbars(const QString&)));
//fill up the tree view with the toolbars and actions
actionTreeView->setSorting(-1);
allActionsItem = new KListViewItem(actionTreeView, i18n("All"));
actionTreeView->insertItem(allActionsItem);
QListViewItem *item, *oldItem = allActionsItem;
KAction *action;
QString toolbarName;
QString toolbarId;
ToolbarTabWidget *tb = ToolbarTabWidget::ref();
QRegExp r("\\&(?!\\&)");
KActionCollection *ac = m_mainWindow->actionCollection();
for (int i = 0; i < tb->count(); i++)
{
toolbarName = tb->label(i);
toolbarName.replace(r, "");
item = new KListViewItem(actionTreeView, oldItem, i18n(toolbarName.utf8()));
actionTreeView->insertItem(item);
toolbarId = tb->id(i);
QListViewItem *oldActionItem = 0L;
ToolbarEntry *p_toolbar = m_toolbarList[toolbarId];
if (p_toolbar)
{
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)
{
oldActionItem = new KListViewItem(item, oldActionItem, action->text().replace(r,""), action->shortcut().toString(), action->name());
oldActionItem->setPixmap(0, SmallIcon(action->icon()) );
}
}
node = node.nextSibling();
}
if (tb->label(tb->currentPageIndex()).replace(r, "") == toolbarName)
{
item->setOpen(true);
if (item->firstChild())
{
if (defaultAction.isEmpty())
{
actionTreeView->setCurrentItem(item->firstChild());
} else
{
QListViewItem *actionItem = item->firstChild();
while (actionItem && actionItem->depth() > 0)
{
if (actionItem->text(0) == defaultAction || actionItem->text(0) == defaultAction + "...")
{
actionTreeView->setCurrentItem(actionItem);
break;
}
actionItem = actionItem->nextSibling();
}
}
}
}
}
oldItem = item;
}
uint acCount = ac->count();
for (uint i = 0; i < acCount; i++)
{
action = ac->action(i);
item = new KListViewItem(allActionsItem, action->text().replace(r, ""), action->shortcut().toString(), action->name());
item->setPixmap(0, SmallIcon(action->icon()) );
}
allActionsItem->sortChildItems(0, true);
treeMenu = new KPopupMenu(actionTreeView);
treeMenu->insertItem(i18n("&Add New Toolbar"), this, SLOT(slotAddToolbar()));
treeMenu->insertItem(i18n("&Remove Toolbar"), this, SLOT(slotRemoveToolbar()));
//.........这里部分代码省略.........
示例7: saveCurrentAction
void ActionConfigDialog::saveCurrentAction()
{
static_cast<TagAction *>(currentAction)->setModified(true);
QString s;
QDomElement el = static_cast<TagAction *>(currentAction)->data();
s = actionIcon->icon();
el.setAttribute("icon", s);
currentAction->setIcon(s);
QString oldText = el.attribute("text");
s = lineText->text();
s.replace('&', "&&");
el.setAttribute("text", s);
currentAction->setText(s);
s = lineToolTip->text();
el.setAttribute("tooltip", s);
currentAction->setToolTip(s);
s = "";
if (customShortcut->isChecked())
{
s = selectedShortcut.toString();
currentAction->setShortcut(selectedShortcut);
} else
{
currentAction->setShortcut(KShortcut());
}
el.setAttribute("shortcut", s);
//update the tree view
QListViewItem *listItem;
QListViewItemIterator it(actionTreeView);
while (it.current())
{
listItem = it.current();
if (listItem->depth() > 0 && listItem->text(2) == currentAction->name())
{
listItem->setPixmap(0, SmallIcon(actionIcon->icon()));
listItem->setText(0, lineText->text());
listItem->setText(1, currentAction->shortcut().toString());
}
++it;
}
//remove all the detailed settings
QDomElement item = el.namedItem("tag").toElement();
if ( !item.isNull() )
el.removeChild(item);
item = el.namedItem("tag").toElement();
if ( !item.isNull() )
el.removeChild(item);
item = el.namedItem("xtag").toElement();
if ( !item.isNull() )
el.removeChild(item);
item = el.namedItem("script").toElement();
if ( !item.isNull() )
el.removeChild(item);
item = el.namedItem("text").toElement();
if ( !item.isNull() )
el.removeChild(item);
//add the new detailed settings
QDomDocument document = QDomDocument();
int type = typeCombo->currentItem();
switch (type)
{
case 1:{
el.setAttribute("type","script");
item = document.createElement("script");
switch (inputBox->currentItem())
{
case 1:{ item.setAttribute("input", "current");
break;
}
case 2:{ item.setAttribute("input", "selected");
break;
}
default:{ item.setAttribute("input", "none");
break;
}
}
switch (outputBox->currentItem())
{
case 1:{ item.setAttribute("output", "cursor");
break;
}
case 2:{ item.setAttribute("output", "selection");
break;
}
case 3:{ item.setAttribute("output", "replace");
break;
}
case 4:{ item.setAttribute("output", "new");
break;
}
case 5:{ item.setAttribute("output", "message");
break;
}
default:{ item.setAttribute("output", "none");
break;
}
}
//.........这里部分代码省略.........