Results 1 to 2 of 2

Thread: Send custom Signal when QComboBox item/index is changed

  1. #1
    Join Date
    Nov 2019
    Location
    Lyon, France
    Posts
    15
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Send custom Signal when QComboBox item/index is changed

    Hi!

    I have a quick question, and didn't find a clear answer anywhere.

    Basically, the user can click on a button that add/remove a QComboBox on the screen. All the combobox have the same items, and none are different from another. I create my own custom class based on the original QCombobox, and add an ID number.

    My question is: is it possible to override the signal send when the selected item in the combobox is changed?
    I want to connect my combobox to a slot, and when the user select a particular item in it, be able to print something like "The combobox number 3 has changed!".
    Well, I want to do more than that, but that's the basic idea.

    I already did the same thing with custom QButton (by overriding the MouseReleaseEvent()), but here I need to use QComboBox and don't see how to reproduce it.

  2. #2
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,528
    Thanked 279 Times in 274 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Send custom Signal when QComboBox item/index is changed

    Read about QObject::sender and QSignalMapper. You can apply one of these solutions.

Similar Threads

  1. Replies: 5
    Last Post: 12th October 2015, 00:51
  2. Replies: 15
    Last Post: 18th September 2015, 15:35
  3. Index (position) changed on saving with QTableView
    By Auryn in forum Qt Programming
    Replies: 2
    Last Post: 22nd July 2008, 09:15
  4. Catch item changed
    By nina1983 in forum Qt Programming
    Replies: 2
    Last Post: 18th July 2008, 15:40
  5. send signal from QCombobox
    By raphaelf in forum Qt Programming
    Replies: 22
    Last Post: 28th February 2006, 15:18

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.