本文整理汇总了C++中ConfigItem::id方法的典型用法代码示例。如果您正苦于以下问题:C++ ConfigItem::id方法的具体用法?C++ ConfigItem::id怎么用?C++ ConfigItem::id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfigItem
的用法示例。
在下文中一共展示了ConfigItem::id方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fill
void ConfigureDialog::fill(unsigned id)
{
lstBox->clear();
lstBox->setSorting(1);
ConfigItem *parentItem = new MainInfoItem(lstBox, 0);
for (unsigned i = 0; i < getContacts()->nClients(); i++){
Client *client = getContacts()->getClient(i);
CommandDef *cmds = client->configWindows();
if (cmds){
parentItem = NULL;
for (; cmds->text; cmds++){
if (parentItem){
new ClientItem(parentItem, client, cmds);
}else{
parentItem = new ClientItem(lstBox, client, cmds);
parentItem->setOpen(true);
}
}
}
}
unsigned n;
parentItem = NULL;
list<unsigned> st;
for (n = 0; n < getContacts()->nClients(); n++){
Protocol *protocol = getContacts()->getClient(n)->protocol();
if ((protocol->description()->flags & (PROTOCOL_AR | PROTOCOL_AR_USER)) == 0)
continue;
if (parentItem == NULL){
parentItem = new ConfigItem(lstBox, 0);
parentItem->setText(0, i18n("Autoreply"));
parentItem->setOpen(true);
}
for (const CommandDef *d = protocol->statusList(); d->text; d++){
if ((d->id == STATUS_ONLINE) || (d->id == STATUS_OFFLINE))
continue;
list<unsigned>::iterator it;
for (it = st.begin(); it != st.end(); ++it)
if ((*it) == d->id)
break;
if (it != st.end())
continue;
st.push_back(d->id);
new ARItem(parentItem, d);
}
}
parentItem = new ConfigItem(lstBox, 0);
parentItem->setText(0, i18n("Plugins"));
parentItem->setPixmap(0, Pict("run"));
parentItem->setOpen(true);
for ( n = 0;; n++){
Event e(EventPluginGetInfo, (void*)n);
pluginInfo *info = (pluginInfo*)e.process();
if (info == NULL) break;
if (info->info == NULL){
Event e(EventLoadPlugin, info->name);
e.process();
}
if ((info->info == NULL) || (info->info->title == NULL)) continue;
QString title = i18n(info->info->title);
new PluginItem(parentItem, title, info, n);
}
QFontMetrics fm(lstBox->font());
unsigned w = 0;
for (QListViewItem *item = lstBox->firstChild(); item; item = item->nextSibling()){
w = QMAX(w, itemWidth(item, fm));
}
lstBox->setFixedWidth(w);
lstBox->setColumnWidth(0, w - 2);
if (id){
for (QListViewItem *item = lstBox->firstChild(); item; item = item->nextSibling()){
ConfigItem *configItem = static_cast<ConfigItem*>(item);
if (configItem->id() == id){
lstBox->setCurrentItem(item);
break;
}
}
}else{
lstBox->setCurrentItem(lstBox->firstChild());
}
}