kchart

kchartWizardSelectDataFormatPage.cc

00001 
00002 #include "kchartWizardSelectDataFormatPage.h"
00003 #include "kchart_view.h"
00004 #include "kchart_part.h"
00005 
00006 #include <qhbox.h>
00007 #include <qcheckbox.h>
00008 #include <qlayout.h>
00009 #include <qlabel.h>
00010 #include <qlineedit.h>
00011 #include <qlistbox.h>
00012 #include <qbuttongroup.h>
00013 #include <qvbuttongroup.h>
00014 #include <qpushbutton.h>
00015 #include <qradiobutton.h>
00016 #include <qlineedit.h>
00017 #include <qpainter.h>
00018 
00019 #include <kdebug.h>
00020 #include <kiconloader.h>
00021 #include <kglobal.h>
00022 #include <klocale.h>
00023 #include <kdialog.h>
00024 
00025 #include "kchart_params.h"
00026 
00027 namespace KChart
00028 {
00029 
00030 KChartWizardSelectDataFormatPage::KChartWizardSelectDataFormatPage( QWidget* parent,
00031                                                                         KChartPart* chart ) :
00032   QWidget( parent ),
00033   m_chart( chart )
00034 {
00035     QGridLayout *grid1 = new QGridLayout(this, 6, 1, KDialog::marginHint(),
00036                      KDialog::spacingHint());
00037 
00038     // The Data Area
00039     QButtonGroup *gb1 = new QVButtonGroup( i18n( "Data Area" ), this );
00040 
00041     QHBox   *hbox = new QHBox( gb1 );
00042     (void) new QLabel( i18n("Area: "), hbox);
00043     m_dataArea = new QLineEdit( hbox );
00044     grid1->addWidget(gb1, 0, 0);
00045 
00046     // The row/column as label checkboxes. 
00047     m_firstRowAsLabel = new QCheckBox( i18n( "First row as label" ), gb1);
00048     m_firstColAsLabel = new QCheckBox( i18n( "First column as label" ), gb1);
00049 
00050     // The Data Format button group
00051     QButtonGroup *gb = new QVButtonGroup( i18n( "Data Format" ), this );
00052 
00053     m_rowMajor = new QRadioButton( i18n( "Data in rows" ), gb );
00054     m_rowMajor->resize( m_rowMajor->sizeHint() );
00055 
00056     m_colMajor = new QRadioButton( i18n( "Data in columns" ), gb );
00057     m_colMajor->resize( m_colMajor->sizeHint() );
00058 
00059     grid1->addWidget(gb, 3, 0);
00060 
00061     QLabel *lbl = new QLabel( i18n( 
00062         "\n"
00063     "If the selected data area does not match the data you want,\n"
00064     "select the data now.\n"
00065     "\n"
00066     "Include cells that you want to use as row and column labels,\n"
00067     "if you want them in the chart.\n"
00068     ), this);
00069     grid1->addWidget(lbl, 4, 0);
00070 
00071     grid1->setColStretch(5, 0);
00072 
00073     grid1->activate();
00074 
00075     if ( m_chart->params()->dataDirection() == KChartParams::DataColumns)
00076       m_colMajor->setChecked(true);
00077     else
00078       m_rowMajor->setChecked(true);
00079 }
00080 
00081 
00082 QString KChartWizardSelectDataFormatPage::dataArea() const
00083 {
00084     return m_dataArea->text();
00085 }
00086 
00087 void KChartWizardSelectDataFormatPage::setDataArea( const QString &area )
00088 {
00089     m_dataArea->setText( area );
00090 }
00091 
00092 
00093 void KChartWizardSelectDataFormatPage::apply()
00094 {
00095     if (m_rowMajor->isChecked())
00096       m_chart->params()->setDataDirection( KChartParams::DataRows );
00097     else
00098       m_chart->params()->setDataDirection( KChartParams::DataColumns );
00099 
00100     m_chart->params()->setFirstRowAsLabel( m_firstRowAsLabel->isChecked() );
00101     m_chart->params()->setFirstColAsLabel( m_firstColAsLabel->isChecked() );
00102 }
00103 
00104 
00105 }  //KChart namespace
00106 
00107 #include "kchartWizardSelectDataFormatPage.moc"
KDE Home | KDE Accessibility Home | Description of Access Keys