Forum
Sign Up
× DataGrid for Qt.C++

Bug of bandedtable view?

11 years 10 months ago #1 by corrado valeri
Bug of bandedtable view? was created by corrado valeri
I implemented a bandedTableView in order to manage complex informations.
If I click on a cell, I can get the Cell text with this code:
void Window::cellButtonClicked(CellButtonClickEventArgs* args)
{
    Qtitan::GridTableView* view = m_grid->view<Qtitan::GridTableView>();
    int row = args->row()->rowIndex();
    int col = args->column()->index();
    QVariant s = view->model()->data(view->model()->index(row,col),Qt::DisplayRole);
    QMessageBox::information(this, tr("Cell button clicked (new)"), 
                             tr("Clicked: Button - %1, Column Title - %2, RowIndex - %3 Data displayrole: %4").arg(args->buttonIndex()).arg(args->column()->caption()).arg(args->row()->rowIndex())
                             .arg(s.toString()));
}

Well, if I click on a column header to sort the datamodel, the code previuos quoted doesn't work any more..
The data returned are always referred to the UNSORTED datamodel.

Another problem: recently I see that answers from the official support are missing, there are old topics still without support answers: should I be worried?

thanks

Please Log in or Create an account to join the conversation.

  • corrado valeri
  • corrado valeri's Avatar Topic Author
11 years 10 months ago #2 by Developer Machines
The row in event's argument CellButtonClickEventArgs is a row of the grid (sorted, as you see on the screen). Not in model. To get row index in model related to this grid’s row please use GridRow::modelRowIndex().
In your case:
int row = args->row()->modelRowIndex();

Please Log in or Create an account to join the conversation.

More
11 years 10 months ago #3 by corrado valeri
Replied by corrado valeri on topic Bug of bandedtable view?
that works, thanks :)

Please Log in or Create an account to join the conversation.

  • corrado valeri
  • corrado valeri's Avatar Topic Author
  • Not Allowed: to create new topic.
  • Not Allowed: to reply.
  • Not Allowed: to edit your message.
Moderators: Developer Machines
Time to create page: 0.123 seconds

Developer Newsletter

Join our Developer Machines newsletter to get informed on all the latest releases of the commercial components for Qt.C++, Delphi FireMonkey, updates and general knowledges.

Quick Support

Should you need any additional information about our products or licensing, please contact us at the following email addresses:

  • support@devmachines.com

  • license@devmachines.com

Get in Touch

If you would like to purchase our products or services, but don’t know how to do it the right way, please feel free to contact us:

  • support@devmachines.com( any questions related to our products or services )
  • license@devmachines.com( questions related to licensing )