Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
- {
- MiTabla *tabla = new MiTabla;
- tabla->setModel(new MiModelo());
- tabla->setItemDelegate(new MiDelegado());
- selectionModel = tabla->selectionModel();
- setCentralWidget(tabla);
- QObject::connect(selectionModel,&QItemSelectionModel::selectionChanged,[=]()
- {
- foreach (const QModelIndex& item, selectionModel->selectedIndexes())
- {
- if (item.column()!=tabla->indiceActual().column())
- {
- selectionModel->select(item,QItemSelectionModel::Deselect);
- }
- }
- });
- }
- MiTabla::MiTabla()
- {
- miSelectionModel = selectionModel();
- QObject::connect(this,SIGNAL(pressed(QModelIndex)),this,SLOT(CambiarIndiceACtual(QModelIndex)));
- QObject::connect(miSelectionModel,&QItemSelectionModel::selectionChanged,[=]()
- {
- foreach (const QModelIndex& item, miSelectionModel->selectedIndexes())
- {
- if (item.column()!=m_indiceActual.column())
- {
- miSelectionModel->select(item,QItemSelectionModel::Deselect);
- }
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement