本文整理汇总了C++中kurl::List::at方法的典型用法代码示例。如果您正苦于以下问题:C++ List::at方法的具体用法?C++ List::at怎么用?C++ List::at使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kurl::List
的用法示例。
在下文中一共展示了List::at方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: slotApplyTitle
void WmWidget::slotApplyTitle()
{
kDebug() << "ApplyTitle";
QString givenTitle = title();
QString imageTitle;
QString number;
QString originalExtension;
QString currentExtension;
KUrl::List urls;
QMap<QString, QString> imageMetaData;
QList<QTreeWidgetItem*> selectedItems = d->imgList->listView()->selectedItems();
QStringList parts;
const int minLength = givenTitle.count("#");
// Build the list of items to rename
for (int i = 0; i < selectedItems.size(); ++i)
{
KPImagesListViewItem* l_item = dynamic_cast<KPImagesListViewItem*>(selectedItems.at(i));
urls.append(l_item->url());
}
for (int i = 0; i < urls.size(); ++i)
{
imageMetaData = d->imagesDescInfo[urls.at(i).path()];
imageTitle = givenTitle;
// If there is at least one #, replace it the correct number
if(minLength > 0)
{
parts = imageTitle.split("#", QString::KeepEmptyParts);
imageTitle = parts.first().append("#").append(parts.last());
number = QString::number(i + 1);
while (number.length() < minLength)
{
number.prepend("0");
}
imageTitle.replace(imageTitle.indexOf("#"), 1, number);
}
// Add original extension if removed
currentExtension = imageTitle.split('.').last();
originalExtension = urls.at(i).path().split('.').last();
if(QString::compare(currentExtension, originalExtension, Qt::CaseInsensitive) != 0)
{
imageTitle.append(".").append(originalExtension);
d->titleEdit->setText(imageTitle);
}
kDebug() << urls.at(i).path() << "renamed to" << imageTitle;
imageMetaData["title"] = imageTitle;
d->imagesDescInfo[urls.at(i).path()] = imageMetaData;
}
}
示例2: loadImageInfoFirstLoad
void WmWidget::loadImageInfoFirstLoad()
{
KUrl::List urls = d->imgList->imageUrls(false);
QString title;
QString date;
QString description;
QString currentCategories;
QString latitude;
QString longitude;
for(int j = 0; j < urls.size(); j++)
{
KPImageInfo info(urls.at(j).path());
QStringList keywar = info.keywords();
date = info.date().toString(Qt::ISODate);
date = date.replace("T", " ", Qt::CaseSensitive);
title = info.name();
description = info.title();
currentCategories = "";
for( int i = 0; i < keywar.size(); i++)
{
if(i == keywar.size()-1)
{
currentCategories.append(keywar.at(i));
}
else
{
currentCategories.append(keywar.at(i)).append("\n");
}
}
if(info.hasLatitude())
{
latitude = QString::number(info.latitude());
}
if(info.hasLongitude())
{
longitude = QString::number(info.longitude());
}
QMap<QString, QString> imageMetaData;
imageMetaData["title"] = title;
imageMetaData["date"] = date;
imageMetaData["categories"] = currentCategories;
imageMetaData["description"] = description;
imageMetaData["latitude"] = latitude;
imageMetaData["longitude"] = longitude;
d->imagesDescInfo.insert(urls.at(j).path(), imageMetaData);
}
}
示例3: sort
void PlaylistModel::sort(int column, Qt::SortOrder order)
{
if (m_tracks.count() < 2)
{
return;
}
QMultiMap<QString, KUrl> keyMap;
QMultiMap<qint64, KUrl> durationMap;
KUrl::List tracks;
const KUrl url = m_tracks.value(m_currentTrack);
if (column == DurationColumn)
{
for (int i = 0; i < m_tracks.count(); ++i)
{
durationMap.insert(MetaDataManager::duration(m_tracks.at(i)), m_tracks.at(i));
}
tracks = durationMap.values();
}
else if (column > FileNameColumn && column < DurationColumn)
{
const MetaDataKey key = translateColumn(column);
for (int i = 0; i < m_tracks.count(); ++i)
{
keyMap.insert(MetaDataManager::metaData(m_tracks.at(i), key), m_tracks.at(i));
}
tracks = keyMap.values();
}
else
{
for (int i = 0; i < m_tracks.count(); ++i)
{
keyMap.insert(m_tracks.at(i).pathOrUrl(), m_tracks.at(i));
}
tracks = keyMap.values();
}
if (order == Qt::AscendingOrder)
{
KUrl::List items;
for (int i = (tracks.count() - 1); i >= 0; --i)
{
items.append(tracks.at(i));
}
tracks = items;
}
m_tracks = tracks;
setCurrentTrack(findTrack(url));
emit tracksChanged();
}
示例4: processedTracks
void PlaylistModel::processedTracks(const KUrl::List &tracks, int position, PlayerReaction reaction)
{
for (int i = (tracks.count() - 1); i >= 0; --i)
{
m_tracks.insert(position, tracks.at(i));
}
if (reaction == PlayReaction)
{
setCurrentTrack(position, reaction);
}
else if (position <= m_currentTrack)
{
if (m_tracks.count() == tracks.count())
{
setCurrentTrack(0, reaction);
}
else
{
setCurrentTrack(qMin((m_currentTrack + tracks.count()), (m_tracks.count() - 1)), reaction);
}
}
MetaDataManager::resolveTracks(tracks);
emit tracksChanged();
emit modified();
}
示例5: author
QMap <QString,QMap <QString,QString> > WmWidget::allImagesDesc()
{
KUrl::List urls = d->imgList->imageUrls(false);
for (int i = 0; i < urls.size(); ++i)
{
QMap<QString, QString> imageMetaData = d->imagesDescInfo[urls.at(i).path()];
imageMetaData["author"] = author();
imageMetaData["source"] = source();
imageMetaData["license"] = license();
imageMetaData["genCategories"] = genCategories();
imageMetaData["genText"] = genText();
d->imagesDescInfo[urls.at(i).path()] = imageMetaData;
}
return d->imagesDescInfo;
}
示例6: slotApplyImagesDesc
void WmWidget::slotApplyImagesDesc(){
//-- enregistrement des edit dans la map
KUrl::List urls;
QList<QTreeWidgetItem *> selectedItems=m_imgList->listView()->selectedItems();
for (int i = 0; i < selectedItems.size(); ++i){
KPImagesListViewItem* l_item = dynamic_cast<KPImagesListViewItem*>(selectedItems.at(i));
urls.append(l_item->url());
}
for (int i = 0; i < urls.size(); ++i)
{
QMap<QString, QString> imageMetaData;
imageMetaData = m_imagesDescInfo[urls.at(i).path()];
if(m_titleCheck->isChecked()){
QString url = urls.at(i).path().split('/').last();
url = title();
if(url.split('.').last().isEmpty()){
url = url +"."+urls.at(i).path().split('.').last();
m_titleEdit->setText(url);
}
kDebug()<<" Url in the if "<<url;
imageMetaData["title"] = url;
kDebug()<<" Url after if "<<url;
}
if(m_dateCheck->isChecked()){
imageMetaData["time"] = date();
}
if(m_categoryCheck->isChecked()){
imageMetaData["categories"] = categories();
}
if(m_descCheck->isChecked()){
imageMetaData["description"] = description();
}
m_imagesDescInfo[urls.at(i).path()]=imageMetaData;
}
}
示例7: slotApplyLongitude
void WmWidget::slotApplyLongitude()
{
KUrl::List urls;
QList<QTreeWidgetItem*> selectedItems = d->imgList->listView()->selectedItems();
for (int i = 0; i < selectedItems.size(); ++i)
{
KPImagesListViewItem* l_item = dynamic_cast<KPImagesListViewItem*>(selectedItems.at(i));
urls.append(l_item->url());
}
for (int i = 0; i < urls.size(); ++i)
{
QMap<QString, QString> imageMetaData;
imageMetaData = d->imagesDescInfo[urls.at(i).path()];
imageMetaData["longitude"] = longitude();
d->imagesDescInfo[urls.at(i).path()] = imageMetaData;
}
}
示例8: author
QMap <QString,QMap <QString,QString> > WmWidget::allImagesDesc()
{
KUrl::List urls = m_imgList->imageUrls(false);
for (int i = 0; i < urls.size(); ++i)
{
QMap<QString, QString> imageMetaData = m_imagesDescInfo[urls.at(i).path()];
imageMetaData["author"] = author();
imageMetaData["license"] = license();
m_imagesDescInfo[urls.at(i).path()]=imageMetaData;
}
return m_imagesDescInfo;
}
示例9: slotStartTransfer
void WMWindow::slotStartTransfer()
{
saveSettings();
KUrl::List urls = iface()->currentSelection().images();
QMap <QString,QMap <QString,QString> > imagesDesc=m_widget->allImagesDesc();
for (int i = 0; i < urls.size(); ++i)
{
QString caption;
QString url;
if(m_widget->resize()){
prepareImageForUpload(urls.at(i).path(), caption);
;
imagesDesc.insert(m_tmpPath, imagesDesc.take(urls.at(i).path()));
}
}
m_uploadJob->setImageMap(imagesDesc);
m_widget->progressBar()->setRange(0, 100);
m_widget->progressBar()->setValue(0);
connect(m_uploadJob, SIGNAL(uploadProgress(int)),
m_widget->progressBar(), SLOT(setValue(int)));
connect(m_uploadJob, SIGNAL(endUpload()),
this, SLOT(slotEndUpload()));
m_widget->progressBar()->show();
m_widget->progressBar()->progressScheduled(i18n("Wiki Export"), true, true);
m_widget->progressBar()->progressThumbnailChanged(KIcon("kipi").pixmap(22, 22));
m_uploadJob->begin();
}
示例10: dropEvent
void SpellCheck::dropEvent(QGraphicsSceneDragDropEvent *event)
{
if (m_dragTimer) {
killTimer(m_dragTimer);
}
if (!KUrl::List::canDecode(event->mimeData())) {
if (event->mimeData()->hasText()) {
if (!m_spellingDialog || !m_spellingDialog->isVisible()) {
toggleDialog(false);
}
m_textEdit->setText(event->mimeData()->text());
event->accept();
} else {
event->ignore();
}
return;
}
if (!m_spellingDialog || !m_spellingDialog->isVisible()) {
toggleDialog(false);
m_textEdit->clear();
}
KUrl::List droppedUrls = KUrl::List::fromMimeData(event->mimeData());
QTextCursor cursor = m_textEdit->textCursor();
for (int i = 0; i < droppedUrls.count(); ++i) {
QFile file(droppedUrls.at(i).toLocalFile());
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
QTextStream contents(file.readAll());
contents.setAutoDetectUnicode(true);
cursor.insertText(contents.readAll());
}
file.close();
}
event->accept();
}
示例11: slotSoundFilesButtonSave
void SoundtrackDialog::slotSoundFilesButtonSave()
{
QPointer<KFileDialog> dlg = new KFileDialog(QString(), QString(), this);
dlg->setOperationMode(KFileDialog::Saving);
dlg->setMode(KFile::File);
dlg->setFilter(QString("*.m3u|Playlist (*.m3u)"));
dlg->setWindowTitle(i18n("Save playlist"));
if (dlg->exec() != KFileDialog::Accepted)
{
delete dlg;
return;
}
QString filename = dlg->selectedFile();
if (!filename.isEmpty())
{
QFile file(filename);
if (file.open(QIODevice::WriteOnly|QIODevice::Text))
{
QTextStream out(&file);
KUrl::List playlistFiles = m_SoundFilesListBox->fileUrls();
for (int i = 0; i < playlistFiles.count(); ++i)
{
KUrl fUrl(playlistFiles.at(i));
if (fUrl.isValid())
{
if (fUrl.isLocalFile())
{
out << fUrl.toLocalFile() << endl;
}
}
}
file.close();
}
}
delete dlg;
}