本文整理汇总了C++中QListViewItem::nextSibling方法的典型用法代码示例。如果您正苦于以下问题:C++ QListViewItem::nextSibling方法的具体用法?C++ QListViewItem::nextSibling怎么用?C++ QListViewItem::nextSibling使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QListViewItem
的用法示例。
在下文中一共展示了QListViewItem::nextSibling方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: apply
void ConfigureDialog::apply()
{
bLanguageChanged = false;
m_bAccept = true;
emit applyChanges();
if (!m_bAccept)
return;
for (unsigned i = 0; i < getContacts()->nClients(); i++){
Client *client = getContacts()->getClient(i);
const DataDef *def = client->protocol()->userDataDef();
if (def == NULL)
continue;
size_t size = 0;
for (const DataDef *d = def; d->name; ++d)
size += sizeof(unsigned) * d->n_values;
void *data = malloc(size);
string cfg = client->getConfig();
load_data(def, data, cfg.c_str());
emit applyChanges(client, data);
client->setClientInfo(data);
free_data(def, data);
free(data);
}
for (QListViewItem *item = lstBox->firstChild(); item; item = item->nextSibling()){
apply(item);
}
if (bLanguageChanged){
unsigned id = 0;
if (lstBox->currentItem())
id = static_cast<ConfigItem*>(lstBox->currentItem())->id();
disconnect(lstBox, SIGNAL(currentChanged(QListViewItem*)), this, SLOT(itemSelected(QListViewItem*)));
fill(id);
connect(lstBox, SIGNAL(currentChanged(QListViewItem*)), this, SLOT(itemSelected(QListViewItem*)));
itemSelected(lstBox->currentItem());
buttonApply->setText(i18n("&Apply"));
buttonOk->setText(i18n("&OK"));
buttonCancel->setText(i18n("&Cancel"));
setCaption(i18n("Setup"));
}
if (lstBox->currentItem())
static_cast<ConfigItem*>(lstBox->currentItem())->show();
Event e(EventSaveState);
e.process();
}
示例2: todayNoon
/******************************************************************************
* Return a list of events for birthdays chosen.
*/
QValueList<KAEvent> BirthdayDlg::events() const
{
QValueList<KAEvent> list;
QDate today = QDate::currentDate();
QDateTime todayNoon(today, QTime(12, 0, 0));
int thisYear = today.year();
int reminder = mReminder->minutes();
for (QListViewItem* item = mAddresseeList->firstChild(); item; item = item->nextSibling())
{
if (mAddresseeList->isSelected(item))
{
AddresseeItem* aItem = dynamic_cast<AddresseeItem*>(item);
if (aItem)
{
QDate date = aItem->birthday();
date.setYMD(thisYear, date.month(), date.day());
if (date <= today)
date.setYMD(thisYear + 1, date.month(), date.day());
KAEvent event(date,
mPrefix->text() + aItem->text(AddresseeItem::NAME) + mSuffix->text(),
mFontColourButton->bgColour(), mFontColourButton->fgColour(),
mFontColourButton->font(), KAEvent::MESSAGE, mLateCancel->minutes(),
mFlags);
float fadeVolume;
int fadeSecs;
float volume = mSoundPicker->volume(fadeVolume, fadeSecs);
event.setAudioFile(mSoundPicker->file(), volume, fadeVolume, fadeSecs);
QValueList<int> months;
months.append(date.month());
event.setRecurAnnualByDate(1, months, 0, Preferences::defaultFeb29Type(), -1, QDate());
event.setRepetition(mSubRepetition->interval(), mSubRepetition->count());
event.setNextOccurrence(todayNoon);
if (reminder)
event.setReminder(reminder, false);
if (mSpecialActionsButton)
event.setActions(mSpecialActionsButton->preAction(),
mSpecialActionsButton->postAction());
list.append(event);
}
}
}
return list;
}
示例3: slotViewChanged
void KateFileList::slotViewChanged ()
{
if (!viewManager->activeView()) return;
Kate::View *view = viewManager->activeView();
uint dn = view->getDoc()->documentNumber();
QListViewItem * i = firstChild();
while( i ) {
if ( ((KateFileListItem *)i)->documentNumber() == dn )
{
break;
}
i = i->nextSibling();
}
if ( ! i )
return;
KateFileListItem *item = (KateFileListItem*)i;
setCurrentItem( item );
// ### During load of file lists, all the loaded views gets active.
// Do something to avoid shading them -- maybe not creating views, just
// open the documents???
// int p = 0;
// if ( m_viewHistory.count() )
// {
// int p = m_viewHistory.findRef( item ); // only repaint items that needs it
// }
m_viewHistory.removeRef( item );
m_viewHistory.prepend( item );
for ( uint i=0; i < m_viewHistory.count(); i++ )
{
m_viewHistory.at( i )->setViewHistPos( i+1 );
repaintItem( m_viewHistory.at( i ) );
}
}
示例4: slotDocumentDeleted
void KateFileList::slotDocumentDeleted(uint documentNumber)
{
QListViewItem *item = firstChild();
while(item)
{
if(((KateFileListItem *)item)->documentNumber() == documentNumber)
{
// m_viewHistory.removeRef( (KateFileListItem *)item );
// m_editHistory.removeRef( (KateFileListItem *)item );
removeItem(item);
break;
}
item = item->nextSibling();
}
updateActions();
}
示例5: while
void
Item::stateChange( bool b )
{
QStringList &cs_m_dirs = CollectionSetup::instance()->m_dirs;
if( CollectionSetup::instance()->recursive() )
for( QListViewItem *item = firstChild(); item; item = item->nextSibling() )
static_cast<QCheckListItem*>(item)->QCheckListItem::setOn( b );
// Update folder list
QStringList::Iterator it = cs_m_dirs.find( m_url.path() );
if ( isOn() ) {
if ( it == cs_m_dirs.end() )
cs_m_dirs << m_url.path();
}
else {
//Deselect item and recurse through children but only deselect children if they
//do not exist unless we are in recursive mode (where no children should be
//selected if the parent is being unselected)
//Note this does not do anything to the checkboxes, but they should be doing
//the same thing as we are (hopefully)
cs_m_dirs.erase( it );
QStringList::Iterator diriter = cs_m_dirs.begin();
while ( diriter != cs_m_dirs.end() )
{
if ( (*diriter).startsWith( m_url.path() + '/' ) )
{
if ( CollectionSetup::instance()->recursive() ||
!QFile::exists( *diriter ) )
{
diriter = cs_m_dirs.erase(diriter);
}
else
++diriter;
}
else
++diriter;
}
}
// Redraw parent items
listView()->triggerUpdate();
}
示例6: 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()));
}
示例7: selectionHasChanged
// This function is called when selection is changed (both selected/deselected)
// It notifies the parent about selection status and enables/disables menubar
void KfindWindow::selectionHasChanged()
{
emit resultSelected(true);
QListViewItem *item = firstChild();
while(item != 0L)
{
if(isSelected(item))
{
emit resultSelected(true);
haveSelection = true;
return;
}
item = item->nextSibling();
}
haveSelection = false;
emit resultSelected(false);
}
示例8: SetListViewItem
/*
*Function:SetListViewItem
*Inputs:list view, item to find
*Outputs:none
*Returns:index to found item or 0
*/
int SetListViewItem(QListView *pCombo, const QString &item)
{
IT_IT("SetListViewItem");
QListViewItem *pI = pCombo->firstChild();
if(pI)
{
for(; pI != 0; pI = pI->nextSibling())
{
if(pI->text(0) == item)
{
pCombo->setCurrentItem(pI);
return 0;
};
};
pCombo->setCurrentItem(pCombo->firstChild());
};
return 0;
};
示例9: slotNameChanged
void KateFileList::slotNameChanged(Kate::Document *doc)
{
if(!doc)
return;
// ### using nextSibling to *only* look at toplevel items.
// child items could be marks for example
QListViewItem *item = firstChild();
while(item)
{
if(((KateFileListItem *)item)->document() == doc)
{
item->setText(0, doc->docName());
repaintItem(item);
break;
}
item = item->nextSibling();
}
updateSort();
}
示例10: addQuestion
/** Add question with form data */
void KControlAddEdit::addQuestion()
{
_keducaFile->setQuestion( FileRead::QF_TEXT, _questionText->text() );
_keducaFile->setQuestion( FileRead::QF_TYPE, _questionType->currentItem()+1 );
_keducaFile->setQuestion( FileRead::QF_PICTURE, _questionPicture->url() );
_keducaFile->setQuestion( FileRead::QF_POINTS, _questionPoint->value() );
_keducaFile->setQuestion( FileRead::QF_TIME, _questionTime->value() );
_keducaFile->setQuestion( FileRead::QF_TIP, _questionTip->text() );
_keducaFile->setQuestion( FileRead::QF_EXPLAIN, _questionExplain->text() );
_keducaFile->clearAnswers();
QListViewItem *item = _listAnswers->firstChild();
while (item) {
_keducaFile->setAnswer(
item->text(0), // The Answer text
item->text(1)==i18n("True"), // the validity of the answer
item->text(2).toInt()); // the points
item = item->nextSibling();
}
}
示例11: apply
void SoundUserConfig::apply(void *data)
{
selectionChanged(NULL);
SoundUserData *user_data = (SoundUserData*)data;
for (QListViewItem *item = lstSound->firstChild(); item; item = item->nextSibling()){
unsigned id = item->text(2).toUInt();
QString text = item->text(1);
if (text.isEmpty())
text = "(nosound)";
if (id == ONLINE_ALERT){
user_data->Alert.str() = text;
}else{
set_str(&user_data->Receive, id, text);
}
}
user_data->NoSoundIfActive.asBool() = chkActive->isChecked();
user_data->Disable.asBool() = chkDisable->isChecked();
Event e(m_plugin->EventSoundChanged);
e.process();
}
示例12: 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 ()));
}
示例13: getList
void IndexDialog::getList (QString &d)
{
d.truncate(0);
if (! list->childCount())
return;
QListViewItem *item = list->firstChild();
while (item)
{
QString *sp = symbolDict[item->text(0)];
d.append(sp->left(sp->length()));
d.append(":");
d.append(item->text(1));
d.append(":");
item = item->nextSibling();
}
}
示例14: slotShowAll
/**
* Makes all descendants of the given item visible.
* This slot is connected to the showAll() signal of the QueryResultsMenu
* object.
*/
void TreeWidget::slotShowAll(QListViewItem* pParent)
{
QListViewItem* pItem;
// Get the first child
if (pParent != NULL)
pItem = pParent->firstChild();
else
pItem = firstChild();
// Iterate over all child items
while (pItem != NULL) {
pItem->setVisible(true);
// Show child items recursively
slotShowAll(pItem);
pItem = pItem->nextSibling();
}
}
示例15: addDerivedClassifier
void RefactoringAssistant::addDerivedClassifier()
{
QListViewItem *item = selectedItem();
if(!item)
{
kWarning()<<"RefactoringAssistant::addDerivedClassifier() "
<<"called with no item selected"<<endl;
return;
}
UMLObject *obj = findUMLObject( item );
if( !dynamic_cast<UMLClassifier*>(obj) )
{
kWarning()<<"RefactoringAssistant::addDerivedClassifier() "
<<"called for a non-classifier object"<<endl;
return;
}
//classes have classes and interfaces interfaces as super/derived classifiers
Uml::Object_Type t = obj->getBaseType();
UMLClassifier *derived = static_cast<UMLClassifier*>(Object_Factory::createUMLObject(t));
if(!derived)
return;
m_doc->createUMLAssociation( derived, obj, Uml::at_Generalization );
////////////////////// Manually add the classifier to the assitant - would be nicer to do it with
///////////////////// a signal, like operations and attributes
QListViewItem *derivedFolder = item->firstChild();
while( derivedFolder->text(0) != i18n("Derived Classifiers") )
derivedFolder = derivedFolder->nextSibling();
if(!derivedFolder)
{
kWarning()<<"Cannot find Derived Folder"<<endl;
return;
}
item = new KListViewItem( derivedFolder, derived->getName() );
item->setPixmap(0,m_pixmaps.Subclass);
item->setExpandable( true );
m_umlObjectMap[item] = derived;
addClassifier( derived, item, false, true, true);
/////////////////////////
}