示例#1
0
QPoint KConfigBase::readPointEntry(const QString &pKey, const QPoint *pDefault) const
{
    return readPointEntry(pKey.utf8().data(), pDefault);
}
示例#2
0
文件: common.cpp 项目: sr105/kdiff3
QPoint      ValueMap::readEntry(const QString& s, const QPoint defaultVal ){ return readPointEntry(s,&defaultVal); }
示例#3
0
QVariant KConfigBase::readPropertyEntry(const char *pKey, const QVariant &aDefault) const
{
    if(!hasKey(pKey))
        return aDefault;

    QVariant tmp = aDefault;

    switch(aDefault.type())
    {
        case QVariant::Invalid:
            return QVariant();
        case QVariant::String:
            return QVariant(readEntry(pKey, aDefault.toString()));
        case QVariant::StringList:
            return QVariant(readListEntry(pKey));
        case QVariant::List:
        {
            QStringList strList = readListEntry(pKey);
            QStringList::ConstIterator it = strList.begin();
            QStringList::ConstIterator end = strList.end();
            QValueList< QVariant > list;

            for(; it != end; ++it)
            {
                tmp = *it;
                list.append(tmp);
            }
            return QVariant(list);
        }
        case QVariant::Font:
            return QVariant(readFontEntry(pKey, &tmp.asFont()));
        case QVariant::Point:
            return QVariant(readPointEntry(pKey, &tmp.asPoint()));
        case QVariant::Rect:
            return QVariant(readRectEntry(pKey, &tmp.asRect()));
        case QVariant::Size:
            return QVariant(readSizeEntry(pKey, &tmp.asSize()));
        case QVariant::Color:
            return QVariant(readColorEntry(pKey, &tmp.asColor()));
        case QVariant::Int:
            return QVariant(readNumEntry(pKey, aDefault.toInt()));
        case QVariant::UInt:
            return QVariant(readUnsignedNumEntry(pKey, aDefault.toUInt()));
        case QVariant::LongLong:
            return QVariant(readNum64Entry(pKey, aDefault.toLongLong()));
        case QVariant::ULongLong:
            return QVariant(readUnsignedNum64Entry(pKey, aDefault.toULongLong()));
        case QVariant::Bool:
            return QVariant(readBoolEntry(pKey, aDefault.toBool()), 0);
        case QVariant::Double:
            return QVariant(readDoubleNumEntry(pKey, aDefault.toDouble()));
        case QVariant::DateTime:
            return QVariant(readDateTimeEntry(pKey, &tmp.asDateTime()));
        case QVariant::Date:
            return QVariant(readDateTimeEntry(pKey, &tmp.asDateTime()).date());

        case QVariant::Pixmap:
        case QVariant::Image:
        case QVariant::Brush:
        case QVariant::Palette:
        case QVariant::ColorGroup:
        case QVariant::Map:
        case QVariant::IconSet:
        case QVariant::CString:
        case QVariant::PointArray:
        case QVariant::Region:
        case QVariant::Bitmap:
        case QVariant::Cursor:
        case QVariant::SizePolicy:
        case QVariant::Time:
        case QVariant::ByteArray:
        case QVariant::BitArray:
        case QVariant::KeySequence:
        case QVariant::Pen:
            break;
    }

    Q_ASSERT(0);
    return QVariant();
}