[Interest] Making a "popup" QLineEdit

Etienne Sandré-Chardonnal etienne.sandre at m4x.org
Mon Oct 21 20:14:07 CEST 2013


I tried that, creation and positioning works. But I cannot manage to set
the focus on the created widget, setFocus() does nothing as the widget is a
window. I'ts quite annoying for the user experience that the QLineEdit does
not pop with focus.

Etienne

Le vendredi 18 octobre 2013, André Somers a écrit :
>
> Try popping up a QLineEdit with parent set to 0, and call this on it:
>  myLineEdit->setWindowFlags(Qt::ToolTip | Qt::Window);
>
> You can also play around with other window flags of course. Obviously, you
> will need to position the line edit before showing, relative to the widget
> it is connected to. Take care that the coordinate system of a widget with a
> parent is relative to its parent, while that of a a widget without a parent
> is the global coordinate system. So, use QWidget::mapToGlobal from your
> widget-that-needs-to-show-a-popup-line-edit to get its global coordinates.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20131021/e6b3ad2b/attachment.html>


More information about the Interest mailing list