void DiagramTypeDialog::Private::subtypeChanged( int index ) { const DiagramTypeDialog::DiagramType type = static_cast< DiagramTypeDialog::DiagramType >( ui.typeSelector->itemData( ui.typeSelector->currentIndex() ).toInt() ); switch ( type ) { case( DiagramTypeDialog::Bar ): case( DiagramTypeDialog::LyingBar ): { BarDiagram *bar = qobject_cast< BarDiagram* >( m_planes[ type ]->diagram() ); Q_ASSERT( bar ); bar->setType( static_cast< BarDiagram::BarType >( index ) ); m_typemap[ type ] = static_cast< DiagramTypeDialog::Subtype >( index ); break; } case( DiagramTypeDialog::Line ): { LineDiagram *line = qobject_cast< LineDiagram* >( m_planes[ type ]->diagram() ); Q_ASSERT( line ); line->setType( static_cast< LineDiagram::LineType >( index ) ); m_typemap[ type ] = static_cast< DiagramTypeDialog::Subtype >( index ); break; break; } case( DiagramTypeDialog::Pie ): break; default: Q_ASSERT( false ); } }
/** * Creates an exact copy of this diagram. */ LineDiagram * LineDiagram::clone() const { LineDiagram* newDiagram = new LineDiagram( new Private( *d ) ); newDiagram->setType( type() ); return newDiagram; }