本文整理汇总了C++中KListViewItem类的典型用法代码示例。如果您正苦于以下问题:C++ KListViewItem类的具体用法?C++ KListViewItem怎么用?C++ KListViewItem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了KListViewItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: queryButtonClicked
void AdminUsers::queryButtonClicked()
{
QString quering = "";
KListViewItem *itemp = static_cast<KListViewItem*>(m_listView->currentItem());
quering += i18n("== query to user ") + itemp->text(2) + " == \n";
// select firstname,lastname,docident,address,phone,email,permissions from ldt_users,ldt_persons where ldt_persons.docIdent=ldt_users.docIdent and login='usuario'
KLSelect sqlquery(QStringList() << "firstname" << "lastname" << "ldt_users.docident" << "address" << "phone" << "email" << "permissions", QStringList() << "ldt_users" << "ldt_persons" );
sqlquery.setWhere("ldt_persons.docIdent=ldt_users.docIdent and login="+SQLSTR(m_listView->currentItem()->text(2)));
KLResultSet resultSet = KLDM->execQuery(&sqlquery);
m_xmlsource.setData(resultSet.toString());
if ( ! m_xmlreader.analizeXml(&m_xmlsource, KLResultSetInterpreter::Total ))
{
std::cout << "No se pudo analizar!!!" << std::endl;
}
KLSqlResults results = m_xmlreader.results();
quering += i18n("Real name: ") + results["firstname"] + " " + results["lastname"] + "\n";
quering += i18n("Identification: ") + results["ldt_users.docident"] + "\n";
quering += i18n("Address: ") + results["address"] + "\n";
quering += i18n("Phone: ") + results["phone"] + "\n";
quering += i18n("Email: ") + results["email"] + "\n";
quering += i18n("Permissions:") + results["permissions"] + "\n\n";
emit message2osd(quering);
}
示例2: it
void AdminDatabase::fillList()
{
m_listView->clear();
const QFileInfoList *files = m_dumpDir->entryInfoList("*.sql");
if ( files )
{
QFileInfoListIterator it( *files );
QFileInfo * fi = 0;
while( (fi=it.current()) != 0 )
{
++it;
KListViewItem *item = new KListViewItem(m_listView);
item->setText(0, fi->baseName().section('.', 0,0) );
QFile tmp(fi->absFilePath());
tmp.open(IO_ReadOnly);
QTextStream stream( &tmp );
item->setText(1, stream.readLine().section("--",1,1));
tmp.close();
item->setText(2, fi->created().toString(Qt::ISODate));
}
}
}
示例3: KListViewItem
void KAccountTemplateSelector::slotLoadCountry(void)
{
#ifndef KMM_DESIGNER
KListViewItem* parent = new KListViewItem(m_groupList, d->it_m.key());
parent->setSelectable(false);
QStringList::iterator it;
for(it = d->dirlist.begin(); it != d->dirlist.end(); ++it) {
QStringList::iterator it_f;
QDir dir(QString("%1%2").arg(*it).arg(*(d->it_m)));
if(dir.exists()) {
QStringList files = dir.entryList("*", QDir::Files);
for(it_f = files.begin(); it_f != files.end(); ++it_f) {
MyMoneyTemplate templ(QString("%1/%2").arg(dir.canonicalPath()).arg(*it_f));
d->m_templates[QString("%1").arg(d->id)] = templ;
new KListViewItem(parent, templ.title(), templ.shortDescription(), QString("%1").arg(d->id));
++d->id;
}
}
}
++d->it_m;
if(d->it_m != d->countries.end())
QTimer::singleShot(0, this, SLOT(slotLoadCountry()));
else {
d->loadHierarchy();
}
#endif
}
示例4: chainEnd
static KListViewItem* chainEnd(KListViewItem *parent) {
if(parent == 0) return 0;
KListViewItem* ret = dynamic_cast<KListViewItem*>(parent->firstChild());
if(ret == 0) return 0;
while(ret->nextSibling() != 0) {
ret = dynamic_cast<KListViewItem*>(ret->nextSibling());
}
return ret;
}
示例5: KListViewItem
void ConfirmSaveDialog::addIncidences( const Incidence::List &incidences,
const QString &operation )
{
Incidence::List::ConstIterator it;
for( it = incidences.begin(); it != incidences.end(); ++it ) {
Incidence *i = *it;
KListViewItem *item = new KListViewItem( mListView );
item->setText( 0, operation );
item->setText( 1, i->type() );
item->setText( 2, i->summary() );
item->setText( 3, i->uid() );
}
}
示例6: kdDebug
void CentralView::comboBoxActivatedSlot(const QString& str)
{
m_wordListView->clear();
_rem = str;
//Get the translations
trVector = trIO->translate(str); //One vector with str as it gave in combobox
trHVector = trIO->translate(ULStr(str)); //And another vector with the first letter of str in upper or
// lower case depends ...
kdDebug(300) << "str = " << str << endl;
kdDebug(301) << "str with ULStr filtering = " << ULStr(str) << endl;
kdDebug() << "locale : " << QTextCodec::locale() << endl;
if ( trVector.isEmpty() && trHVector.isEmpty() )
{
KMessageBox::error(this, "The string you entered doesn't exists", "No translation found");
m_noRecFound = 0;
}
else
{
unsigned long int size = trVector.size();
for (unsigned long int i = 0; i < size; i++)
{
KListViewItem *listItem = new KListViewItem(m_wordListView);
listItem->setText(0, trVector[i].enWord() );
//Convert from iso8859-7 to unicode
//and then add it to list.
listItem->setText(1, trVector[i].trWord() );
}
m_noRecFound = size;
size = trHVector.size();
if ( size != 0)
{
for (unsigned long int i = 0; i < size; i++)
{
KListViewItem *listItem = new KListViewItem(m_wordListView);
listItem->setText(0, trHVector[i].enWord() );
listItem->setText(1, trHVector[i].trWord() );
}
m_noRecFound += size;
}
}
m_wToTranslateCbx->lineEdit()->selectAll();
emit translationRequested();
}
示例7: delButtonClicked
void AdminUsers::delButtonClicked()
{
KListViewItem *itemp = static_cast<KListViewItem*>(m_listView->currentItem());
int opt = KMessageBox::questionYesNo(this, i18n("Are you sure to delete the user ")+itemp->text(2)+ " ?");
if (opt == KMessageBox::Yes )
{
KLDM->execRawQuery("delete from ldt_users where login="+ SQLSTR(itemp->text(2)));
KLDM->execRawQuery("drop user "+itemp->text(2));
delete itemp;
emit message2osd(i18n("The user has been deleted!!"));
}
}
示例8: clear
void KexiFieldListView::setSchema(KexiDB::TableOrQuerySchema* schema)
{
if (schema && m_schema == schema)
return;
m_allColumnsItem = 0;
clear();
delete m_schema;
m_schema = schema;
if (!m_schema)
return;
int order=0;
bool hasPKeys = true; //t->hasPrimaryKeys();
KListViewItem *item = 0;
KexiDB::QueryColumnInfo::Vector columns = m_schema->columns(true /*unique*/);
const int count = columns.count();
for(int i=-1; i < count; i++)
{
KexiDB::QueryColumnInfo *colinfo = 0;
if (i==-1) {
if (! (m_options & ShowAsterisk))
continue;
item = new KListViewItem(this, item, i18n("* (All Columns)"));
m_allColumnsItem = item;
}
else {
colinfo = columns[i];
item = new KListViewItem(this, item, colinfo->aliasOrName());
if (m_options & ShowDataTypes)
item->setText(1, colinfo->field->typeName());
}
if(colinfo && (colinfo->field->isPrimaryKey() || colinfo->field->isUniqueKey()))
item->setPixmap(0, m_keyIcon);
else if (hasPKeys) {
item->setPixmap(0, m_noIcon);
}
order++;
}
setCurrentItem(firstChild());
}
示例9: KexiMacroErrorBase
KexiMacroError::KexiMacroError(KexiMainWindow* mainwin, KSharedPtr<KoMacro::Context> context)
: KexiMacroErrorBase(mainwin, "KexiMacroError" , /*WFlags*/ Qt::WDestructiveClose)
, d(new Private(mainwin, context))
{
//setText(i18n("Execution failed")); //caption
//errortext, errorlist, continuebtn,cancelbtn, designerbtn
KoMacro::Exception* exception = context->exception();
iconlbl->setPixmap(KGlobal::instance()->iconLoader()->loadIcon("messagebox_critical", KIcon::Small, 32));
errorlbl->setText(i18n("<qt>Failed to execute the macro \"%1\".<br>%2</qt>").arg( context->macro()->name() ).arg( exception->errorMessage() ));
int i = 1;
KoMacro::MacroItem::List items = context->macro()->items();
for (KoMacro::MacroItem::List::ConstIterator mit = items.begin(); mit != items.end(); mit++)
{
KListViewItem* listviewitem = new KListViewItem(errorlist);
listviewitem->setText(0,QString("%1").arg(i++));
listviewitem->setText(1,i18n("Action"));
KSharedPtr<KoMacro::MacroItem> macroitem = *mit;
if (macroitem != 0 && macroitem->action() != 0)
{
listviewitem->setText(2,macroitem->action()->name());
}
if(macroitem == context->macroItem())
{
listviewitem->setOpen(true);
listviewitem->setSelected(true);
errorlist->setSelected(listviewitem, true);
errorlist->ensureItemVisible(listviewitem);
}
KoMacro::Variable::Map variables = macroitem->variables();
KoMacro::Variable::Map::ConstIterator vit;
for ( vit = variables.begin(); vit != variables.end(); ++vit ) {
KListViewItem* child = new KListViewItem(listviewitem);
child->setText(1,vit.key());
child->setText(2,vit.data()->toString());
}
}
connect(designerbtn, SIGNAL(clicked()), this, SLOT(designbtnClicked()));
connect(continuebtn, SIGNAL(clicked()), this, SLOT(continuebtnClicked()));
}
示例10: KListViewItem
/*!
\fn CentralView::showRecords()
*/
unsigned int CentralView::showRecords()
{
m_wordListView->clear();
trVector = trIO->allRecords();
if ( trVector.isEmpty() )
{
KMessageBox::error(this, "No Records found! Check File permission and try again", "No translation found");
return 0;
}
else
{
for (unsigned int i = 0; i < trVector.size(); i++)
{
KListViewItem *listItem = new KListViewItem(m_wordListView);
listItem->setText(0, trVector[i].enWord() );
listItem->setText(1, trVector[i].trWord() );
}
return trVector.size();
}
}
示例11: selectedItem
KURLDrag * MagnatuneListView::dragObject( )
{
KURL::List urls;
int id;
MagnatuneTrackList tracks;
MagnatuneTrackList::iterator it;
KListViewItem * pSelectedItem = dynamic_cast<KListViewItem *>( selectedItem() );
if (!pSelectedItem) {
debug() << "dynamic_cast to pSelectedItem failed!" << endl;
return 0;
}
switch ( pSelectedItem->depth() )
{
case 0:
id = ( ( MagnatuneListViewTrackItem * ) pSelectedItem ) ->getId();
tracks = MagnatuneDatabaseHandler::instance() ->getTracksByArtistId( id );
for ( it = tracks.begin(); it != tracks.end(); ++it )
{
urls.append( ( *it ).getHifiURL() );
}
break;
case 1:
id = ( ( MagnatuneListViewTrackItem * ) pSelectedItem ) ->getId();
tracks = MagnatuneDatabaseHandler::instance() ->getTracksByAlbumId( id );
for ( it = tracks.begin(); it != tracks.end(); ++it )
{
urls.append( ( *it ).getHifiURL() );
}
break;
case 2:
urls.append( ( ( MagnatuneListViewTrackItem * ) pSelectedItem ) ->getHifiURL( ) );
break;
}
KURLDrag* d = new KURLDrag( urls, this );
return d;
}
示例12: QHBox
void KPrWebPresentationWizard::setupPage4()
{
page4 = new QHBox( this );
QWhatsThis::add( page4, i18n("This page allows you to modify the titles of "
"each slide, if required. You normally do not need "
"to do this, but it is available if required.") );
page4->setSpacing( KDialog::spacingHint() );
page4->setMargin( KDialog::marginHint() );
QLabel* sidebar = new QLabel( page4 );
sidebar->setMinimumSize( 106, 318 );
sidebar->setMaximumSize( 106, 318 );
sidebar->setFrameShape( QFrame::Panel );
sidebar->setFrameShadow( QFrame::Sunken );
sidebar->setPixmap(locate("data", "kpresenter/pics/webslideshow-sidebar.png"));
QWidget* canvas = new QWidget( page4 );
QGridLayout *layout = new QGridLayout( canvas, 3, 2,
KDialog::marginHint(), KDialog::spacingHint() );
QLabel *helptext = new QLabel( canvas );
helptext->setAlignment( Qt::WordBreak | Qt::AlignVCenter| Qt::AlignLeft );
helptext->setText( i18n( "Here you can specify titles for "
"each slide. Click on a slide in "
"the list and then enter the title "
"in the textbox below. If you "
"click on a title, KPresenter "
"mainview will display the slide.") );
layout->addMultiCellWidget( helptext, 0, 0, 0, 1 );
QLabel *label = new QLabel( i18n( "Slide title:" ), canvas );
label->setAlignment( Qt::AlignVCenter | Qt::AlignRight );
layout->addWidget( label, 1, 0 );
slideTitle = new KLineEdit( canvas );
layout->addWidget( slideTitle, 1, 1 );
connect( slideTitle, SIGNAL( textChanged( const QString & ) ), this,
SLOT( slideTitleChanged( const QString & ) ) );
slideTitles = new KListView( canvas );
layout->addMultiCellWidget( slideTitles, 2, 2, 0, 1 );
slideTitles->addColumn( i18n( "No." ) );
slideTitles->addColumn( i18n( "Slide Title" ) );
connect( slideTitles, SIGNAL( selectionChanged( QListViewItem * ) ), this,
SLOT( slideTitleChanged( QListViewItem * ) ) );
slideTitles->setSorting( -1 );
slideTitles->setAllColumnsShowFocus( true );
slideTitles->setResizeMode( QListView::LastColumn );
slideTitles->header()->setMovingEnabled( false );
QValueList<KPrWebPresentation::SlideInfo> infos = webPres.getSlideInfos();
for ( int i = infos.count() - 1; i >= 0; --i ) {
KListViewItem *item = new KListViewItem( slideTitles );
item->setText( 0, QString::number( i + 1 ) );
//kdDebug(33001) << "KPrWebPresentationWizard::setupPage3 " << infos[ i ].slideTitle << endl;
item->setText( 1, infos[ i ].slideTitle );
}
slideTitles->setSelected( slideTitles->firstChild(), true );
addPage( page4, i18n( "Step 4: Customize Slide Titles" ) );
setHelpEnabled(page4, false); //doesn't do anything currently
}
示例13: while
void keyServer::slotsearchread(KProcIO *p)
{
QString required;
QString keymail,keyname;
while (p->readln(required,true)!=-1) {
//required=QString::fromUtf8(required);
if (required.find("keysearch.prompt")!=-1) {
if (count<4)
p->writeStdin("N");
else {
p->writeStdin("Q");
p->closeWhenDone();
}
required=QString::null;
}
if (required.find("GOT_IT")!=-1) {
count++;
required=QString::null;
}
if (required.find("(")==0) {
cycle=true;
QString fullname=required.remove(0,required.find(")")+1).stripWhiteSpace();
if (fullname.find("<")!=-1) {
keymail=fullname.section('<',-1,-1);
if (keymail.endsWith(">")) keymail.truncate(keymail.length()-1);
keyname=fullname.section('<',0,0);
} else {
keymail=QString::null;
keyname=fullname;
}
kitem=new KListViewItem(listpop->kLVsearch,keyname,keymail,QString::null,QString::null);
keyNumbers++;
count=0;
required=QString::null;
}
if ((cycle) && (!required.isEmpty())) {
QString subkey=required.stripWhiteSpace();
if (subkey.find(" key ")!=-1 && subkey.at(0).isDigit ())
{
QString kid=subkey.section(" key ",1,1);
kid=kid.stripWhiteSpace();
kid=kid.left(8);
kitem->setText(3,kid);
QString creation=subkey.section("created",1,1);
if (creation.startsWith(":")) creation=creation.right(creation.length()-1);
kitem->setText(2,creation);
cycle=false;
}
else
{
if (subkey.find("<")!=-1) {
keymail=subkey.section('<',-1,-1);
if (keymail.endsWith(">")) keymail.truncate(keymail.length()-1);
keyname=subkey.section('<',0,0);
} else {
keymail=QString::null;
keyname=subkey;
}
KListViewItem *subk = new KListViewItem(kitem,keyname,keymail,QString::null,QString::null);
subk->setSelectable(false);
}
required=QString::null;
}
}
}
示例14: if
void
ReportManager::addReportItem (Report* r, QString currentReport)
{
// The summary report has no report definition.
if (!r)
return;
KListViewItem* parent = 0;
int prefix = 0;
if (strncmp(r->getType(), "Qt", 2) == 0)
{
prefix = 2;
parent = qtReports;
}
else if (strncmp(r->getType(), "HTML", 4) == 0)
{
prefix = 4;
parent = htmlReports;
}
else if (strncmp(r->getType(), "CSV", 3) == 0)
{
prefix = 3;
parent = csvReports;
}
else if (strncmp(r->getType(), "SVG", 3) == 0)
{
prefix = 3;
parent = svgReports;
}
else if (strncmp(r->getType(), "XML", 3) == 0)
{
prefix = 3;
parent = xmlReports;
}
else if (strncmp(r->getType(), "ICal", 4) == 0)
{
prefix = 4;
parent = icalReports;
}
else if (strncmp(r->getType(), "Export", 6) == 0)
{
prefix = 6;
parent = exportReports;
}
else
kdError() << "ReportManager::updateReportBrowser(): "
<< "Unsupported report type " << r->getType() << endl;
if (r->getParentReport())
{
ManagedReportInfo* mri = getMRI(r->getParentReport());
if (mri) parent = mri->getBrowserEntry();
}
QPixmap subTypeIcon;
const char* subType = r->getType() + prefix;
if (strncmp(subType, "Task", strlen("Task")) == 0)
subTypeIcon =
KGlobal::iconLoader()->loadIcon("tj_task_group",
KIcon::Small);
else if (strncmp(subType, "Resource", strlen("Resource")) == 0)
subTypeIcon =
KGlobal::iconLoader()->loadIcon("tj_resource_group",
KIcon::Small);
else if (strncmp(subType, "Account", strlen("Account")) == 0)
subTypeIcon =
KGlobal::iconLoader()->loadIcon("tj_account_group",
KIcon::Small);
else if (strncmp(subType, "Index", strlen("Index")) == 0)
subTypeIcon =
KGlobal::iconLoader()->loadIcon("tj_report",
KIcon::Small);
else if (strncmp(subType, "WeeklyCalendar",
strlen("WeeklyCalendar")) == 0)
subTypeIcon =
KGlobal::iconLoader()->loadIcon("tj_calendar_report",
KIcon::Small);
else if (strncmp(subType, "MonthlyCalendar",
strlen("MonthlyCalendar")) == 0)
subTypeIcon =
KGlobal::iconLoader()->loadIcon("tj_calendar_report",
KIcon::Small);
else if (strncmp(subType, "Status", strlen("Status")) == 0)
subTypeIcon =
KGlobal::iconLoader()->loadIcon("tj_status_report",
KIcon::Small);
else if (strncmp(subType, "Report", strlen("Report")) == 0)
subTypeIcon =
KGlobal::iconLoader()->loadIcon("tj_file_tji",
KIcon::Small);
else if (strncmp(subType, "TimeTime", strlen("TimeTime")) == 0)
subTypeIcon =
KGlobal::iconLoader()->loadIcon("tj_file_tji",
KIcon::Small);
else if (strncmp(subType, "GanttTask", strlen("GanttTask")) == 0)
subTypeIcon =
KGlobal::iconLoader()->loadIcon("tj_task_group",
KIcon::Small);
else
{
//.........这里部分代码省略.........
示例15: setTabLabel
void AnnotationOutput::readAnnotations()
{
if (!Project::ref()->hasProject())
{
m_allAnnotations->clear();
m_yourAnnotations->clear();
m_yourAnnotationsNum = 0;
setTabLabel(m_yourAnnotations, i18n("For You"));
return;
}
KURL baseURL = Project::ref()->projectBaseURL();
QStringList openedItems;
QListViewItem *item = m_allAnnotations->firstChild();
while (item)
{
if (item->isOpen())
openedItems += item->text(0);
item = item->nextSibling();
}
m_allAnnotations->clear();
m_annotatedFileItems.clear();
m_fileNames.clear();
m_lines.clear();
QStringList yourOpenedItems;
item = m_yourAnnotations->firstChild();
while (item)
{
if (item->isOpen())
yourOpenedItems += item->text(0);
item = item->nextSibling();
}
m_yourAnnotations->clear();
m_yourFileItems.clear();
m_yourFileNames.clear();
m_yourLines.clear();
m_yourAnnotationsNum = 0;
QDomElement annotationElement = Project::ref()->dom()->firstChild().firstChild().namedItem("annotations").toElement();
if (annotationElement.isNull())
return;
QString yourself = Project::ref()->yourself().lower();
QStringList roles = Project::ref()->yourRoles();
QDomNodeList nodes = annotationElement.childNodes();
int count = nodes.count();
for (int i = 0; i < count; i++)
{
QDomElement el = nodes.item(i).toElement();
QString fileName = el.attribute("url");
KURL u = baseURL;
QuantaCommon::setUrl(u, fileName);
u = QExtFileInfo::toAbsolute(u, baseURL);
if (Project::ref()->contains(u))
{
bool ok;
int line = el.attribute("line").toInt(&ok, 10);
QString text = el.attribute("text");
QString receiver = el.attribute("receiver");
text.replace('\n',' ');
QString lineText = QString("%1").arg(line);
if (lineText.length() < 20)
{
QString s;
s.fill('0', 20 - lineText.length());
lineText.prepend(s);
}
KListViewItem *fileIt = m_annotatedFileItems[fileName];
if (!fileIt)
{
fileIt = new KListViewItem(m_allAnnotations, fileName);
m_annotatedFileItems.insert(fileName, fileIt);
m_fileNames[fileIt] = u.url();
}
KListViewItem *it = new KListViewItem(fileIt, fileIt, text, lineText);
if (openedItems.contains(fileName))
fileIt->setOpen(true);
m_fileNames[it] = u.url();
m_lines[it] = line;
if (!yourself.isEmpty() && (receiver == yourself || roles.contains(receiver)))
{
m_yourAnnotationsNum++;
KListViewItem *fileIt = m_yourFileItems[fileName];
if (!fileIt)
{
fileIt = new KListViewItem(m_yourAnnotations, fileName);
m_yourFileItems.insert(fileName, fileIt);
m_yourFileNames[fileIt] = u.url();
}
KListViewItem *it = new KListViewItem(fileIt, fileIt, text, lineText);
if (yourOpenedItems.contains(fileName))
fileIt->setOpen(true);
m_yourFileNames[it] = u.url();
m_yourLines[it] = line;
}
} else
{
annotationElement.removeChild(el);
//.........这里部分代码省略.........