[Qt-interest] how to prevent selecting multiple columns in a QTableView
Samuel Gaist
samuel.gaist at edeltech.ch
Thu Oct 28 17:11:39 CEST 2010
On 28 oct. 10, at 17:06, Andy Hirsh wrote:
> 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 ¤t, 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
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
Hello,
You might be interested in looking at:
http://doc.trolltech.com/4.7/qabstractitemview.html#selectionBehavior-prop
and
http://doc.trolltech.com/4.7/qabstractitemview.html#selectionMode-prop
Hope this helps
Samuel
More information about the Qt-interest-old
mailing list