本文整理汇总了C++中QListViewItem::isSelected方法的典型用法代码示例。如果您正苦于以下问题:C++ QListViewItem::isSelected方法的具体用法?C++ QListViewItem::isSelected怎么用?C++ QListViewItem::isSelected使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QListViewItem
的用法示例。
在下文中一共展示了QListViewItem::isSelected方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
}
}
示例2: slotMessageChanged
void ListViews::slotMessageChanged()
{
QListViewItem *i = messages->currentItem();
if ( !i )
return;
if ( !i->isSelected() ) {
message->setText( "" );
return;
}
MessageListItem *item = ( MessageListItem* )i;
Message *msg = item->message();
QString text;
QString tmp = msg->header().sender();
tmp = tmp.replace( QRegExp( "[<]" ), "<" );
tmp = tmp.replace( QRegExp( "[>]" ), ">" );
text = QString( "<b><i>From:</i></b> <a href=\"mailto:[email protected]\">%1</a><br>"
"<b><i>Subject:</i></b> <big><big><b>%2</b></big></big><br>"
"<b><i>Date:</i></b> %3<br><br>"
"%4" ).
arg( tmp ).arg( msg->header().subject() ).
arg( msg->header().datetime().toString() ).arg( msg->body() );
message->setText( text );
msg->setState( Message::Read );
}
示例3: it
QList<QListViewItem> UIListView::selectedItems()
{
QList<QListViewItem> list;
// set current item as first item
firstChild();
//
// run through items
//
QListViewItemIterator it( this );
QListViewItem * item = 0;
for ( ; it.current(); ++it )
{
item = it.current();
if ( item->isSelected() == false )
continue;
list.append( item );
}
return list;
}
示例4: 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();
}
示例5: listViewHasSelection
static bool listViewHasSelection( QListView *lv )
{
for ( QListViewItem *i = lv->firstChild(); i; i = i->itemBelow() )
if ( i->isSelected() )
return true;
return false;
}
示例6: deleteNodes
void DOMTreeView::deleteNodes()
{
// kdDebug(90180) << k_funcinfo << endl;
DOM::Node last;
MultiCommand *cmd = new MultiCommand(i18n("Delete Nodes"));
QListViewItemIterator it(m_listView, QListViewItemIterator::Selected);
for (; *it; ++it) {
DOMListViewItem *item = static_cast<DOMListViewItem *>(*it);
// kdDebug(90180) << " item->node " << item->node().nodeName().string() << " clos " << item->isClosing() << endl;
if (item->isClosing()) continue;
// don't regard node more than once
if (item->node() == last) continue;
// check for selected parent
bool has_selected_parent = false;
for (QListViewItem *p = item->parent(); p; p = p->parent()) {
if (p->isSelected()) { has_selected_parent = true; break; }
}
if (has_selected_parent) continue;
// kdDebug(90180) << " item->node " << item->node().nodeName().string() << ": schedule for removal" << endl;
// remove this node if it isn't already recursively removed by its parent
cmd->addCommand(new RemoveNodeCommand(item->node(), item->node().parentNode(), item->node().nextSibling()));
last = item->node();
}
mainWindow()->executeAndAddCommand(cmd);
}
示例7: selectedItems
static void selectedItems( QPtrList<Kleo::KeyListViewItem> & result, QListViewItem * start ) {
for ( QListViewItem * item = start ; item ; item = item->nextSibling() ) {
if ( item->isSelected() )
if ( Kleo::KeyListViewItem * i = Kleo::lvi_cast<Kleo::KeyListViewItem>( item ) )
result.append( i );
selectedItems( result, item->firstChild() );
}
}
示例8: invertSelection
void UIListView::invertSelection()
{
firstChild();
QListViewItemIterator it( this );
QListViewItem * item;
for ( ; ( item = it.current() ); ++it )
setSelected( item, ! item->isSelected() );
}
示例9: sort
void popupPublic::sort()
{
bool reselect=false;
QListViewItem *current = keysList->firstChild();
if (current==NULL)
return;
if ((untrustedList.find(current->text(2))!=untrustedList.end()) && (!current->text(2).isEmpty())){
if (current->isSelected()) {
current->setSelected(false);
reselect=true;
}
current->setVisible(false);
}
while ( current->nextSibling() ) {
current = current->nextSibling();
if ((untrustedList.find(current->text(2))!=untrustedList.end()) && (!current->text(2).isEmpty())) {
if (current->isSelected()) {
current->setSelected(false);
reselect=true;
}
current->setVisible(false);
}
}
if (reselect || !keysList->currentItem()->isVisible()) {
QListViewItem *firstvisible;
firstvisible=keysList->firstChild();
while (firstvisible->isVisible()!=true) {
firstvisible=firstvisible->nextSibling();
if (firstvisible==NULL)
return;
}
keysList->setSelected(firstvisible,true);
keysList->setCurrentItem(firstvisible);
keysList->ensureItemVisible(firstvisible);
}
}
示例10: selectedFieldNames
QStringList KexiFieldListView::selectedFieldNames() const
{
if (!schema())
return QStringList();
QStringList selectedFields;
for (QListViewItem *item = firstChild(); item; item = item->nextSibling()) {
if (item->isSelected()) {
//! @todo what about query fields/aliases? it.current()->text(0) can be not enough
if (item == m_allColumnsItem && m_allColumnsItem)
selectedFields.append("*");
else
selectedFields.append(item->text(0));
}
}
return selectedFields;
}
示例11: selectedChildrenCount
int ServerListItem::selectedChildrenCount()
{
int count = 0;
QListViewItem* item = firstChild();
while (item)
{
if (item->isSelected())
++count;
item = item->nextSibling();
}
return count;
}
示例12: event_selected
void oprof_start::event_selected()
{
// The deal is simple: QT lack of a way to know what item was the last
// (de)selected item so we record a set of selected items and diff
// it in the appropriate way with the previous list of selected items.
set<QListViewItem *> current_selection;
QListViewItem * cur;
for (cur = events_list->firstChild(); cur; cur = cur->nextSibling()) {
if (cur->isSelected())
current_selection.insert(cur);
}
// First remove the deselected item.
vector<QListViewItem *> new_deselected;
set_difference(selected_events.begin(), selected_events.end(),
current_selection.begin(), current_selection.end(),
back_inserter(new_deselected));
vector<QListViewItem *>::const_iterator it;
for (it = new_deselected.begin(); it != new_deselected.end(); ++it)
selected_events.erase(*it);
// Now try to add the newly selected item if enough HW resource exists
vector<QListViewItem *> new_selected;
set_difference(current_selection.begin(), current_selection.end(),
selected_events.begin(), selected_events.end(),
back_inserter(new_selected));
for (it = new_selected.begin(); it != new_selected.end(); ++it) {
selected_events.insert(*it);
if (!alloc_selected_events()) {
(*it)->setSelected(false);
selected_events.erase(*it);
} else {
current_event = *it;
}
}
draw_event_list();
if (current_event)
display_event(locate_event(current_event->text(0).latin1()));
}
示例13: listSelectionChanged
void RKVarSlot::listSelectionChanged () {
RK_TRACE (PLUGIN);
bool selection = false;
ObjectList sellist;
QListViewItem *item = list->firstChild ();
while (item) {
if (item->isSelected ()) {
selection = true;
RObject *robj = item_map[item];
RK_ASSERT (robj);
sellist.append (robj);
}
item = item->nextSibling ();
}
selected->setObjectList (sellist);
setSelectButton (((!multi) || (!selection)) && (!available->atMaxLength ()));
}
示例14: contentsMousePressEvent
void KACLListView::contentsMousePressEvent(QMouseEvent *e)
{
QListViewItem *clickedItem = itemAt(contentsToViewport(e->pos()));
if(!clickedItem)
return;
// if the click is on an as yet unselected item, select it first
if(!clickedItem->isSelected())
KListView::contentsMousePressEvent(e);
if(!currentItem())
return;
int column = header()->sectionAt(e->x());
acl_perm_t perm;
switch(column)
{
case 2:
perm = ACL_READ;
break;
case 3:
perm = ACL_WRITE;
break;
case 4:
perm = ACL_EXECUTE;
break;
default:
return KListView::contentsMousePressEvent(e);
}
KACLListViewItem *referenceItem = static_cast< KACLListViewItem * >(clickedItem);
unsigned short referenceHadItSet = referenceItem->value & perm;
QListViewItemIterator it(this);
while(KACLListViewItem *item = static_cast< KACLListViewItem * >(it.current()))
{
++it;
if(!item->isSelected())
continue;
// toggle those with the same value as the clicked item, leave the others
if(referenceHadItSet == (item->value & perm))
item->togglePerm(perm);
}
}
示例15: slot_Join
void UIChannelDialog::slot_Join()
{
m_view->firstChild();
QListViewItemIterator it( m_view );
QListViewItem * item;
for ( ; ( item = it.current() ); ++it )
{
if ( item->text( Col_Size ).isEmpty() == true )
continue ;
if ( item->isSelected() == false )
continue ;
IOMessage * io = new IOMessage( 0 );
io->setMessageType( IONapsterCodes::ChanJoinRequest );
io->insert( "rawdata", item->text( Col_Chan ) );
emit sendIO( io );
delete io;
}
accept();
}