I have a spinbox with a default 0 in it. After I click on the spinbox the cursor needs to move after the 0 inside the box. The function bellow is not producing any suitable result.
Код: Выделить всё
void CSpinBoxExtra::mousePressEvent(QMouseEvent *event) { if(this -> value() == 0) QSpinBox::lineEdit() -> setCursorPosition(QSpinBox::lineEdit() -> text().length()); } Edit:
[ 0] -> click -> [ I0] (current)
[ 0] -> click -> [ 0I] (desired)
Источник: https://stackoverflow.com/questions/403 ... -character
Мобильная версия