本文整理汇总了C++中QListViewItem::itemBelow方法的典型用法代码示例。如果您正苦于以下问题:C++ QListViewItem::itemBelow方法的具体用法?C++ QListViewItem::itemBelow怎么用?C++ QListViewItem::itemBelow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QListViewItem
的用法示例。
在下文中一共展示了QListViewItem::itemBelow方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: deletePressed
void UserAgentDlg::deletePressed()
{
QListViewItem *item;
QListViewItem *nextItem = 0;
item = dlg->lvDomainPolicyList->firstChild();
while(item != 0L)
{
if(dlg->lvDomainPolicyList->isSelected(item))
{
nextItem = item->itemBelow();
if(!nextItem)
nextItem = item->itemAbove();
delete item;
item = nextItem;
}
else
{
item = item->itemBelow();
}
}
if(nextItem)
dlg->lvDomainPolicyList->setSelected(nextItem, true);
updateButtons();
configChanged();
}
示例2: slotLowerClicked
void ChaserEditor::slotLowerClicked()
{
QListViewItem* currentItem = m_functionList->currentItem();
if (currentItem != NULL)
{
QString deviceString = currentItem->text(1);
QString functionString = currentItem->text(2);
QListViewItem* below = NULL;
if (currentItem->itemBelow() != NULL)
{
below = currentItem->itemBelow();
}
if (below != NULL)
{
m_functionList->takeItem(currentItem);
delete currentItem;
QListViewItem* newItem;
newItem = new QListViewItem(m_functionList, below, "", deviceString, functionString);
m_functionList->setSelected(newItem, true);
}
}
updateOrderNumbers();
}
示例3: keyPressEvent
void ZLQtSelectionDialogListView::keyPressEvent(QKeyEvent *event) {
QListViewItem *item = currentItem();
switch(event->key()) {
case Key_Enter:
case Key_Return:
if (item != 0)
emit returnPressed(item);
return;
case Key_Down:
item = item->itemBelow();
if (item == 0) {
item = firstChild();
}
break;
case Key_Up:
item = item->itemAbove();
if (item == 0) {
item = firstChild();
while (item->nextSibling() != 0) {
item = item->nextSibling();
}
while (item->itemBelow() != 0) {
item = item->itemBelow();
}
}
break;
default:
QListView::keyPressEvent(event);
}
if (item != 0) {
setCurrentItem(item);
ensureItemVisible(item);
}
}
示例4: moveDown
void LayoutConfig::moveDown()
{
QListViewItem *sel = widget->listLayoutsDst->selectedItem();
if(sel == 0 || sel->itemBelow() == 0)
return;
sel->moveItem(sel->itemBelow());
}
示例5: downButtonClicked
/* config-slot: "down" button clicked */
void TopLevel::downButtonClicked() {
QListViewItem* item = listbox->currentItem();
if (item && item->itemBelow())
item->moveItem(item->itemBelow());
enable_controls();
}
示例6: handleKeyPress
bool PropertyEditor::handleKeyPress(QKeyEvent* ev) {
const int k = ev->key();
const Qt::ButtonState s = ev->state();
//selection moving
QListViewItem *item = 0;
if ((s == NoButton && k == Key_Up) || k == Key_BackTab) {
//find prev visible
item = selectedItem() ? selectedItem()->itemAbove() : 0;
while (item && (!item->isSelectable() || !item->isVisible()))
item = item->itemAbove();
if (!item)
return true;
} else if (s == NoButton && (k == Key_Down || k == Key_Tab)) {
//find next visible
item = selectedItem() ? selectedItem()->itemBelow() : 0;
while (item && (!item->isSelectable() || !item->isVisible()))
item = item->itemBelow();
if (!item)
return true;
} else if (s == NoButton && k == Key_Home) {
if (m_currentEditor && m_currentEditor->hasFocus())
return false;
//find 1st visible
item = firstChild();
while (item && (!item->isSelectable() || !item->isVisible()))
item = item->itemBelow();
} else if (s == NoButton && k == Key_End) {
if (m_currentEditor && m_currentEditor->hasFocus())
return false;
//find last visible
item = selectedItem();
QListViewItem *lastVisible = item;
while (item) { // && (!item->isSelectable() || !item->isVisible()))
item = item->itemBelow();
if (item && item->isSelectable() && item->isVisible())
lastVisible = item;
}
item = lastVisible;
}
if (item) {
ev->accept();
ensureItemVisible(item);
setSelected(item, true);
return true;
}
return false;
}
示例7: removePhrase
void PhraseBookBox::removePhrase()
{
QListViewItem *item = lv->currentItem();
QListViewItem *next = item->itemBelow() != 0 ? item->itemBelow()
: item->itemAbove();
delete item;
if ( next != 0 )
selectItem( next );
enableDisable();
}
示例8: slotMoveDownAnswer
/** Button Down */
void KControlAddEdit::slotMoveDownAnswer()
{
QListViewItem *item = _listAnswers->currentItem();
if (item)
item->moveItem(item->itemBelow());
_buttonUp->setEnabled(item->itemAbove()!=0);
_buttonDown->setEnabled(item->itemBelow()!=0);
}
示例9: moveBookmark
void BookmarksSettingsPage::moveBookmark(int direction)
{
// this implementation currently only allows moving of bookmarks
// one step up or down
assert((direction >= -1) && (direction <= +1));
// swap bookmarks in listview
QListViewItem* selectedItem = m_listView->selectedItem();
assert(selectedItem != 0);
QListViewItem* item = (direction < 0) ? selectedItem->itemAbove() :
selectedItem->itemBelow();
assert(item != 0);
QPixmap pixmap;
if (item->pixmap(0) != 0) {
pixmap = *(item->pixmap(0));
}
QString name(item->text(NameIdx));
QString url(item->text(URLIdx));
QString icon(item->text(IconIdx));
if (selectedItem->pixmap(0) != 0) {
item->setPixmap(PixmapIdx, *(selectedItem->pixmap(0)));
}
item->setText(NameIdx, selectedItem->text(NameIdx));
item->setText(URLIdx, selectedItem->text(URLIdx));
item->setText(IconIdx, selectedItem->text(IconIdx));
selectedItem->setPixmap(PixmapIdx, pixmap);
selectedItem->setText(NameIdx, name);
selectedItem->setText(URLIdx, url);
selectedItem->setText(IconIdx, icon);
m_listView->setSelected(item, true);
}
示例10: listViewHasSelection
static bool listViewHasSelection( QListView *lv )
{
for ( QListViewItem *i = lv->firstChild(); i; i = i->itemBelow() )
if ( i->isSelected() )
return true;
return false;
}
示例11: updateUpDown
void DlgDirectories::updateUpDown()
{
QListViewItem *item = lv_entries->selectedItem();
pb_up->setEnabled( item && item->itemAbove() );
pb_down->setEnabled( item && item->itemBelow() );
}
示例12: startDrag
void FolderListView::startDrag()
{
QListViewItem *item = currentItem();
if (!item)
return;
if (item == firstChild() && item->listView()->rootIsDecorated())
return;//it's the project folder so we don't want the user to move it
QPoint orig = viewportToContents( viewport()->mapFromGlobal( QCursor::pos() ) );
QPixmap pix;
if (item->rtti() == FolderListItem::ListItemType)
pix = QPixmap( folder_closed_xpm );
else
pix = *item->pixmap (0);
QIconDrag *drag = new QIconDrag(viewport());
drag->setPixmap(pix, QPoint(pix.width()/2, pix.height()/2 ) );
QPtrList<QListViewItem> lst;
for (item = firstChild(); item; item = item->itemBelow())
{
if (item->isSelected())
lst.append(item);
}
emit dragItems(lst);
drag->drag();
}
示例13: contentsWheelEvent
void QTodoLists::contentsWheelEvent(QWheelEvent* event)
{
if(!firstChild())
return;
QListViewItem* item = selectedItem();
if(event->delta() < 0)
{
if(!item)
item = lastItem();
item = item->itemBelow();
if(!item)
item = firstChild();
}
else
{
if(!item)
item = firstChild();
item = item->itemAbove();
if(!item)
item = lastItem();
}
setSelected(item,true);
}
示例14: findItem
/*! Now to implement the closest match function */
void TVListView::findItem(int keyId, TVVariant value)
{
QListViewItem *i;
TVListViewItem *best_so_far = NULL;
/* start at the beginning... go through till find the closest elem */
i = listViewDisplay->firstChild();
while (i) {
/* search stuff */
if(best_so_far) {
if (DataElem::closer(
((TVListViewItem *)i)->getDataElem(),
best_so_far->getDataElem(), value, keyId))
best_so_far = (TVListViewItem *)i;
} else {
if (DataElem::closer(
((TVListViewItem *)i)->getDataElem(),
NULL, value, keyId))
best_so_far = (TVListViewItem *)i;
}
i = i->itemBelow();
}
if (best_so_far) {
/* set best_so_far to current element */
delete it;
it = new QListViewItemIterator(best_so_far);
}
}
示例15: setDir
void DirectoryView::setDir( const QString &s )
{
QListViewItemIterator it( this );
++it;
for ( ; it.current(); ++it ) {
it.current()->setOpen( false );
}
QStringList lst( QStringList::split( "/", s ) );
QListViewItem *item = firstChild();
QStringList::Iterator it2 = lst.begin();
for ( ; it2 != lst.end(); ++it2 ) {
while ( item ) {
if ( item->text( 0 ) == *it2 ) {
item->setOpen( true );
break;
}
item = item->itemBelow();
}
}
if ( item ){
setSelected( item, true );
setCurrentItem( item );
}
}