QString bin_str("10101010");QString dec_str;bool ok;int dec = str.toInt(&ok,2);if (ok) dec_str.setNum(dec);