Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to control the text truncation in QComboBox?

How to control the text truncation in QComboBox?

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 1.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    ShinSat
    wrote on last edited by
    #1

    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.
    Regards,
    Sat

    1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by VRonin
      #2

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

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      S 1 Reply Last reply
      4
      • VRoninV VRonin

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

        S Offline
        S Offline
        ShinSat
        wrote on last edited by
        #3

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

        Sat

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved