void MainWindow::setHighlightArea( int row, int column, int opacity, bool checked, bool doUpdate ) { if ( row < 0 ) { // highlight a complete dataset LineAttributes la = m_lines->lineAttributes( column ); if ( checked ) { la.setDisplayArea( true ); la.setTransparency( opacity ); } else { la.setDisplayArea( false ); } m_lines->setLineAttributes( column, la ); } else { // highlight two segments only if ( row ) { QModelIndex cellIndex( m_lines->model()->index( row - 1, column, m_lines->rootIndex() ) ); if ( checked ) { LineAttributes la( m_lines->lineAttributes( cellIndex ) ); la.setDisplayArea( true ); la.setTransparency( 255 - opacity ); // set specific line attribute settings for this cell m_lines->setLineAttributes( cellIndex, la ); } else { // remove any cell-specific line attribute settings // from the indexed cell m_lines->resetLineAttributes( cellIndex ); } } if ( row < m_lines->model()->rowCount(m_lines->rootIndex() ) ) { QModelIndex cellIndex( m_lines->model()->index( row, column, m_lines->rootIndex() ) ); if ( checked ) { LineAttributes la( m_lines->lineAttributes( cellIndex ) ); la.setDisplayArea( true ); la.setTransparency( opacity ); // set specific line attribute settings for this cell m_lines->setLineAttributes( cellIndex, la ); } else { // remove any cell-specific line attribute settings // from the indexed cell m_lines->resetLineAttributes( cellIndex ); } } } if ( doUpdate ) m_chart->update(); }