Plain Edit text "" return int from Qstring"
Unsolved
General and Desktop
-
Hi Qties !! im trying to change the Variable "a" from PlainTextEdit !! but it's doent work
any suggestions please ?if (ui.bitwiseAND->isChecked()) { int a ; QString g = ui.plainTextEdit_2->toPlainText(); a = g.toInt(); medianBlur(HidedSrc, Mblurred, a); namedWindow("Mblurred", WINDOW_NORMAL); }
-
Hi,
What does
ui.plainTextEdit_2
contain ? -
And you are expecting
toInt
to return what if your string is empty ? -
toInt
has a boolean parameter that you can use to validate that the conversion was successful.On a related note, if you want to have an numerical input there, why not use something more appropriate like a QSpinBox ? That way you don't even have to deal with conversion.