Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QLineEdit with Custom QComboBox



  • Hi guys i am pretty new to Qt and now trying to make a simple dictionary application and i wanted to customize the QLineEdit with QComboBox inside like u get a search box with magnifier icon and down arrow right next to it and u can choose from the options right inside the QLineEdit. The idea seems easy to realize as i inherited QLineEdit and used a new QComboBox inside and i managed to get QComboBox inside the QLine edit with magnifier or any icons but the problem is the down arrow of QComboBox cant be set closer to the icons like almost overlaps little bit from left small down arrow i tries different styleSheet stuffs but still the distance between down arrow and the icon is not changed... Any suggestions will be appreciated..



  • I don't know exactly what you want, but could a editable QComboBox be a solution for you?

    Another guess might be to use the input widget in the locator of Qt Creator. I don't know if it is available as a more or less standalone widget.



  • @Volker: I guess he needs an autofill textbox.

    you could use same combobox and make it appear like textbox using style http://developer.qt.nokia.com/forums/viewthread/3150

    then you can design a combo box with your theme by placing a button to expand combo box where ever you want.



  • thanks for the replies but the thing is i want like a input box with icon and down arrow before the input itself where one can click the arrow next to the icon and choose different options to search like hmm english or other alternative languages



  • Can you show us a picture, of what you want to achieve? that would make it clearer...



  • Here i am attaching the link where it shows a simple iTunes search box. As u see it has magnifier glass with drop down options to search. So that is almost what i want to do if that is realizable in Qt. Thanks Guys :)!http://lifehacker.com/246006/add-search-keyboard-shortcut-to-itunes-on-your-mac()!



  • This is what Qt Creator uses in its locator on the bottom. Maybe it's not too hard to extract it from its sources.



  • It's a customized QLineEdit with a QCompleter with QCompleter::PopupCompletion.


Log in to reply