本文整理汇总了C++中ConfigItem::setText方法的典型用法代码示例。如果您正苦于以下问题:C++ ConfigItem::setText方法的具体用法?C++ ConfigItem::setText怎么用?C++ ConfigItem::setText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfigItem
的用法示例。
在下文中一共展示了ConfigItem::setText方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: set
/**
* Set a "key = value" to config items
*
* @param key The name of the key to set
* @param value The value to set
*/
int Settings::set(QString key, QString value)
{
QPtrListIterator<ConfigItem> it(m_items);
// Search for existing key
while (it.current() != NULL)
{
if (it.current()->key() == key)
{
// Replace existing
it.current()->setText(value);
return m_items.count();
}
else
{
++it;
}
}
//
// If we come here, it means the key was not found so we must create new
ConfigItem* item = new ConfigItem;
item->setKey(key);
item->setText(value);
m_items.append(item);
return m_items.count();
}
示例2: 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 long 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 (((protocol->description()->flags & PROTOCOL_AR_OFFLINE) == 0) &&
((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", lstBox->colorGroup().base()));
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, (char*)info->name.c_str());
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()){
if (setCurrentItem(item, id))
return;
}
}
lstBox->setCurrentItem(lstBox->firstChild());
}