Results 1 to 2 of 2

Thread: How to signal indexChange in a QCombobox cell?

  1. #1
    Join Date
    Sep 2011
    Posts
    24
    Qt products
    Qt4
    Platforms
    Windows

    Default How to signal indexChange in a QCombobox cell?

    Hi,

    I'm using a delegate to QComboBox in table view.How can I emit a signal when user select the item in the combo box?

    Here's the code fragment I'm using.

    QWidget * DelegateComboBox::createEditor( QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index ) const
    {
    if ( index.column() == 1 )
    {
    QComboBox *editor = new QComboBox(parent); //Here the parent is QTableView
    editor->addItem("STRING");
    editor->addItem("INTEGER");
    editor->addItem("DOUBLE");
    return editor;combo.png
    }

    return QItemDelegate::createEditor(parent, option, index);
    }

  2. #2
    Join Date
    Feb 2011
    Location
    Bangalore
    Posts
    207
    Thanks
    20
    Thanked 28 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to signal indexChange in a QCombobox cell?

    QComboBox::currentIndexChanged(index) or QComboBox::currentIndexChanged(const QString &) . But what are you trying to do. Are you trying connect to the signal to save the data? If yes, then use derived QStyleItemDelegate's setModelData function override to set data.

Similar Threads

  1. Weird problem with QComboBox signal
    By flopper in forum Qt Programming
    Replies: 2
    Last Post: 12th March 2011, 12:41
  2. Signal from a ComboBox cell in a QTableWidget
    By thebra in forum Qt Programming
    Replies: 5
    Last Post: 21st October 2008, 08:48
  3. QComboBox activated signal: bad int value?
    By rfdutt in forum Qt Programming
    Replies: 1
    Last Post: 7th April 2008, 23:29
  4. Replies: 3
    Last Post: 8th September 2006, 18:54
  5. send signal from QCombobox
    By raphaelf in forum Qt Programming
    Replies: 22
    Last Post: 28th February 2006, 14: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
  •  
Qt is a trademark of The Qt Company.