kchart
kchartDataConfigPage.cc00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "kchartDataConfigPage.h"
00021
00022 #include "kchartDataConfigPage.moc"
00023
00024 #include <kapplication.h>
00025 #include <klocale.h>
00026 #include <kcolorbutton.h>
00027 #include <kdebug.h>
00028
00029 #include <qhbox.h>
00030 #include <qlayout.h>
00031 #include <qlabel.h>
00032 #include <qlineedit.h>
00033 #include <qlistbox.h>
00034 #include <qbuttongroup.h>
00035 #include <qvbuttongroup.h>
00036 #include <qpushbutton.h>
00037 #include <qradiobutton.h>
00038 #include <qcheckbox.h>
00039 #include <qpainter.h>
00040 #include <qwhatsthis.h>
00041
00042 #include <kfontdialog.h>
00043
00044
00045 namespace std {}
00046
00047 using namespace std;
00048
00049 #include "kchart_params.h"
00050 #include "kchart_part.h"
00051
00052 namespace KChart
00053 {
00054
00055 KChartDataConfigPage::KChartDataConfigPage( KChartParams* params,
00056 QWidget* parent,
00057 KDChartTableData *dat)
00058 : QWidget( parent ), m_params( params ), data(dat)
00059 {
00060 QGridLayout *grid1 = new QGridLayout(this, 4, 1, KDialog::marginHint(),
00061 KDialog::spacingHint());
00062
00063
00064 QButtonGroup *gb1 = new QVButtonGroup( i18n( "Data Area" ), this );
00065
00066
00067
00068 QHBox *hbox = new QHBox( gb1 );
00069 (void) new QLabel( i18n("Area: "), hbox);
00070 m_dataArea = new QLineEdit( hbox );
00071
00072
00073
00074 m_firstRowAsLabel = new QCheckBox( i18n( "First row as label" ), gb1);
00075 m_firstColAsLabel = new QCheckBox( i18n( "First column as label" ), gb1);
00076
00077 grid1->addWidget(gb1, 0, 0);
00078
00079
00080 QButtonGroup *gb = new QVButtonGroup( i18n( "Data Format" ), this );
00081
00082 m_rowMajor = new QRadioButton( i18n( "Data in rows" ), gb );
00083 m_rowMajor->resize( m_rowMajor->sizeHint() );
00084
00085 m_colMajor = new QRadioButton( i18n( "Data in columns" ), gb );
00086 m_colMajor->resize( m_colMajor->sizeHint() );
00087
00088 grid1->addWidget(gb, 2, 0);
00089
00090 QWhatsThis::add(this, i18n("This configuration page can be used to swap the interpretation of rows and columns."));
00091 QWhatsThis::add(m_rowMajor, i18n("By default one row is considered to be a data set and each column holds the individual values of the data series. This sets the data in rows on your chart."));
00092
00093 QWhatsThis::add(m_colMajor, i18n("Here you can choose to have each column hold one data set. Note that the values are not really swapped but only their interpretation."));
00094 m_colMajor->resize( m_colMajor->sizeHint() );
00095 grid1->addWidget(gb, 1, 0);
00096 grid1->setColStretch(3, 0);
00097
00098 grid1->activate();
00099 }
00100
00101
00102 void KChartDataConfigPage::init()
00103 {
00104 if (m_params->dataDirection() == KChartParams::DataRows)
00105 m_rowMajor->setChecked(true);
00106 else
00107 m_colMajor->setChecked(true);
00108
00109 m_firstRowAsLabel->setChecked( m_params->firstRowAsLabel() );
00110 m_firstColAsLabel->setChecked( m_params->firstColAsLabel() );
00111 }
00112
00113
00114 void KChartDataConfigPage::defaults()
00115 {
00116 m_colMajor->setChecked( true );
00117 m_firstRowAsLabel->setChecked( false );
00118 m_firstColAsLabel->setChecked( false );
00119 }
00120
00121
00122 void KChartDataConfigPage::apply()
00123 {
00124 if (m_rowMajor->isChecked())
00125 m_params->setDataDirection( KChartParams::DataRows );
00126 else
00127 m_params->setDataDirection( KChartParams::DataColumns );
00128
00129 m_params->setFirstRowAsLabel( m_firstRowAsLabel->isChecked() );
00130 m_params->setFirstColAsLabel( m_firstColAsLabel->isChecked() );
00131 }
00132
00133
00134 }
|