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


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

本文整理汇总了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);
    }
  }
}
开发者ID:WMTH,项目名称:rivendell,代码行数:34,代码来源:rdlistview.cpp

示例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( "[<]" ), "&lt;" );
    tmp = tmp.replace( QRegExp( "[>]" ), "&gt;" );
    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 );
}
开发者ID:kthxbyte,项目名称:QT2-Linaro,代码行数:29,代码来源:listviews.cpp

示例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;
}
开发者ID:hiamitbhardwaj,项目名称:ianzepp,代码行数:26,代码来源:uilistview.cpp

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

示例5: listViewHasSelection

static bool listViewHasSelection( QListView *lv )
{
    for ( QListViewItem *i = lv->firstChild(); i; i = i->itemBelow() )
        if ( i->isSelected() )
            return true;
    return false;
}
开发者ID:serghei,项目名称:kde3-kdeutils,代码行数:7,代码来源:configpage.cpp

示例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);
}
开发者ID:iegor,项目名称:kdesktop,代码行数:29,代码来源:domtreeview.cpp

示例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() );
  }
}
开发者ID:,项目名称:,代码行数:8,代码来源:

示例8: invertSelection

void UIListView::invertSelection()
{
        firstChild();

        QListViewItemIterator it( this );
        QListViewItem * item;

        for ( ; ( item = it.current() ); ++it )
                setSelected( item, ! item->isSelected() );
}
开发者ID:hiamitbhardwaj,项目名称:ianzepp,代码行数:10,代码来源:uilistview.cpp

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

示例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;
}
开发者ID:,项目名称:,代码行数:16,代码来源:

示例11: selectedChildrenCount

    int ServerListItem::selectedChildrenCount()
    {
        int count = 0;

        QListViewItem* item = firstChild();

        while (item)
        {
            if (item->isSelected())
                ++count;

            item = item->nextSibling();
        }

        return count;
    }
开发者ID:,项目名称:,代码行数:16,代码来源:

示例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()));
}
开发者ID:OPSF,项目名称:uClinux,代码行数:42,代码来源:oprof_start.cpp

示例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 ()));
}
开发者ID:svn2github,项目名称:rkward-svn-mirror,代码行数:20,代码来源:rkvarslot.cpp

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

示例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();
}
开发者ID:hiamitbhardwaj,项目名称:ianzepp,代码行数:24,代码来源:uichanneldialog.cpp


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