Solved Singal is no longer transmitted when QComboBox index is changed
-
Hey, I have a question. My singal from the QListView is no longer submitted when I change my QComboBox index.
Do I still have to set a signal on the QComboBox here?
In my constructor of mainwindow.cpp I have following signal:
connect(ui->fungusList->selectionModel(), &QItemSelectionModel::currentChanged, this, &MainWindow::onCurrentChanged);
It works until I change the index in a QComboBox and another model is loaded to QListView.
-
You probably have to set up another connection after you change the model. From the documentation:
"Note that, if you call setModel() after this function, the given selectionModel will be replaced by one created by the view."
-
@Gabber can you please describe how your view is set up? What is the relation between the selection, what is fungusList (I assume some view?) and so on?
-
@Gabber said in Singal is no longer transmitted when QComboBox index is changed:
It works until I change the index in a QComboBox and another model is loaded to QListView.
Because when you set a new model, also a new selection model is created. You have to connect() to the new model then.
-
Thanks for all your help. @mchinand tip was the solution. Thanks!