Signal to connect qtableview with combobox



  • Hi,

    I want to connect my qtableview made with QStandardItemModel with a combobox. Which Signal from Qtableview or Model need to use?

    Many Thanks



  • Probably need more explanation.

    I want this, everytime that somebody click on a cell reproduce that value in the combobox



  • Finally I do something like this:

    connect(ui->myTableView,SIGNAL(clicked(QModelIndex)),this,SLOT(DoSomething(QModelIndex)));

    This is not what I wanted, but it is an intermediate solution.

    Because if for example I have two buttons (up and down) that are move the current position on the table, that definition of connect does not work. I will have to create another connect.

    It would be easier something like this:

    connect (model, SIGNAL (currentindex), this, DoSomething (currentindex))



  • Editing with a combobox ? try QStyledItemDelegate.



  • connect(ui->myTableView->selectionModel(),&QItemSelectionModel::currentChanged,[this](const QModelIndex& idx){if(idx.isValid()) ui->comboBox->setCurrentIndex(idx.row());});


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.