[Interest] Making a "popup" QLineEdit
André Somers
andre at familiesomers.nl
Tue Oct 22 10:45:05 CEST 2013
Op 21-10-2013 20:14, Etienne Sandré-Chardonnal schreef:
> 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.
>
You're looking for the activateWindow method...
André
--
You like Qt?
I am looking for collegues to join me at i-Optics!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20131022/5e0d1ae6/attachment.html>
More information about the Interest
mailing list