tools/shared/qtpropertybrowser/qtpropertymanager.cpp
changeset 37 758a864f9613
parent 18 2f34d5167611
equal deleted inserted replaced
36:ef0373b55136 37:758a864f9613
  2397 {
  2397 {
  2398     const QtLocalePropertyManagerPrivate::PropertyValueMap::const_iterator it = d_ptr->m_values.constFind(property);
  2398     const QtLocalePropertyManagerPrivate::PropertyValueMap::const_iterator it = d_ptr->m_values.constFind(property);
  2399     if (it == d_ptr->m_values.constEnd())
  2399     if (it == d_ptr->m_values.constEnd())
  2400         return QString();
  2400         return QString();
  2401 
  2401 
  2402     QLocale loc = it.value();
  2402     const QLocale loc = it.value();
  2403 
  2403 
  2404     int langIdx = 0;
  2404     int langIdx = 0;
  2405     int countryIdx = 0;
  2405     int countryIdx = 0;
  2406     metaEnumProvider()->localeToIndex(loc.language(), loc.country(), &langIdx, &countryIdx);
  2406     const QtMetaEnumProvider *me = metaEnumProvider();
  2407     QString str = tr("%1, %2")
  2407     me->localeToIndex(loc.language(), loc.country(), &langIdx, &countryIdx);
  2408             .arg(metaEnumProvider()->languageEnumNames().at(langIdx))
  2408     if (langIdx < 0) {
  2409             .arg(metaEnumProvider()->countryEnumNames(loc.language()).at(countryIdx));
  2409         qWarning("QtLocalePropertyManager::valueText: Unknown language %d", loc.language());
  2410     return str;
  2410         return tr("<Invalid>");
       
  2411     }
       
  2412     const QString languageName = me->languageEnumNames().at(langIdx);
       
  2413     if (countryIdx < 0) {
       
  2414         qWarning("QtLocalePropertyManager::valueText: Unknown country %d for %s", loc.country(), qPrintable(languageName));
       
  2415         return languageName;
       
  2416     }
       
  2417     const QString countryName = me->countryEnumNames(loc.language()).at(countryIdx);
       
  2418     return tr("%1, %2").arg(languageName, countryName);
  2411 }
  2419 }
  2412 
  2420 
  2413 /*!
  2421 /*!
  2414     \fn void QtLocalePropertyManager::setValue(QtProperty *property, const QLocale &value)
  2422     \fn void QtLocalePropertyManager::setValue(QtProperty *property, const QLocale &value)
  2415 
  2423 
  2633 {
  2641 {
  2634     const QtPointPropertyManagerPrivate::PropertyValueMap::const_iterator it = d_ptr->m_values.constFind(property);
  2642     const QtPointPropertyManagerPrivate::PropertyValueMap::const_iterator it = d_ptr->m_values.constFind(property);
  2635     if (it == d_ptr->m_values.constEnd())
  2643     if (it == d_ptr->m_values.constEnd())
  2636         return QString();
  2644         return QString();
  2637     const QPoint v = it.value();
  2645     const QPoint v = it.value();
  2638     return QString(tr("(%1, %2)").arg(QString::number(v.x()))
  2646     return tr("(%1, %2)").arg(QString::number(v.x()))
  2639                                  .arg(QString::number(v.y())));
  2647                          .arg(QString::number(v.y()));
  2640 }
  2648 }
  2641 
  2649 
  2642 /*!
  2650 /*!
  2643     \fn void QtPointPropertyManager::setValue(QtProperty *property, const QPoint &value)
  2651     \fn void QtPointPropertyManager::setValue(QtProperty *property, const QPoint &value)
  2644 
  2652 
  2874     const QtPointFPropertyManagerPrivate::PropertyValueMap::const_iterator it = d_ptr->m_values.constFind(property);
  2882     const QtPointFPropertyManagerPrivate::PropertyValueMap::const_iterator it = d_ptr->m_values.constFind(property);
  2875     if (it == d_ptr->m_values.constEnd())
  2883     if (it == d_ptr->m_values.constEnd())
  2876         return QString();
  2884         return QString();
  2877     const QPointF v = it.value().val;
  2885     const QPointF v = it.value().val;
  2878     const int dec =  it.value().decimals;
  2886     const int dec =  it.value().decimals;
  2879     return QString(tr("(%1, %2)").arg(QString::number(v.x(), 'f', dec))
  2887     return tr("(%1, %2)").arg(QString::number(v.x(), 'f', dec))
  2880                                  .arg(QString::number(v.y(), 'f', dec)));
  2888                          .arg(QString::number(v.y(), 'f', dec));
  2881 }
  2889 }
  2882 
  2890 
  2883 /*!
  2891 /*!
  2884     \fn void QtPointFPropertyManager::setValue(QtProperty *property, const QPointF &value)
  2892     \fn void QtPointFPropertyManager::setValue(QtProperty *property, const QPointF &value)
  2885 
  2893 
  3194 {
  3202 {
  3195     const QtSizePropertyManagerPrivate::PropertyValueMap::const_iterator it = d_ptr->m_values.constFind(property);
  3203     const QtSizePropertyManagerPrivate::PropertyValueMap::const_iterator it = d_ptr->m_values.constFind(property);
  3196     if (it == d_ptr->m_values.constEnd())
  3204     if (it == d_ptr->m_values.constEnd())
  3197         return QString();
  3205         return QString();
  3198     const QSize v = it.value().val;
  3206     const QSize v = it.value().val;
  3199     return QString(tr("%1 x %2").arg(QString::number(v.width()))
  3207     return tr("%1 x %2").arg(QString::number(v.width()))
  3200                                 .arg(QString::number(v.height())));
  3208                         .arg(QString::number(v.height()));
  3201 }
  3209 }
  3202 
  3210 
  3203 /*!
  3211 /*!
  3204     \fn void QtSizePropertyManager::setValue(QtProperty *property, const QSize &value)
  3212     \fn void QtSizePropertyManager::setValue(QtProperty *property, const QSize &value)
  3205 
  3213 
  3559     const QtSizeFPropertyManagerPrivate::PropertyValueMap::const_iterator it = d_ptr->m_values.constFind(property);
  3567     const QtSizeFPropertyManagerPrivate::PropertyValueMap::const_iterator it = d_ptr->m_values.constFind(property);
  3560     if (it == d_ptr->m_values.constEnd())
  3568     if (it == d_ptr->m_values.constEnd())
  3561         return QString();
  3569         return QString();
  3562     const QSizeF v = it.value().val;
  3570     const QSizeF v = it.value().val;
  3563     const int dec = it.value().decimals;
  3571     const int dec = it.value().decimals;
  3564     return QString(tr("%1 x %2").arg(QString::number(v.width(), 'f', dec))
  3572     return tr("%1 x %2").arg(QString::number(v.width(), 'f', dec))
  3565                                 .arg(QString::number(v.height(), 'f', dec)));
  3573                         .arg(QString::number(v.height(), 'f', dec));
  3566 }
  3574 }
  3567 
  3575 
  3568 /*!
  3576 /*!
  3569     \fn void QtSizeFPropertyManager::setValue(QtProperty *property, const QSizeF &value)
  3577     \fn void QtSizeFPropertyManager::setValue(QtProperty *property, const QSizeF &value)
  3570 
  3578 
  3952 {
  3960 {
  3953     const QtRectPropertyManagerPrivate::PropertyValueMap::const_iterator it = d_ptr->m_values.constFind(property);
  3961     const QtRectPropertyManagerPrivate::PropertyValueMap::const_iterator it = d_ptr->m_values.constFind(property);
  3954     if (it == d_ptr->m_values.constEnd())
  3962     if (it == d_ptr->m_values.constEnd())
  3955         return QString();
  3963         return QString();
  3956     const QRect v = it.value().val;
  3964     const QRect v = it.value().val;
  3957     return QString(tr("[(%1, %2), %3 x %4]").arg(QString::number(v.x()))
  3965     return tr("[(%1, %2), %3 x %4]").arg(QString::number(v.x()))
  3958                                 .arg(QString::number(v.y()))
  3966                                     .arg(QString::number(v.y()))
  3959                                 .arg(QString::number(v.width()))
  3967                                     .arg(QString::number(v.width()))
  3960                                 .arg(QString::number(v.height())));
  3968                                     .arg(QString::number(v.height()));
  3961 }
  3969 }
  3962 
  3970 
  3963 /*!
  3971 /*!
  3964     \fn void QtRectPropertyManager::setValue(QtProperty *property, const QRect &value)
  3972     \fn void QtRectPropertyManager::setValue(QtProperty *property, const QRect &value)
  3965 
  3973