[Qt-interest] how to prevent selecting multiple columns in a QTableView

Andy Hirsh andhirsh at gmail.com
Thu Oct 28 17:06:12 CEST 2010


Dear listener,

 is there a way to prevent the user from selecting multiple columns
in a table ?

 I've try intercepting the currentColumnChanged() signal of the
selection model this way:

-------------
 ...
 connect(selectionmodel, SIGNAL(currentColumnChanged(
const
QModelIndex, const QModelIndex)),
                              this,
SLOT(currentSelectionColumnChangedSLO(const QModelIndex, const
QModelIndex)));
 ...

  void NPenMapModel::currentSelectionColumnChangedSLO(const
QModelIndex &current, const QModelIndex &previous)
  {
     selectionmodel->select(previous,
QItemSelectionModel::Current|QItemSelectionModel::Deselect|QItemSelectionModel::Columns);
  }

------------

 but with no success

 any idea will be appreciated :D

   thanks a lot,

            Andy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20101028/bf922dc5/attachment.html 


More information about the Qt-interest-old mailing list