Logo Search packages:      
Sourcecode: qt4-x11 version File versions  Download package

int QVariant::toInt ( bool *  ok = 0  )  const

Returns the variant as an int if the variant has type() String, Int, UInt, Double, Bool or KeySequence; otherwise returns 0.

If ok is non-null: {*}{ok} is set to true if the value could be converted to an int; otherwise {*}{ok} is set to false.

See also:

Definition at line 2233 of file qvariant.cpp.

References canConvert().

Referenced by Q3Signal::activate(), QSettings::beginReadArray(), QTreeWidgetItem::childrenCheckState(), QAbstractFormBuilder::computeProperties(), QAbstractFormBuilder::createProperty(), QItemDelegate::editorEvent(), QTextFormat::intProperty(), QSortFilterProxyModel::lessThan(), QTextFormat::objectIndex(), QItemDelegate::paint(), QHeaderView::paintSection(), Q3Signal::parameter(), and QPrinter::supportedResolutions().

    if (d.type == Int) {
        if (ok)
            *ok = true;
        return d.data.i;

    bool c = canConvert(Int);
    if (ok)
        *ok = c;
    int res = 0;
    if (c)
        handler->convert(&d, Int, &res, ok);

    return res;

Generated by  Doxygen 1.6.0   Back to index