[Development] QOptional

Иван Комиссаров abbapoh at gmail.com
Thu Aug 21 11:13:15 CEST 2014


Of course, i can:)

bool ok;
const int value = string.toInt(&ok);
if (ok)
    qDebug() << "value is" << value;

// ====
const auto value = string.toInt();
if (value)
    qDebug() << "value is" << *value;

Иван Комиссаров

21 авг. 2014 г., в 13:09, Poenitz Andre <Andre.Poenitz at digia.com> написал(а):

Иван Комиссаров [abbapoh at gmail.com] wrote:
>> The goal is to get rid of ugly "int QString::toInt(bool *ok = 0)" functions.
> 
> Can you maybe spell out some code to demonstrate why this is
> ugly, and how the use of QOptional would improve that?
> 
> Andre'
> 



More information about the Development mailing list