本文整理汇总了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();
}
示例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;
}
示例3: upButtonClicked
/* config-slot: "up" button clicked */
void TopLevel::upButtonClicked() {
QListViewItem* item = listbox->currentItem();
if (item && item->itemAbove())
item->itemAbove()->moveItem(item);
enable_controls();
}
示例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);
}
示例5: upEntry
void DlgDirectories::upEntry()
{
QListViewItem *item = lv_entries->selectedItem();
if ( !item || !item->itemAbove() )
return;
item->moveItem( item->itemAbove()->itemAbove() );
updateUpDown();
emit configChanged();
}
示例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());
}
示例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);
}
}
示例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);
}
示例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);
}
}
}
示例10: updateUpDown
void DlgDirectories::updateUpDown()
{
QListViewItem *item = lv_entries->selectedItem();
pb_up->setEnabled( item && item->itemAbove() );
pb_down->setEnabled( item && item->itemBelow() );
}
示例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() );
}
示例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);
}
示例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();
}
示例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;
}
示例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();
}