I have a few things for a QLineEdit's QCompleter I'm interested in customizing. I want to make it behave similar to the address / search bar in Chrome.
- How can I limit the number of rows that are displayed? For example, even if there are 15 matches, I only want the QCompleter to show 5.
- How can I resize the popup window? For example, I want to make the popup window nice and snug. As per the above example, I want the popup window to resize to 5 rows exactly without any showing any ugly scroll bars.
- How can I move the popup window? For example, I want to adjust the vertical position of the popup window so that it's slightly below the parent widget.
- How can I format the shown popup window's list items? For example, I want to bold the part of the word that is matching.
popup.width() - popup.viewport().width()
), the width of the frame (2 * popup.frameWidth()
), and the width of the longest string (popup.fontMetrics().boundingRect(string).width()
).QRect
to QCompleter.complete.