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


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

本文整理汇总了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();
}
开发者ID:BackupTheBerlios,项目名称:qtiplot-svn,代码行数:30,代码来源:folder.cpp

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

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


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