Пример #1
0
void DiagramSettings::refreshSettings()
{
    if ( d->m_chart && d->m_chart->coordinatePlane() && d->m_chart->coordinatePlane()->diagram() )
    {
        BarDiagram *bars = qobject_cast< BarDiagram* >( d->m_chart->coordinatePlane()->diagram() );
        LineDiagram *lines = qobject_cast< LineDiagram* >( d->m_chart->coordinatePlane()->diagram() );
        PieDiagram *pie = qobject_cast< PieDiagram* >( d->m_chart->coordinatePlane()->diagram() );

        if ( bars )
        {
            const AbstractThreeDAttributes &td = bars->threeDBarAttributes();
            d->setThreeDData( td );
        }
        else if ( lines )
        {
            const AbstractThreeDAttributes &td = lines->threeDLineAttributes();
            d->setThreeDData( td );
        }
        else if ( pie )
        {
            const AbstractThreeDAttributes &td = pie->threeDPieAttributes();
            d->setThreeDData( td );
        }
        BackgroundAttributes bat = d->m_chart->coordinatePlane()->backgroundAttributes();
        QBrush setBrush = bat.brush();
        QPalette palette = d->ui->diagramBackground->palette();
        if ( bat.isVisible() )
            palette.setBrush( QPalette::Button, setBrush );
        else
            palette.setBrush( QPalette::Button, this->palette().brush( QPalette::Button ) );
        d->ui->diagramBackground->setPalette( palette );
    }
}
Пример #2
0
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 );
    }
}
Пример #3
0
void KReportChartView::setLineWidth(const int lineWidth)
{
  if (qobject_cast<LineDiagram*>(coordinatePlane()->diagram())) {
    LineDiagram* lineDiagram = qobject_cast<LineDiagram*>(coordinatePlane()->diagram());
    const int currentCols = m_model.columnCount();
    const int currentRows = m_model.rowCount();
    for (int col = 0; col < currentCols; ++col) {
      for (int row = 0; row < currentRows; ++row) {
        QPen pen(lineDiagram->pen(m_model.index(row, col, QModelIndex())));
        pen.setWidth(lineWidth);
        lineDiagram->setPen(m_model.index(row, col, QModelIndex()), pen);
      }
    }
  }
}
Пример #4
0
void DiagramSettings::Private::changeThreeD()
{
    if ( m_chart && m_chart->coordinatePlane() && m_chart->coordinatePlane()->diagram() )
    {
        BarDiagram *bars = qobject_cast< BarDiagram* >( m_chart->coordinatePlane()->diagram() );
        LineDiagram *lines = qobject_cast< LineDiagram* >( m_chart->coordinatePlane()->diagram() );
        PieDiagram *pie = qobject_cast< PieDiagram* >( m_chart->coordinatePlane()->diagram() );
        if ( bars )
        {
            ThreeDBarAttributes td( bars->threeDBarAttributes() );
            td.setEnabled( ui->threeDSelector->checkState() == Qt::Checked );
            td.setUseShadowColors( true );
            td.setDepth( ui->barHeightInput->value() );
            td.setThreeDBrushEnabled( ui->autoGradient->checkState() == Qt::Checked );
            bars->setThreeDBarAttributes( td );
            m_chart->update();
        }
        else if ( lines )
        {
            ThreeDLineAttributes td( lines->threeDLineAttributes() );
            td.setEnabled( ui->threeDSelector->checkState() == Qt::Checked );
            td.setDepth( ui->barHeightInput->value() );
            td.setThreeDBrushEnabled( ui->autoGradient->checkState() == Qt::Checked );
            lines->setThreeDLineAttributes( td );
            m_chart->update();
        }
        else if ( pie )
        {
            ThreeDPieAttributes td( pie->threeDPieAttributes() );
            td.setEnabled( ui->threeDSelector->checkState() == Qt::Checked );
            td.setDepth( ui->barHeightInput->value() );
            td.setThreeDBrushEnabled( ui->autoGradient->checkState() == Qt::Checked );
            pie->setThreeDPieAttributes( td );
            m_chart->update();
        }
    }
}
/**
  * Creates an exact copy of this diagram.
  */
LineDiagram * LineDiagram::clone() const
{
    LineDiagram* newDiagram = new LineDiagram( new Private( *d ) );
    newDiagram->setType( type() );
    return newDiagram;
}