本文整理汇总了C++中QMap::constEnd方法的典型用法代码示例。如果您正苦于以下问题:C++ QMap::constEnd方法的具体用法?C++ QMap::constEnd怎么用?C++ QMap::constEnd使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QMap
的用法示例。
在下文中一共展示了QMap::constEnd方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: applyElement
QDomElement Reference::applyElement( const QDomElement &context ) const
{
kDebug() <<"Reference::applyElement()" << toString() <<"Context:"
<< context.tagName();
QDomElement result = context;
if ( mSegments.count() == 1 && lastSegment().name() == "." ) return result;
Reference::Segment::List::ConstIterator it;
for( it = mSegments.constBegin(); it != mSegments.constEnd(); ++it ) {
Reference::Segment segment = *it;
// kDebug() <<" Segment:" << segment.toString() <<"Count:" <<
// segment.count();
QMap<QString, int> counts;
QDomNode n;
for( n = result.firstChild(); !n.isNull(); n = n.nextSibling() ) {
QDomElement e = n.toElement();
// kDebug() <<" E:" << e.tagName();
int count = 1;
QMap<QString, int>::ConstIterator itCount = counts.constFind( e.tagName() );
if ( itCount != counts.constEnd() ) count = itCount.value();
// kDebug() <<" COUNT:" << count;
if ( e.tagName() == segment.name() && count == segment.count() ) {
result = e;
break;
}
counts.insert( e.tagName(), ++count );
}
if ( n.isNull() ) {
kError() <<"Reference::apply(): Unable to find element '" <<
segment.toString() << "'";
return QDomElement();
}
}
return result;
}
示例2: slotFindVersionsForPackageFinished
void DsWidget::slotFindVersionsForPackageFinished(QNetworkReply* reply)
{
QUrl replyUrl = reply->url();
if (reply->error())
{
kWarning() << "Download of " << replyUrl.toEncoded().constData() << "failed: " << qPrintable(reply->errorString());
}
else
{
QByteArray ba = reply->readAll();
bool ok;
QJson::Parser jsonParser;
QVariant versionSuggestions = jsonParser.parse(ba, &ok);
if (ok)
{
kDebug() << "Query " << replyUrl.toEncoded().constData() << "succeeded";
QMap<QString, QVariant> versions = versionSuggestions.toMap();
QMap<QString, QVariant>::const_iterator i = versions.constBegin();
while (i != versions.constEnd())
{
m_versionsComboBox->addItem(i.value().toString());
++i;
}
m_versionsComboBox->setEnabled(true);
if( versions.size() == 1 )
{
m_descriptionLineEdit->setEnabled(true);
slotEnableUpload();
}
}
else
{
kDebug() << "Query " << replyUrl.toEncoded().constData() << "failed";
}
}
reply->deleteLater();
}
示例3: addBaseActionToRuleWidget
void ComplexActionDialog::addBaseActionToRuleWidget(QTreeWidgetItem *parent
, QString const &name, QMap<QString, QString> const &disabledProperties
, const int &repeatCountValue
, const bool &isKeyActionValue
, const Duration &durationValue
, QTreeWidgetItem *topLevelParent
)
{
QTreeWidgetItem *ruleItem = nullptr;
if (parent == nullptr) {
ruleItem = new QTreeWidgetItem(ui->ruleTreeWidget);
} else {
ruleItem = new QTreeWidgetItem(parent);
}
if (ruleItem) {
QMap<QString, QString> mapProperties;
QMap<QString, QStringList> properties = mBaseUserActions.propertiesByBaseUserActionName(name);
QMap<QString, QStringList>::const_iterator i = properties.constBegin();
QString ruleProperties = " — ";
while (i != properties.constEnd()) {
QStringList const values = i.value();
QString value = (!values.isEmpty()) ? values.at(0) : "";
if (disabledProperties.keys().contains(i.key())) {
value = disabledProperties.value(i.key());
}
mapProperties.insert(i.key(), value);
ruleProperties += i.key() + ": " + value + "|";
++i;
}
QTreeWidgetItem *topLevelParentItem = new QTreeWidgetItem();
if (topLevelParent == nullptr) {
topLevelParentItem = ruleItem;
}
else {
topLevelParentItem = topLevelParent;
}
mWidgetItemCustomPropertyList.append(new WidgetItemCustomProperty(topLevelParentItem, ruleItem, mapProperties
, repeatCountValue, isKeyActionValue, durationValue));
mDisabledProperties.insert(ruleItem, disabledProperties);
int column = 0;
ruleItem->setText(column, name + ruleProperties);
}
}
示例4: kpi
PluginPreferences::PluginPreferences(QWidget* parent)
: ConfigPage(nullptr, nullptr, parent)
{
QVBoxLayout* lay = new QVBoxLayout(this );
selector = new KPluginSelector( this );
lay->addWidget( selector );
QMap<QString, QList<KPluginInfo>> plugins;
const QMap<QString, QString> categories = {
{ "Core", i18nc("@title:group", "Core") },
{ "Project Management", i18nc("@title:group", "Project Management") },
{ "Version Control", i18nc("@title:group", "Version Control") },
{ "Utilities", i18nc("@title:group", "Utilities") },
{ "Documentation", i18nc("@title:group", "Documentation") },
{ "Language Support", i18nc("@title:group", "Language Support") },
{ "Debugging", i18nc("@title:group", "Debugging") },
{ "Testing", i18nc("@title:group", "Testing") },
{ "Other", i18nc("@title:group", "Other") }
};
foreach (const KPluginMetaData& info, Core::self()->pluginControllerInternal()->allPluginInfos()) {
const QString loadMode = info.value(QStringLiteral("X-KDevelop-LoadMode"));
if( loadMode.isEmpty() || loadMode == QLatin1String("UserSelectable") )
{
QString category = info.category();
if (!categories.contains(category)) {
if (!category.isEmpty()) {
qWarning() << "unknown category for plugin" << info.name() << ":" << info.category();
}
category = QStringLiteral("Other");
}
KPluginInfo kpi(info);
kpi.setPluginEnabled(Core::self()->pluginControllerInternal()->isEnabled(info));
plugins[category] << kpi;
} else
qDebug() << "skipping..." << info.pluginId() << info.value(QStringLiteral("X-KDevelop-Category")) << loadMode;
}
for (auto it = plugins.constBegin(), end = plugins.constEnd(); it != end; ++it) {
selector->addPlugins(it.value(), KPluginSelector::ReadConfigFile,
categories.value(it.key()), it.key(),
Core::self()->activeSession()->config() );
}
connect(selector, &KPluginSelector::changed, this, &PluginPreferences::changed);
selector->load();
}
示例5: on_Button_Find_clicked
void Emulator_Options_Window::on_Button_Find_clicked()
{
if( ui.Edit_Path_to_Dir->text().isEmpty() )
{
AQGraphic_Warning( tr("Error!"), tr("Path is Empty!") );
return;
}
QDir dir = QDir( ui.Edit_Path_to_Dir->text() );
if( ! dir.exists() )
{
AQGraphic_Warning( tr("Warning"), tr("Path doesn't exist!") );
return;
}
// Set Type and Bin files
QMap<QString, QString> list;
list = System_Info::Find_QEMU_Binary_Files( ui.Edit_Path_to_Dir->text() );
// Clear old bin files
ui.Table_Systems->clearContents();
while( ui.Table_Systems->rowCount() > 0 ) ui.Table_Systems->removeRow( 0 );
// Add bin files to Table_Systems
QMap<QString, QString>::const_iterator iter = list.constBegin();
while( iter != list.constEnd() )
{
ui.Table_Systems->insertRow( ui.Table_Systems->rowCount() );
QTableWidgetItem *newItem = new QTableWidgetItem( iter.key() );
ui.Table_Systems->setItem( ui.Table_Systems->rowCount()-1, 0, newItem );
newItem = new QTableWidgetItem( QDir::toNativeSeparators(iter.value()) );
ui.Table_Systems->setItem( ui.Table_Systems->rowCount()-1, 1, newItem );
++iter; // next value
}
// Update emulator info
Update_Info = true;
Update_Emulator();
Update_Info = false;
}
示例6: addActions
void KPlayerTrackActionList::addActions (const QMap<int, QString>& ids, int id)
{
QMap<int, QString>::ConstIterator iterator (ids.constBegin()), end (ids.constEnd());
while ( iterator != end )
{
QString text (languageName (iterator.key(), iterator.value()));
#ifdef DEBUG_KPLAYER_ACTIONLIST
kdDebugTime() << " Stream " << iterator.key() << " " << iterator.value() << " " << text << "\n";
#endif
KToggleAction* action = new KToggleAction (m_action_group);
connect (action, SIGNAL (triggered()), SLOT (actionActivated()));
action -> setText (text);
updateAction (action);
if ( id == iterator.key() )
action -> setChecked (true);
m_actions.append (action);
++ iterator;
}
}
示例7: configFile
bool AppearanceGTK2::loadSettings(const QString& path)
{
QFile configFile(path);
bool canRead = configFile.open(QIODevice::ReadOnly | QIODevice::Text);
if(canRead) {
// qDebug() << "The gtk2 config file exists...";
const QMap<QString, QString> foundSettings = readSettingsTuples(&configFile);
m_settings = QMap<QString, QString> {
{"toolbar_style", "GTK_TOOLBAR_ICONS"},
{"show_icons_buttons", "0"},
{"show_icons_menus", "0"},
{"primary_button_warps_slider", "false"}
};
for(auto it = foundSettings.constBegin(), itEnd = foundSettings.constEnd(); it!=itEnd; ++it) {
if (it.key() == "gtk-theme-name")
m_settings["theme"] = *it;
else if (it.key() == "gtk-icon-theme-name")
m_settings["icon"] = *it;
else if (it.key() == "gtk-fallback-icon-theme")
m_settings["icon_fallback"] = *it;
else if (it.key() == "gtk-cursor-theme-name")
m_settings["cursor"] = *it;
else if (it.key() == "gtk-font-name")
m_settings["font"] = *it;
else if (it.key() == "gtk-toolbar-style")
m_settings["toolbar_style"] = *it;
else if (it.key() == "gtk-button-images")
m_settings["show_icons_buttons"] = *it;
else if(it.key() == "gtk-menu-images")
m_settings["show_icons_menus"] = *it;
else if (it.key() == "gtk-primary-button-warps-slider")
m_settings["primary_button_warps_slider"] = *it;
else
qWarning() << "unknown field" << it.key();
}
}
return canRead;
}
示例8: loadData
void ItemView::loadData(QMap<quint32, Item> data)
{
itemTable->setRowCount(data.size());
quint32 row = 0;
QMap<quint32, Item>::const_iterator i = data.constBegin();
while (i != data.constEnd())
{
itemTable->setItem(row, 0, newEntry(i.value().getName()));
itemTable->setItem(row, 1, newEntry(QString::number(i.value().getID())));
itemTable->setItem(row, 2, newEntry(i.value().availableText()));
itemTable->setItem(row, 3, newEntry(i.value().getDateAdded().toString(Qt::SystemLocaleShortDate)));
++row;
++i;
}
// itemTable->resizeColumnsToContents();
}
示例9: setup
void QgsVectorLayerSaveAsDialog::setup()
{
setupUi( this );
QSettings settings;
restoreGeometry( settings.value( "/Windows/VectorLayerSaveAs/geometry" ).toByteArray() );
QMap<QString, QString> map = QgsVectorFileWriter::ogrDriverList();
mFormatComboBox->blockSignals( true );
for ( QMap< QString, QString>::const_iterator it = map.constBegin(); it != map.constEnd(); ++it )
{
mFormatComboBox->addItem( it.key(), it.value() );
}
QString format = settings.value( "/UI/lastVectorFormat", "ESRI Shapefile" ).toString();
mFormatComboBox->setCurrentIndex( mFormatComboBox->findData( format ) );
mFormatComboBox->blockSignals( false );
mEncodingComboBox->addItems( QgsVectorDataProvider::availableEncodings() );
QString enc = settings.value( "/UI/encoding", "System" ).toString();
int idx = mEncodingComboBox->findText( enc );
if ( idx < 0 )
{
mEncodingComboBox->insertItem( 0, enc );
idx = 0;
}
mCRSSelection->clear();
mCRSSelection->addItems( QStringList() << tr( "Layer CRS" ) << tr( "Project CRS" ) << tr( "Selected CRS" ) );
QgsCoordinateReferenceSystem srs( mCRS, QgsCoordinateReferenceSystem::InternalCrsId );
leCRS->setText( srs.description() );
mEncodingComboBox->setCurrentIndex( idx );
on_mFormatComboBox_currentIndexChanged( mFormatComboBox->currentIndex() );
//symbology export combo box
mSymbologyExportComboBox->addItem( tr( "No symbology" ), QgsVectorFileWriter::NoSymbology );
mSymbologyExportComboBox->addItem( tr( "Feature symbology" ), QgsVectorFileWriter::FeatureSymbology );
mSymbologyExportComboBox->addItem( tr( "Symbol layer symbology" ), QgsVectorFileWriter::SymbolLayerSymbology );
on_mSymbologyExportComboBox_currentIndexChanged( mSymbologyExportComboBox->currentText() );
mOptionsButton->setChecked( settings.value( "/UI/vectorLayerSaveAsOptionsVisible" ).toBool() );
}
示例10:
Upnp::Device::MusicTrack::MusicTrack(const QMap<QString, QString> &values, Item *p, int r)
: Upnp::Device::Item(values["title"], p, r)
{
isBroadcast=QLatin1String(constBroadcastClass)==values["class"];
url=values["res"];
artist=values["artist"];
albumArtist=values["albumArtist"];
creator=values["creator"];
album=values["album"];
genre=values["genre"];
track=values["originalTrackNumber"].toUInt();
artUrl=values["albumArtURI"];
if (!isBroadcast && !name.isEmpty() && artist.isEmpty() && album.isEmpty() && 0==track && genre.isEmpty() && creator.isEmpty()) {
isBroadcast=true;
}
if (artUrl.isEmpty()) {
artUrl=Core::Images::self()->constDefaultImage;
}
if (values["date"].contains("-")) {
year=values["date"].split("-").first().toUInt();
}
date=values["date"];
duration=0;
if (values.contains("res.duration")) {
QStringList parts=values["res.duration"].split(":");
if (!parts.isEmpty()) {
quint16 multiple=1;
for (int i=parts.size()-1; i>=0; --i) {
duration+=parts.at(i).toDouble()*multiple;
multiple*=60;
}
}
}
QMap<QString, QString>::ConstIterator it=values.constBegin();
QMap<QString, QString>::ConstIterator end=values.constEnd();
QString resKey=QLatin1String("res.");
for (; it!=end; ++it) {
if (it.key().startsWith(resKey)) {
res.insert(it.key().mid(4), it.value());
}
}
}
示例11: populateSignalList
void ConnectDialog::populateSignalList()
{
QString selectedName;
if (const QListWidgetItem *item = m_ui.signalList->currentItem())
selectedName = item->text();
m_ui.signalList->clear();
QMap<QString, QString> memberToClassName = getSignals(m_formWindow->core(), m_source, showAllSignalsSlots());
QFont font = QApplication::font();
font.setItalic(true);
QVariant variantFont = QVariant::fromValue(font);
QListWidgetItem *curr = 0;
QMap<QString, QString>::ConstIterator itMember = memberToClassName.constBegin();
const QMap<QString, QString>::ConstIterator itMemberEnd = memberToClassName.constEnd();
while (itMember != itMemberEnd) {
const QString member = itMember.key();
const bool qt3Signal = isQt3Signal(m_formWindow->core(), m_source, member);
QListWidgetItem *item = new QListWidgetItem(m_ui.signalList);
item->setText(member);
if (!selectedName.isEmpty() && member == selectedName)
curr = item;
if (qt3Signal) {
item->setData(Qt::FontRole, variantFont);
item->setData(Qt::ForegroundRole, Qt::red);
}
++itMember;
}
if (curr) {
m_ui.signalList->setCurrentItem(curr);
} else {
selectedName.clear();
}
populateSlotList(selectedName);
if (!curr)
m_ui.slotList->setEnabled(false);
}
示例12: addAttributes
bool QgsVectorDataProvider::addAttributes( const QMap<QString, QString> &attributes )
{
const QList< NativeType > &types = nativeTypes();
QList< QgsField > list;
for ( QMap<QString, QString>::const_iterator it = attributes.constBegin(); it != attributes.constEnd(); it++ )
{
int i;
for ( i = 0; i < types.size() && types[i].mTypeName != it.value(); i++ )
;
if ( i == types.size() )
return false;
list << QgsField( it.key(), types[i].mType, it.value() );
}
return addAttributes( list );
}
示例13: setDefaultTextCharFormats
void ConfigAppearanceWidget::setDefaultTextCharFormats(const QMap<QString, QTextCharFormat> &defaultFormatList)
{
for (int i = 0; i < defaultFormatList.size(); ++i)
{
m_itemColors << "";
m_itemFonts << "";
}
QMap<QString, QTextCharFormat>::const_iterator it = defaultFormatList.constBegin();
int num;
while (it != defaultFormatList.constEnd())
{
num = m_typeNames.indexOf(it.key());
if (num < 0) continue;
m_itemColors[num] = it.value().foreground().color().name();
m_itemFonts[num] = it.value().font().toString();
++it;
}
}
示例14: mapiNamedTagString
QString mapiNamedTagString( int key, int tag )
{
if ( MAPI_NamedTagMap.count() == 0 ) {
for ( int i=0; MAPI_NamedTagStrings[ i ].str; i++ ) {
MAPI_NamedTagMap[ MAPI_NamedTagStrings[ i ].tag ] =
i18n( MAPI_NamedTagStrings[ i ].str );
}
}
QMap<int,QString>::ConstIterator it = MAPI_NamedTagMap.constFind( key );
if ( it == MAPI_NamedTagMap.constEnd() ) {
if ( tag >= 0 ) {
return QString().sprintf( "0x%04X [0x%04X]: ", tag, key ) + *it;
} else {
return QString().sprintf( "0x%04X ________:", key ) + *it;
}
} else {
return *it;
}
}
示例15: convertTo
void SymbolNode::convertTo(QStandardItem *item, bool recursive) const
{
if (!item)
return;
QMap<SymbolInfo, SymbolNode::Ptr> map;
qDebug("---");
// convert to map - to sort it
ConstChildIterator curHash =
m_childList.constBegin();
ConstChildIterator endHash =
m_childList.constEnd();
while (curHash != endHash) {
qDebug() << curHash.key().name() << curHash.key().type();
map.insert(curHash.key(), curHash.value());
++curHash;
}
// add to item
QMap<SymbolInfo, SymbolNode::Ptr>::const_iterator cur = map.constBegin();
QMap<SymbolInfo, SymbolNode::Ptr>::const_iterator end = map.constEnd();
while (cur != end) {
const SymbolInfo &inf = cur.key();
SymbolNode::Ptr ptr = cur.value();
QStandardItem *add = new QStandardItem();
AtlasUtils::setSymbolInformationToItem(inf, add);
if (!ptr.isNull()) {
// icon
//add->setIcon(ptr->icon());
// locations
//add->setData(AtlasUtils::locationsToRole(ptr->symbolLocations),
// ClassViewConstants::SymbolLocationsRole);
if (recursive)
cur.value()->convertTo(add, true);
}
item->appendRow(add);
++cur;
}
}