Custom Input: QLineEdit
-
wrote on 20 Aug 2019, 19:39 last edited by
Looking inside Qt Creator IDE -> Tools -> Options -> Build & Run -> General Tab:
There is a "Default build directory" input field.When I click inside this field, it shows me a "AB" icon on the right side.
And if I click in this icon, I got a list window with some options...I would like to know how can I implement this QLineEdit component with this "right icon" feature.
-
Hi,
Might be QLineEdit::addAction.
Otherwise, you can take a look at Qt Creator's sources for that field.
-
Hi,
Might be QLineEdit::addAction.
Otherwise, you can take a look at Qt Creator's sources for that field.
wrote on 2 Sept 2019, 19:57 last edited by@sgaist that's right! Thank you!
QLineEdit *myLineEdit = new QLineEdit(this); QAction *myAction = myLineEdit->addAction(QIcon("test.png"), QLineEdit::TrailingPosition); connect(myAction, &QAction::triggered, this, &MyClass::onActionTriggered);