本文整理汇总了C++中QListViewItem::listView方法的典型用法代码示例。如果您正苦于以下问题:C++ QListViewItem::listView方法的具体用法?C++ QListViewItem::listView怎么用?C++ QListViewItem::listView使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QListViewItem
的用法示例。
在下文中一共展示了QListViewItem::listView方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}
示例2: deleteItem
void *ListView::processEvent(Event *e)
{
if (e->type() == EventCommandExec){
CommandDef *cmd = (CommandDef*)(e->param());
if ((cmd->id == CmdListDelete) && (cmd->menu_id == MenuListView)){
QListViewItem *item = (QListViewItem*)(cmd->param);
if (item->listView() == this){
emit deleteItem(item);
return e->param();
}
}
}
return NULL;
}
示例3: fill
void *MainInfo::processEvent(Event *e)
{
if (e->type() == EventContactChanged){
Contact *contact = (Contact*)(e->param());
if (contact == m_contact)
fill();
}
if (e->type() == EventCheckState){
CommandDef *cmd = (CommandDef*)(e->param());
if (cmd->menu_id == MenuMailList){
if ((cmd->id != CmdEditList) && (cmd->id != CmdRemoveList))
return NULL;
QListViewItem *item = (QListViewItem*)(cmd->param);
if (item->listView() != lstMails)
return NULL;
cmd->flags &= ~(COMMAND_CHECKED | COMMAND_DISABLED);
bool bEnable = ((item != NULL) && (item->text(MAIL_PROTO).isEmpty() || (item->text(MAIL_PROTO) == "-")));
if (!bEnable)
cmd->flags |= COMMAND_DISABLED;
return e->param();
}
if (cmd->menu_id == MenuPhoneList){
if ((cmd->id != CmdEditList) && (cmd->id != CmdRemoveList))
return NULL;
QListViewItem *item = (QListViewItem*)(cmd->param);
if (item->listView() != lstPhones)
return NULL;
cmd->flags &= ~(COMMAND_CHECKED | COMMAND_DISABLED);
bool bEnable = ((item != NULL) && (item->text(PHONE_PROTO).isEmpty() || (item->text(PHONE_PROTO) == "-")));
if (!bEnable)
cmd->flags |= COMMAND_DISABLED;
return e->param();
}
}
if (e->type() == EventCommandExec){
CommandDef *cmd = (CommandDef*)(e->param());
if (cmd->menu_id == MenuMailList){
QListViewItem *item = (QListViewItem*)(cmd->param);
if (item->listView() != lstMails)
return NULL;
bool bEnable = ((item != NULL) && (item->text(MAIL_PROTO).isEmpty() || (item->text(MAIL_PROTO) == "-")));
if (!bEnable)
return NULL;
if (cmd->id == CmdEditList){
editMail(item);
return e->param();
}
if (cmd->id == CmdRemoveList){
deleteMail(item);
return e->param();
}
}
if (cmd->menu_id == MenuPhoneList){
QListViewItem *item = (QListViewItem*)(cmd->param);
if (item->listView() != lstPhones)
return NULL;
bool bEnable = ((item != NULL) && (item->text(PHONE_PROTO).isEmpty() || (item->text(PHONE_PROTO) == "-")));
if (!bEnable)
return NULL;
if (cmd->id == CmdEditList){
editPhone(item);
return e->param();
}
if (cmd->id == CmdRemoveList){
deletePhone(item);
return e->param();
}
}
}
return NULL;
}