Qt community,

David, thanks that definitely seems to be heading in a promising direction.

It does create a challenge though. The model that I am using for my QTableView inherits from QAbstractTableModel. Your proposal appears to require that I change my model to instead inherit from QStandardItemModel, cotrrect? It is this change of inheritance that appears to be creating issues with an existing call to <...Model>::index(int row,int column, const QModelIndex & parent = QModelndex() ) const in my existing code.

In my existing call I do not pass a parent argument and therefore use the default. This worked fine when the call was ultimately to QAbstractTableModel::index(...) but appears to be returning an invalid index (-1,-1) when the call ends up calling QStandardItemModel::index(...). I am certainly willing to pass an explicit parent argument, but am not sure how to generate a valid parent.

As always any help would be appreciated please.  Thanks again.

Sincerely,
Carl

On 4/25/2012 11:55 PM, David Boosalis wrote:
Here is an example with a QTreeView, it should work for QTableView.


 _model = new ModelItemModel(this);
  setModel(_model);
  for(int i=0;i<NumColumns;i++) {
    headerItem[i] = new QStandardItem(headerLabel[i]);
    _model->setHorizontalHeaderItem(i,headerItem[i]);
    headerItem[i]->setToolTip(headerToolTips[i]);
  }

The above code is not complete, but I think you get the picture

-David

On Wed, Apr 25, 2012 at 2:38 PM, Carl Schumann <schum...@fnal.gov <mailto:schum...@fnal.gov>> wrote:

    Qt community,

    I would like to add tool tips to the column headings of a QTableView
    instance.   Is there a way to do this please?   I see that I can get a
    QHeaderView and add a tool tip to it but that would be for the
    whole set
    of headings not one tool tip for each heading, if I understand things
    correctly.    Thanks for any help please.

    Sincerely,
    Carl Schumann
    _______________________________________________
    Interest mailing list
    Interest@qt-project.org <mailto:Interest@qt-project.org>
    http://lists.qt-project.org/mailman/listinfo/interest



_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to