QlineEdit selectAll doesn't work?
<p>I use folowing code. In it <code>lineEdit-&gt;selectAll()</code> works called by pushButton and <strong>only</strong> at first launch called by <code>eventFilter</code>. Although <code>label-&gt;setText</code> works all time propperly. Why?</p>

<pre><code>Widget::Widget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Widget)
{
    ui-&gt;setupUi(this);
    ui-&gt;lineEdit-&gt;installEventFilter(this);
}

void Widget::on_pushButton_clicked()
{
    ui-&gt;lineEdit-&gt;selectAll();
}

bool Widget::eventFilter(QObject *object, QEvent *event)
{
    if (object == ui-&gt;lineEdit &amp;&amp; event-&gt;type() == QEvent::FocusIn )
    {
        ui-&gt;lineEdit-&gt;selectAll();
        ui-&gt;label-&gt;setText("Focused!");
        return false;
    }
    if (object == ui-&gt;lineEdit &amp;&amp; event-&gt;type() == QEvent::FocusOut )
    {
        ui-&gt;label-&gt;setText("unFucused!");
        return false;
    }
    return false;
}
</code></pre>

<p>UPD: Did what <strong>Ilya</strong> recomended. Still have same problem.</p>

<pre><code>void myLine::focusInEvent(QFocusEvent* event)
{
    setText("Focused!");
    selectAll();
}

void myLine::focusOutEvent(QFocusEvent* event)
{
    setText("UnFocused!");
}
</code></pre>