-
Bug
-
Resolution: Done
-
P1: Critical
-
4.6.3, 4.7.0, 4.7.1
-
None
-
81351f2c6f9a939e4c34cb3be6280d396c21941f
Cursor position is not updated visually on the QLineEdit using Left and Right arrow keys with a Qwerty keypad. I have found this issue on N97 and S^3 devices. So when a text say 123456* where (* = cursor) is typed on the QLineEdit and use the left arrow key, cursor position still stays at 123456*. Again press left arrow key and cursor position is changed to 12345*6 but the actual cursor pos should have been at 1234*56 and now on pressing backspace, it deletes 4 and so on. So it seems like the cursor positon is not updated correctly. I have tried a very simple example for this as below.
.h
—
#include <QMainWindow>
#include <QLabel>
#include <QLineEdit>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
private slots:
void slotCursorPositionChanged(int,int);
private:
Ui::MainWindow *ui;
QLabel*label1;
QLabel*label2;
QLineEdit* q;
};
.cpp
#include "mainwindow.h" #include "ui_mainwindow.h" #include <QDebug> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); q=new QLineEdit(this); q->setGeometry(50,50,100,50); connect(q,SIGNAL(cursorPositionChanged(int,int)),SLOT(slotCursorPositionChanged(int,int))); label1=new QLabel(this); label1->setGeometry(50,100,100,50); } void MainWindow::slotCursorPositionChanged(int a,int b) { qDebug() << "cursorPos" << a << " " << b; label1->setText(QString("Old:%1 New:%2").arg(a).arg(b)); q->setCursorPosition(b); q->update(); } MainWindow::~MainWindow() { delete ui; }