本文整理汇总了C++中CItemBase::type方法的典型用法代码示例。如果您正苦于以下问题:C++ CItemBase::type方法的具体用法?C++ CItemBase::type怎么用?C++ CItemBase::type使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CItemBase
的用法示例。
在下文中一共展示了CItemBase::type方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
CRootItemIterator& CRootItemIterator::operator++() {
assert( m_pos_stack.size() == (m_base_stack.size() ));
++m_pos;
while( m_pos >= m_base->numChildren() && !m_pos_stack.empty()) {
// go back one in increment that, possibly descending in another leave
m_pos = m_pos_stack.top();
m_pos_stack.pop();
m_base = m_base_stack.top();
m_base_stack.pop();
++m_pos;
}
if( m_pos < m_base->numChildren() ) { // do not ask for m_base->childAt( "too big" ) => that's itertor::end()
CItemBase* item = m_base->childAt(m_pos);
while(item->type() == CItemType::E_CAT) {
m_base_stack.push(m_base);
m_base = reinterpret_cast<CCategoryItem*>(item);
m_pos_stack.push(m_pos);
m_pos = 0;
item = m_base->childAt(m_pos);
}
}
return *this;
}
示例2: performDrag
void CRenderClientsListView::performDrag()
{
qDebug() << QString("performDrag");
CRenderClientsListModel* lmodel = reinterpret_cast<CRenderClientsListModel*>(model());
QModelIndexList indexList = selectedIndexes();
CModelDiff md(m_role);
for(int i = 0; i < indexList.size(); i++)
{
comb_hash_t combhash;
CItemBase* item = lmodel->itemFromIndex(indexList.at(i));
switch(item->type()) {
case CItemType::E_STREAM_CLIENT:
{
CStreamClientItem* scItem = reinterpret_cast<CStreamClientItem*>(item);
combhash.type = scItem->type();
if(m_role == E_OWN_RENDER_CLIENT) {
int filteredline = lmodel->own2availIndex(indexList.at(i).row());
combhash.line = filteredline;
}
else {
combhash.line = indexList.at(i).row();
}
md.appendToSelectedItems(combhash);
}
default:
break;
}
}
if (md.getNumSelected() > 0)
{
QMimeData *mimeData = new QMimeData;
//mimeData->setText(item->asString());
mimeData->setData(dndMimeType, md.toQByteArray());
m_dragActive = true;
QDrag *drag = new QDrag(this);
drag->setMimeData(mimeData);
// drag->setPixmap(QPixmap(":/images/person.png"));
Qt::DropAction action = drag->exec(Qt::MoveAction);
m_dragActive = false;
qDebug() << QString("DropAction: %1").arg(action);
}
}
示例3: performDrag
void CPlaylistView::performDrag()
{
qDebug() << QString("performDrag");
CMuroaListModel* plModel = reinterpret_cast<CMuroaListModel*>(model());
QModelIndexList indexList = selectedIndexes();
CModelDiff md(m_role);
for(int i = 0; i < indexList.size(); i++)
{
comb_hash_t combhash;
CItemBase* item = plModel->itemFromIndex(indexList.at(i));
switch(item->type()) {
case CItemType::E_PLAYLISTITEM:
{
CPlaylistItem* plitem = reinterpret_cast<CPlaylistItem*>(item);
combhash.type = plitem->type();
combhash.hash = plitem->getMediaItemHash();
combhash.pl_id = plitem->getHash();
combhash.line = indexList.at(i).row();
md.appendToSelectedItems(combhash);
break;
}
default:
// error, there should only be playlist items in the playlist.
break;
}
}
if (md.getNumSelected() > 0)
{
QMimeData *mimeData = new QMimeData;
//mimeData->setText(item->asString());
mimeData->setData("application/x-muroa-playlist-diff", md.toQByteArray());
m_dragActive = true;
QDrag *drag = new QDrag(this);
drag->setMimeData(mimeData);
// drag->setPixmap(QPixmap(":/images/person.png"));
Qt::DropAction action = drag->exec(Qt::MoveAction);
m_dragActive = false;
qDebug() << QString("DropAction: %1").arg(action);
}
}