本文整理汇总了C++中QListViewItem::rtti方法的典型用法代码示例。如果您正苦于以下问题:C++ QListViewItem::rtti方法的具体用法?C++ QListViewItem::rtti怎么用?C++ QListViewItem::rtti使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QListViewItem
的用法示例。
在下文中一共展示了QListViewItem::rtti方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: edit_I
void KstDataManagerI::edit_I() {
QListViewItem *qi;
if (DataView->selectedItems().count() > 0) {
qi = DataView->selectedItems().at(0);
} else {
KMessageBox::sorry(this, i18n("A data item must be selected to edit."));
return;
}
if (qi->rtti() == RTTI_OBJ_DATA_VECTOR) {
emit editDataVector(qi->text(0));
}
if (qi->rtti() == RTTI_OBJ_STATIC_VECTOR) {
emit editStaticVector(qi->text(0));
}
if (qi->rtti() == RTTI_OBJ_OBJECT) {
static_cast<KstObjectItem*>(qi)->dataObject()->showDialog();
}
if (qi->rtti() == RTTI_OBJ_DATA_MATRIX) {
emit editDataMatrix(qi->text(0));
}
if (qi->rtti() == RTTI_OBJ_STATIC_MATRIX) {
emit editStaticMatrix(qi->text(0));
}
}
示例2: delete_I
void KstDataManagerI::delete_I() {
QListViewItem *qi = DataView->selectedItems().at(0);
KstObjectItem *koi = static_cast<KstObjectItem*>(qi);
if (qi->rtti() == RTTI_OBJ_OBJECT) {
doc->removeDataObject(koi->tagName());
} else if (qi->rtti() == RTTI_OBJ_DATA_VECTOR) {
KST::vectorList.removeTag(koi->tagName());
doUpdates();
}
}
示例3:
qsamplerInstrumentGroup *qsamplerInstrumentGroup::groupItem (void) const
{
QListViewItem *pParent = QListViewItem::parent();
while (pParent && pParent->rtti() != qsamplerInstrumentList::Group)
pParent = pParent->parent();
return static_cast<qsamplerInstrumentGroup *> (pParent);
}
示例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: selectionChangedSlot
// In-place selection slot.
void qsamplerInstrumentList::selectionChangedSlot (void)
{
qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
QListViewItem *pListItem = QListView::selectedItem();
bool bEnabled = (pMainForm && pMainForm->client());
m_pNewItemAction->setEnabled(bEnabled);
bEnabled = (bEnabled && pListItem != NULL);
m_pEditItemAction->setEnabled(bEnabled && pListItem->rtti() == Item);
m_pRenameAction->setEnabled(bEnabled);
m_pDeleteAction->setEnabled(bEnabled);
}
示例6: contentsDropEvent
void FolderListView::contentsDropEvent( QDropEvent *e )
{
QListViewItem *dest = itemAt( contentsToViewport(e->pos()) );
if ( dest && dest->rtti() == FolderListItem::ListItemType)
{
emit dropItems(dest);
e->accept();
}
else
e->ignore();
}
示例7: deleteSlot
// Remove current group/item.
void qsamplerInstrumentList::deleteSlot (void)
{
QListViewItem *pListItem = QListView::selectedItem();
if (pListItem == NULL)
return;
qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
if (pMainForm == NULL)
return;
// Prompt user if this is for real...
qsamplerOptions *pOptions = pMainForm->options();
if (pOptions && pOptions->bConfirmRemove) {
if (QMessageBox::warning(this,
QSAMPLER_TITLE ": " + tr("Warning"),
tr("Delete %1:\n\n"
"%2\n\n"
"Are you sure?")
.arg(pListItem->rtti() == Item ? tr("instrument") : tr("group"))
.arg(pListItem->text(0)),
tr("OK"), tr("Cancel")) > 0)
return;
}
// Unmap instrument entry...
if (pListItem->rtti() == Item) {
qsamplerInstrumentItem *pItem
= static_cast<qsamplerInstrumentItem *> (pListItem);
if (pItem && pItem->instrument()) {
pItem->instrument()->unmapInstrument();
emit instrumentsChanged();
}
}
// Do it for real...
delete pListItem;
selectionChangedSlot();
}
示例8: iter
// Find a group item, given its name.
qsamplerInstrumentGroup *qsamplerInstrumentList::findGroup (
const QString& sName ) const
{
// Iterate all over the place to search for the group.
QListViewItemIterator iter((QListView *) this);
while (iter.current()) {
QListViewItem *pItem = iter.current();
if (pItem->rtti() == Group && pItem->text(0) == sName)
return static_cast<qsamplerInstrumentGroup *> (pItem);
++iter;
}
// Not found.
return NULL;
}
示例9: clear
void VariableTree::clear()
{
QListViewItem *sibling = firstChild();
while (sibling != 0) {
QListViewItem * current = sibling;
sibling = sibling->nextSibling();
if (current->rtti() != RTTI_WATCH_ROOT) {
delete current;
}
}
globalRoot_ = 0;
selectedFrame_ = 0;
return;
}
示例10: editItemSlot
// Edit current item below the current one.
void qsamplerInstrumentList::editItemSlot (void)
{
QListViewItem *pListItem = QListView::selectedItem();
if (pListItem == NULL)
return;
if (pListItem->rtti() == Item) {
qsamplerInstrument *pInstrument = NULL;
qsamplerInstrumentItem *pItem
= static_cast<qsamplerInstrumentItem *> (pListItem);
if (pItem)
pInstrument = pItem->instrument();
if (pInstrument) {
// Save current key values...
qsamplerInstrument oldInstrument(*pInstrument);
// Do the edit dance...
qsamplerInstrumentForm form(this);
form.setup(pInstrument);
if (form.exec()) {
// Commit...
pInstrument->mapInstrument();
// Check whether we changed instrument key...
if (oldInstrument.map() == pInstrument->map() &&
oldInstrument.bank() == pInstrument->bank() &&
oldInstrument.prog() == pInstrument->prog()) {
// just update tree item...
pItem->update();
} else {
// Unmap old instance...
oldInstrument.unmapInstrument();
// Change item tree, whether applicable...
if (m_iMidiMap < 0 || m_iMidiMap == pInstrument->map()) {
// Add new brand item into view...
addItem(pInstrument, groupItem(pListItem));
} else {
// Just remove/hide old one.
delete pItem;
}
}
// Notify we've changes...
emit instrumentsChanged();
}
}
}
selectionChangedSlot();
}
示例11: firstChild
VarFrameRoot *VariableTree::findFrame(int frameNo, int threadNo) const
{
// frames only exist on the top level so we only need to
// check the siblings
QListViewItem *sibling = firstChild();
while (sibling != 0) {
if ( sibling->rtti() == RTTI_VAR_FRAME_ROOT
&& ((VarFrameRoot*) sibling)->frameNo() == frameNo
&& ((VarFrameRoot*) sibling)->threadNo() == threadNo )
{
return (VarFrameRoot*) sibling;
}
sibling = sibling->nextSibling();
}
return 0;
}
示例12: prune
void VariableTree::prune()
{
QListViewItem *child = firstChild();
while (child != 0) {
QListViewItem *nextChild = child->nextSibling();
// Only prune var frames, not the watch or global root
if (child->rtti() == RTTI_VAR_FRAME_ROOT) {
if (((VarFrameRoot*) child)->isActive()) {
if (child->isOpen()) {
((VarFrameRoot*) child)->prune();
}
} else {
delete child;
}
}
child = nextChild;
}
}
示例13: schedule
bool VariableTree::schedule()
{
QListViewItem * child = firstChild();
VarFrameRoot * frame = 0;
while (child != 0) {
if (child->rtti() == RTTI_VAR_FRAME_ROOT) {
frame = (VarFrameRoot *) child;
Q_ASSERT( !frame->isWaitingForData() );
if (frame->needsVariables()) {
if (QApplication::overrideCursor() == 0) {
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
}
// Tell the controller to fetch the variable values
emit selectFrame(frame->frameNo(), frame->threadNo());
return true;
}
}
child = child->nextSibling();
}
frame = findFrame(1, currentThread_);
Q_ASSERT( frame != 0 );
Q_ASSERT( !frame->needsVariables() );
// All over, nothing left to fetch.
// Return to frame 1, and prune the inactive items
// from the variable tree..
QApplication::restoreOverrideCursor();
emit selectFrame(1, currentThread_);
prune();
return false;
}
示例14: update
void KstDataManagerI::update() {
if (!isShown()) {
return;
}
QListViewItem *currentItem = DataView->selectedItem();
QPtrStack<QListViewItem> trash;
KST::dataObjectList.lock().writeLock();
KST::vectorList.lock().writeLock();
KST::matrixList.lock().writeLock();
// garbage collect first
for (QListViewItem *i = DataView->firstChild(); i; i = i->nextSibling()) {
KstObjectItem *oi = static_cast<KstObjectItem*>(i);
if (i->rtti() == RTTI_OBJ_OBJECT) {
if (KST::dataObjectList.findTag(oi->tag().tag()) == KST::dataObjectList.end()) {
trash.push(i);
}
} else if (i->rtti() == RTTI_OBJ_DATA_MATRIX ||
i->rtti() == RTTI_OBJ_MATRIX ||
i->rtti() == RTTI_OBJ_STATIC_MATRIX) {
if (KST::matrixList.findTag(oi->tag().tag()) == KST::matrixList.end()) {
trash.push(i);
}
} else {
if (KST::vectorList.findTag(oi->tag().tag()) == KST::vectorList.end()) {
trash.push(i);
}
}
}
trash.setAutoDelete(true);
DataView->blockSignals(true);
trash.clear();
DataView->blockSignals(false);
// update the data objects
for (KstDataObjectList::iterator it = KST::dataObjectList.begin();
it != KST::dataObjectList.end();
++it) {
KstReadLocker dol(*it);
bool found = false;
for (QListViewItem *i = DataView->firstChild(); i; i = i->nextSibling()) {
KstObjectItem *oi = static_cast<KstObjectItem*>(i);
if (oi->rtti() == RTTI_OBJ_OBJECT && oi->tag().tag() == (*it)->tag().tag()) {
oi->update();
found = true;
break;
}
}
if (!found) {
KstObjectItem *i = new KstObjectItem(DataView, *it, this);
connect(i, SIGNAL(updated()), this, SLOT(doUpdates()));
}
}
KST::dataObjectList.lock().unlock();
// update the data vectors
KstRVectorList rvl = kstObjectSubList<KstVector,KstRVector>(KST::vectorList);
for (KstRVectorList::iterator it = rvl.begin(); it != rvl.end(); ++it) {
KstReadLocker vl(*it);
bool found = false;
for (QListViewItem *i = DataView->firstChild(); i; i = i->nextSibling()) {
KstObjectItem *oi = static_cast<KstObjectItem*>(i);
if (oi->rtti() == RTTI_OBJ_DATA_VECTOR && oi->tag().tag() == (*it)->tag().tag()) {
oi->update(true, 1);
found = true;
break;
}
}
if (!found) {
KstObjectItem *i = new KstObjectItem(DataView, *it, this, 1);
connect(i, SIGNAL(updated()), this, SLOT(doUpdates()));
}
}
// update the static vectors
KstSVectorList svl = kstObjectSubList<KstVector,KstSVector>(KST::vectorList);
for (KstSVectorList::iterator it = svl.begin(); it != svl.end(); ++it) {
KstReadLocker vl(*it);
bool found = false;
for (QListViewItem *i = DataView->firstChild(); i; i = i->nextSibling()) {
KstObjectItem *oi = static_cast<KstObjectItem*>(i);
if (oi->rtti() == RTTI_OBJ_STATIC_VECTOR && oi->tag().tag() == (*it)->tag().tag()) {
oi->update(true, 1);
found = true;
break;
}
}
if (!found) {
KstObjectItem *i = new KstObjectItem(DataView, *it, this, 1);
connect(i, SIGNAL(updated()), this, SLOT(doUpdates()));
}
}
KST::vectorList.lock().unlock();
// update the data matrices
//.........这里部分代码省略.........