当前位置: 首页>>代码示例>>C++>>正文


C++ QListViewItem::itemAbove方法代码示例

本文整理汇总了C++中QListViewItem::itemAbove方法的典型用法代码示例。如果您正苦于以下问题:C++ QListViewItem::itemAbove方法的具体用法?C++ QListViewItem::itemAbove怎么用?C++ QListViewItem::itemAbove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QListViewItem的用法示例。


在下文中一共展示了QListViewItem::itemAbove方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: slotRaiseClicked

void ChaserEditor::slotRaiseClicked()
{
  QListViewItem* currentItem = m_functionList->currentItem();

  if (currentItem != NULL)
    {
      QString deviceString = currentItem->text(1);
      QString functionString = currentItem->text(2);

      QListViewItem* above = NULL;
      if (currentItem->itemAbove() != NULL && currentItem->itemAbove()->itemAbove() != NULL)
	{
	  above = currentItem->itemAbove()->itemAbove();
	}

      m_functionList->takeItem(currentItem);
      delete currentItem;

      QListViewItem* newItem;
      if (above != NULL)
	{
	  newItem = new QListViewItem(m_functionList, above, "", deviceString, functionString);
	}
      else
	{
	  newItem = new QListViewItem(m_functionList, "", deviceString, functionString);
	}

      m_functionList->setSelected(newItem, true);
    }

  updateOrderNumbers();
}
开发者ID:speakman,项目名称:qlc,代码行数:33,代码来源:chasereditor.cpp

示例2: 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;
}
开发者ID:AliYousuf,项目名称:univ-aca-mips,代码行数:27,代码来源:listviewdnd.cpp

示例3: upButtonClicked

/* config-slot: "up" button clicked */
void TopLevel::upButtonClicked() {
	QListViewItem* item = listbox->currentItem();

	if (item && item->itemAbove())
		item->itemAbove()->moveItem(item);

	enable_controls();
}
开发者ID:,项目名称:,代码行数:9,代码来源:

示例4: slotMoveUpAnswer

/** Button Up */
void KControlAddEdit::slotMoveUpAnswer()
{
    QListViewItem *item = _listAnswers->currentItem();

    if (item && item->itemAbove())
        item->itemAbove()->moveItem(item);

    _buttonUp->setEnabled(item->itemAbove()!=0);
    _buttonDown->setEnabled(item->itemBelow()!=0);
}
开发者ID:,项目名称:,代码行数:11,代码来源:

示例5: upEntry

void DlgDirectories::upEntry()
{
    QListViewItem *item = lv_entries->selectedItem();

    if ( !item || !item->itemAbove() )
        return;

    item->moveItem( item->itemAbove()->itemAbove() );

    updateUpDown();
    emit configChanged();
}
开发者ID:serghei,项目名称:kde3-kdenetwork,代码行数:12,代码来源:dlgDirectories.cpp

示例6: moveUp

void LayoutConfig::moveUp()
{
    QListViewItem *sel = widget->listLayoutsDst->selectedItem();
    if(sel == 0 || sel->itemAbove() == 0)
        return;

    if(sel->itemAbove()->itemAbove() == 0)
    {
        widget->listLayoutsDst->takeItem(sel);
        widget->listLayoutsDst->insertItem(sel);
        widget->listLayoutsDst->setSelected(sel, true);
    }
    else
        sel->moveItem(sel->itemAbove()->itemAbove());
}
开发者ID:serghei,项目名称:kde3-kdebase,代码行数:15,代码来源:kcmlayout.cpp

示例7: 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);
	}
}
开发者ID:ALEXGUOQ,项目名称:FBReader,代码行数:35,代码来源:ZLQtSelectionDialog.cpp

示例8: 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);
}
开发者ID:serghei,项目名称:kde3-apps-dolphin,代码行数:35,代码来源:bookmarkssettingspage.cpp

示例9: mouseButtonClickedData

void RDListView::mouseButtonClickedData(int button,QListViewItem *item,
					const QPoint &pt,int col)
{
  QListViewItem *l;
  bool contiguous;

  if((selectionMode()!=QListView::Extended)||(item==NULL)||(button!=1)) {
    return;
  }

  //
  // Get Selected Range
  //
  l=item;
  contiguous=true;
  while((l=l->itemAbove())!=NULL) {
    if(!l->isSelected()) {
      contiguous=false;
    }
    if(!contiguous) {
      setSelected(l,false);
    }
  }
  l=item;
  contiguous=true;
  while((l=l->itemBelow())!=NULL) {
    if(!l->isSelected()) {
      contiguous=false;
    }
    if(!contiguous) {
      setSelected(l,false);
    }
  }
}
开发者ID:WMTH,项目名称:rivendell,代码行数:34,代码来源:rdlistview.cpp

示例10: updateUpDown

void DlgDirectories::updateUpDown()
{
    QListViewItem *item = lv_entries->selectedItem();

    pb_up->setEnabled( item && item->itemAbove() );
    pb_down->setEnabled( item && item->itemBelow() );
}
开发者ID:serghei,项目名称:kde3-kdenetwork,代码行数:7,代码来源:dlgDirectories.cpp

示例11: refreshButton

void KCustomMenuEditor::refreshButton()
{
    QListViewItem *item = m_listView->currentItem();
    d->pbRemove->setEnabled( item );
    d->pbMoveUp->setEnabled( item && item->itemAbove() );
    d->pbMoveDown->setEnabled( item && item->itemBelow() );
}
开发者ID:,项目名称:,代码行数:7,代码来源:

示例12: 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);
}
开发者ID:BackupTheBerlios,项目名称:qtodo-svn,代码行数:26,代码来源:qtodo_lists.cpp

示例13: 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();
}
开发者ID:serghei,项目名称:kde3-kdebase,代码行数:30,代码来源:useragentdlg.cpp

示例14: 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;
}
开发者ID:zoltanp,项目名称:ktechlab-0.3,代码行数:56,代码来源:propertyeditor.cpp

示例15: 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();
}
开发者ID:aroraujjwal,项目名称:qt3,代码行数:10,代码来源:phrasebookbox.cpp


注:本文中的QListViewItem::itemAbove方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。