Op 18-10-2013 14:05, Etienne Sandré-Chardonnal schreef:
Dear all,

I want to do the following GUI element : a QLineEdit which popups when some control is clicked, allowing the user for text input, and which hides when enter is pressed, or when the user clicks outside the QLineEdit.

How can this be implemented? In other words, I'm looking for an undecorated floating widget (modal?) and getting an event when the user clicked outside.

Thanks,

Etienne
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.

André

--
You like Qt?
I am looking for collegues to join me at i-Optics!

_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to