I would like to create a simple file retrieval widget that has within it a QLineEditand a QPushButton within a QHBoxLayout. When a user clicks on the QPushButton, it opens a QFileDialog to find a file whose path gets placed into the QLineEdit.

Normally, I would just sub-class QWidget as MyFileLineEdit and give it the QLineEdit and QPushButton as children, but functionally it's basically a QLineEdit with extra features and I would like it to interface like one (particularly with Qt Designer via promotion).

Is there a way to do this without manually connecting all of QLineEdit's signals and slots in MyFileLineEdit? I have tried to inherit directly from QLineEdit, but I can't figure out how to insert the QPushButton next to it.