QSpinBox перемещает курсор после последнего существующего символаC++

Программы на C++. Форум разработчиков
Гость
QSpinBox перемещает курсор после последнего существующего символа

Сообщение Гость »


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()); } 
Anyone see any solution here?

Edit:

[ 0] -> click -> [ I0] (current)

[ 0] -> click -> [ 0I] (desired)


Источник: https://stackoverflow.com/questions/403 ... -character

Вернуться в «C++»