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

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

Returns the variant as an int if the variant has type() Int, Bool, ByteArray, Char, Double, LongLong, String, UInt, or ULongLong; 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.

{Warning:} If the value is convertible to a LongLong but is too large to be represented in an int, the resulting arithmetic overflow will not be reflected in ok. A simple workaround is to use QString::toInt(). Fixing this bug has been postponed to Qt 5 in order to avoid breaking existing code.

See also:
canConvert(), convert()

Definition at line 2340 of file qvariant.cpp.

Referenced by Q3Signal::activate(), View::addItems(), QSettings::beginReadArray(), QTreeWidgetItem::childrenCheckState(), QAbstractFormBuilder::computeProperties(), QAbstractFormBuilder::create(), QNetworkAccessManager::createRequest(), QWindowsVistaStyle::drawComplexControl(), QWindowsVistaStyle::drawControl(), QWindowsVistaStyle::drawPrimitive(), QStyledItemDelegate::editorEvent(), QItemDelegate::editorEvent(), QScriptDebuggerCommandExecutor::execute(), QScriptDebuggerAgent::extension(), Window::fillRuleChanged(), Window::firstDayChanged(), QStandardItem::flags(), QStyledItemDelegate::initStyleOption(), QTextFormat::intProperty(), QSortFilterProxyModel::lessThan(), QLocale::measurementSystem(), QTextFormat::objectIndex(), QStandardItem::operator<(), DetailsDialog::orderItems(), QItemDelegate::paint(), PixelDelegate::paint(), QHeaderView::paintSection(), Q3Signal::parameter(), Window::selectionModeChanged(), QScriptBreakpointsModel::setData(), SpinBoxDelegate::setEditorData(), QItemDelegate::setOptions(), and QPrinter::supportedResolutions().

    return qNumVariantToHelper<int>(d, Int, handler, ok, d.data.i);

Generated by  Doxygen 1.6.0   Back to index