Important: Please read the Qt Code of Conduct -

How to control the text truncation in QComboBox?

  • Hello All,

    I have a quick question about text truncation behavior in QComboBox in Pyqt on Windows.
    I don't know why, but the middle part of my texts are truncated like ABCDEF....XYZ.
    Is it possible to achieve something like ...ABCDEFGHIJK(not middle) or ABCDEFGHIJK(ignore longer part).

    First, I thought QComboBox should have setElideText function but there's no such function.

    Many thanks in advance for your help.

  • That is just a QListView you can use combo.view().setTextElideMode() or set your own delegate on it to paint as you want it

  • Thanks for an update, @VRonin !
    Wow, I didn't know that.
    Now everything is fine!!


Log in to reply