[PyQt] [pyqt]Replace a character in qlineedit from a dictionary(Qcompleter?)

Maurizio Berti maurizio.berti at gmail.com
Tue Sep 11 04:29:02 BST 2018


2018-09-11 3:37 GMT+02:00 Maziar Parsijani <maziar.parsijani at gmail.com>:

> Awesome, thanks!
> Dear Maurizio
> I have to say every time I looked for it but I couldn't find popup.setfont
> I don't know why but it seems it appears after you said that.
>

Sometimes it happens :-)

Anyway, remember that the GUI side of Qt, like almost any other GUI
framework, is always "widget"-based. Everything you see is a widget, which
itself can contain other widgets in different ways, like QComboBox that
uses a QLineEdit when it's editable, and a QListView for its popup, which,
in turn, contains a QScrollBar, which again contains itself abstract
buttons used to scroll up and down.
QCompleter is a bit of a special case, because it is not a widget, but
"installs" itself automatically on an editor like QLineEdit when the
PopupCompletion flag is set and it actually is a very basic and uneditable
QListView, without scrollbars and single row/item selection mode set.
That's why you can do to it almost anything you would do to any other
widget, including changing its font, palette, etc.. In fact, you can
customize it as you would do for any subclass of QAbstractItemView, or
create your own custom item view and set it using setPopup(). This can be
very handy as you can manipulate the view or the model to create advanced
versions of the popup, such as showing icons, change text alignment and
visualization, or even set a custom ItemDelegate and show any kind of
content, including graphics and animations.

Good luck! :-)

Maurizio

-- 
È difficile avere una convinzione precisa quando si parla delle ragioni del
cuore. - "Sostiene Pereira", Antonio Tabucchi
http://www.jidesk.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20180911/31a67e9c/attachment.html>


More information about the PyQt mailing list