void ConnectWizard::slotMoveUp() { // when nothing is selected, select the first QListBoxItem* i = m_viewList->selectedItem(); if( !i ) { m_viewList->setSelected( 0, true ); return; } // when previous exists, select it, otherwise do nothing if( i->prev() ) { m_viewList->setSelected( i->prev(), true ); } else { m_viewList->setSelected( i, true ); } }
void MessageFilterDialog::addedFilter(uint32_t mask, uint8_t filterid, const MessageFilter& filter) { if (m_existingFilters->count() == 0) { // add the new message filter new MessageFilterListBoxText(m_existingFilters, 0, filter.name(), filterid); } // iterate over all the existing filters for (QListBoxItem* currentLBT = m_existingFilters->firstItem(); currentLBT; currentLBT = currentLBT->next()) { // check if this is the removed filter if (((MessageFilterListBoxText*)currentLBT)->data() > filterid) { // add a new message filter at the appropriate location // NOTE: This maintains list order during an item update new MessageFilterListBoxText(m_existingFilters, currentLBT->prev(), filter.name(), filterid); break; } } }
void ListBoxDnd::insertList( ListBoxItemList & list ) { QListBoxItem * i = list.first(); while ( i ) { ((QListBox *)src)->insertItem( i, i->prev() ); i = list.next(); } }
QListBoxItem * ListBoxDnd::itemAt( QPoint pos ) { QListBox * src = (QListBox *) this->src; QListBoxItem * result = src->itemAt( pos ); QListBoxItem * last = src->item( src->count() - 1 ); int i = src->index( result ); if ( result && ( pos.y() < (src->itemRect(result).top() + src->itemHeight(i)/2) ) ) result = result->prev(); else if ( !result && pos.y() > src->itemRect( last ).bottom() ) result = last; return result; }
void ClsQSAList::slotMoveUp() { // cout << "ClsQSAList::slotMoveUp()" << endl; int iCurrent = qlbox->currentItem(); if(iCurrent>=0) { QListBoxItem * lbCurrent = qlbox->item(iCurrent); QListBoxItem * lbPrev = lbCurrent->prev(); if(lbPrev!=NULL) { int iPrev = qlbox->index(lbPrev); qlbox->takeItem(lbCurrent); qlbox->insertItem(lbCurrent, iPrev); qlbox->setCurrentItem ( iPrev ); } } }
void ListViewEditor::columnUpClicked() { if ( colPreview->currentItem() <= 0 ) return; colPreview->clearSelection(); QListBoxItem *i = colPreview->item( colPreview->currentItem() ); QListBoxItem *above = i->prev(); colPreview->takeItem( above ); colPreview->insertItem( above, i ); colPreview->setCurrentItem( i ); colPreview->setSelected( i, TRUE ); }
void ListBoxEditor::moveItemUp() { if ( preview->currentItem() < 1 ) return; QListBoxItem *i = preview->item( preview->currentItem() ); bool hasPix = (bool)i->pixmap(); QPixmap pix; if ( hasPix ) pix = *i->pixmap(); QString txt = i->text(); QListBoxItem *p = i->prev(); if ( p->pixmap() ) preview->changeItem( *p->pixmap(), p->text(), preview->currentItem() ); else preview->changeItem( p->text(), preview->currentItem() ); if ( hasPix ) preview->changeItem( pix, txt, preview->currentItem() - 1 ); else preview->changeItem( txt, preview->currentItem() - 1 ); }