PDA

View Full Version : QLineEdit Problem



newermind
14th August 2009, 17:05
I want to that; when i one clicked into qlineedit, automaticlly lineedit`s text is selected .


How can I do that ?

caduel
14th August 2009, 17:44
if life was easy:



QLineEdit *le=...;
connect(le, SIGNAL(clicked()), le, SLOT(selectAll()));


but, alas, QLineEdit has no such signal...
so, you will need to intercept mouse-clicks (using an event filter, or if you subclass the QLineEdit in some of its event handling functions) and then call selectAll()

HTH

lyuts
18th August 2009, 14:14
Try to look at


void QWidget::focusInEvent ( QFocusEvent * event )

and


void setFocusPolicy ( Qt::FocusPolicy policy )