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. QCombobox intercept selection
Qt 6.11 is out! See what's new in the release blog

QCombobox intercept selection

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 948 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
    seasoned_geek
    wrote on last edited by
    #1

    All,

    This should be simple, but I've been digging through the code and it looks nearly impossible to do without completely rewriting QCombobox.

    What needs to happen: When user selects entry from list in combo box that index needs to be captured and stopped from updating. An interprocess message (not a signal) needs to go out with the value associated with the index. If the external process deems it is ok to use that value at the moment it will send some other interprocess message back at some point and the application will update the QCombobox display from that.

    So far the documentation and examples have been quite useless in solving this problem. I dug through the QCombobox code and it "looks" like this is burried in QComboboxprivate.

    The closest thing I can think of is to create a custom QAbstractItemView, assign it to the combobox, then override the mousePressEvent(QMouseEvent *event) but I'm having trouble finding examples on-line.

    Can someone point me to an example of a creating a custom QAbstractitemView and using it with QCombobox?

    I usually try to avoid going this deep into dismembering built in functionality but cannot avoid it this time.

    Thanks in advance.
    Roland

    1 Reply Last reply
    0
    • S Offline
      S Offline
      Seamus Boyle
      wrote on last edited by
      #2

      Why don't you filter the combo to only show valid options?
      @QSortFilterProxyModel@

      1 Reply Last reply
      0
      • S Offline
        S Offline
        seasoned_geek
        wrote on last edited by
        #3

        All of them are valid. It's a display requirement to only show the values after they have taken effect. Some have quite a bit of work, others do not.

        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