diff options
Diffstat (limited to 'kchart/kchartDataEditor.cc')
-rw-r--r-- | kchart/kchartDataEditor.cc | 240 |
1 files changed, 120 insertions, 120 deletions
diff --git a/kchart/kchartDataEditor.cc b/kchart/kchartDataEditor.cc index 57e56d8f..1448343b 100644 --- a/kchart/kchartDataEditor.cc +++ b/kchart/kchartDataEditor.cc @@ -1,13 +1,13 @@ -#include <qcheckbox.h> -#include <qlabel.h> -#include <qspinbox.h> -#include <qlayout.h> -#include <qlineedit.h> -#include <qregexp.h> -#include <qwhatsthis.h> -#include <qtooltip.h> -#include <qvalidator.h> -#include <qpushbutton.h> +#include <tqcheckbox.h> +#include <tqlabel.h> +#include <tqspinbox.h> +#include <tqlayout.h> +#include <tqlineedit.h> +#include <tqregexp.h> +#include <tqwhatsthis.h> +#include <tqtooltip.h> +#include <tqvalidator.h> +#include <tqpushbutton.h> #include <kinputdialog.h> #include <klocale.h> @@ -33,8 +33,8 @@ namespace KChart // We don't provide very much generality, since this spinbox is used // here and here only. // -kchartDataSpinBox::kchartDataSpinBox(QWidget *parent) - : QSpinBox(parent) +kchartDataSpinBox::kchartDataSpinBox(TQWidget *tqparent) + : TQSpinBox(tqparent) { m_ignore = false; } @@ -50,7 +50,7 @@ void kchartDataSpinBox::stepUp() m_ignore = true; uint const new_value = value() + 1; - QSpinBox::stepUp(); + TQSpinBox::stepUp(); setValue(new_value); emit valueChangedSpecial( value() ); @@ -63,7 +63,7 @@ void kchartDataSpinBox::stepDown() m_ignore = true; uint const new_value = value() - 1; - QSpinBox::stepDown(); + TQSpinBox::stepDown(); setValue(new_value); emit valueChangedSpecial( value() ); @@ -71,10 +71,10 @@ void kchartDataSpinBox::stepDown() } -bool kchartDataSpinBox::eventFilter( QObject *obj, QEvent *ev ) +bool kchartDataSpinBox::eventFilter( TQObject *obj, TQEvent *ev ) { - if ( obj == editor() ) { - if ( ev->type() == QEvent::FocusOut ) { + if ( TQT_BASE_OBJECT(obj) == TQT_BASE_OBJECT(editor()) ) { + if ( ev->type() == TQEvent::FocusOut ) { //kdDebug() << "Focus out" << endl; setValue(editor()->text().toInt()); @@ -85,8 +85,8 @@ bool kchartDataSpinBox::eventFilter( QObject *obj, QEvent *ev ) } } - // Pass the event on to the parent class. - return QSpinBox::eventFilter( obj, ev ); + // Pass the event on to the tqparent class. + return TQSpinBox::eventFilter( obj, ev ); } @@ -96,8 +96,8 @@ bool kchartDataSpinBox::eventFilter( QObject *obj, QEvent *ev ) // Used for the keyboard navigation // -kchartDataTable::kchartDataTable(QWidget *parent) - : QTable(parent) +kchartDataTable::kchartDataTable(TQWidget *tqparent) + : TQTable(tqparent) { } @@ -107,14 +107,14 @@ kchartDataTable::~kchartDataTable() } -bool kchartDataTable::eventFilter( QObject *obj, QEvent *ev ) +bool kchartDataTable::eventFilter( TQObject *obj, TQEvent *ev ) { - if (ev->type() == QEvent::KeyPress && strcmp(obj->name(), + if (ev->type() == TQEvent::KeyPress && strcmp(obj->name(), "qt_tableeditor")==0 ) { - QKeyEvent *e = (QKeyEvent *)ev; + TQKeyEvent *e = (TQKeyEvent *)ev; switch ( e->key() ) { - case Qt::Key_Up: + case TQt::Key_Up: { if ( currentRow() > 0 ) { setCurrentCell( currentRow()-1, currentColumn() ); @@ -123,7 +123,7 @@ bool kchartDataTable::eventFilter( QObject *obj, QEvent *ev ) } break; } - case Qt::Key_Down: + case TQt::Key_Down: { if ( currentRow() < numRows()-1 ) { setCurrentCell( currentRow()+1, currentColumn() ); @@ -132,7 +132,7 @@ bool kchartDataTable::eventFilter( QObject *obj, QEvent *ev ) } break; } - case Qt::Key_Right: + case TQt::Key_Right: { if ( currentColumn() < numCols()-1 ) { setCurrentCell( currentRow(), currentColumn()+1 ); @@ -141,7 +141,7 @@ bool kchartDataTable::eventFilter( QObject *obj, QEvent *ev ) } break; } - case Qt::Key_Left: + case TQt::Key_Left: { if ( currentColumn() > 0 ) { setCurrentCell( currentRow(), currentColumn()-1 ); @@ -153,7 +153,7 @@ bool kchartDataTable::eventFilter( QObject *obj, QEvent *ev ) } } - return QTable::eventFilter( obj, ev ); + return TQTable::eventFilter( obj, ev ); } @@ -163,87 +163,87 @@ bool kchartDataTable::eventFilter( QObject *obj, QEvent *ev ) #define COLUMNWIDTH 80 -kchartDataEditor::kchartDataEditor(QWidget* parent) : - KDialogBase(parent, "dataeditor", true, i18n("KChart Data Editor"), +kchartDataEditor::kchartDataEditor(TQWidget* tqparent) : + KDialogBase(tqparent, "dataeditor", true, i18n("KChart Data Editor"), KDialogBase::Ok | KDialogBase::Cancel | KDialogBase::Apply, KDialogBase::Ok, true) { - QWidget *page = new QWidget( this ); + TQWidget *page = new TQWidget( this ); setMainWidget(page); // Create the main table. m_table = new kchartDataTable(page); - m_table->setSelectionMode(QTable::NoSelection); + m_table->setSelectionMode(TQTable::NoSelection); m_table->setFocus(); m_table->setRowMovingEnabled(true); m_table->setColumnMovingEnabled(true); - connect( m_table, SIGNAL( currentChanged(int, int) ), - this, SLOT( currentChanged(int, int) ) ); + connect( m_table, TQT_SIGNAL( currentChanged(int, int) ), + this, TQT_SLOT( currentChanged(int, int) ) ); // Create the Rows setting - m_rowsLA = new QLabel( i18n("# Rows:" ), page ); - m_rowsLA->resize( m_rowsLA->sizeHint() ); + m_rowsLA = new TQLabel( i18n("# Rows:" ), page ); + m_rowsLA->resize( m_rowsLA->tqsizeHint() ); m_rowsSB = new kchartDataSpinBox( page ); - m_rowsSB->resize( m_rowsSB->sizeHint() ); + m_rowsSB->resize( m_rowsSB->tqsizeHint() ); m_rowsSB->setMinValue(1); // Create the columns setting - m_colsLA = new QLabel( i18n("# Columns:" ), page ); - m_colsLA->resize( m_colsLA->sizeHint() ); + m_colsLA = new TQLabel( i18n("# Columns:" ), page ); + m_colsLA->resize( m_colsLA->tqsizeHint() ); m_colsSB = new kchartDataSpinBox( page ); - m_colsSB->resize( m_colsSB->sizeHint() ); + m_colsSB->resize( m_colsSB->tqsizeHint() ); m_colsSB->setMinValue(1); #if 0 // The row/column as label checkboxes. - m_firstRowAsLabel = new QCheckBox( i18n( "First row as label" ), page); - m_firstColAsLabel = new QCheckBox( i18n( "First column as label" ), page); + m_firstRowAsLabel = new TQCheckBox( i18n( "First row as label" ), page); + m_firstColAsLabel = new TQCheckBox( i18n( "First column as label" ), page); #endif // Buttons for Inserting / Removing rows & columns // The icon images are taken from the standard - m_insertRowButton = new QPushButton( page); + m_insertRowButton = new TQPushButton( page); // In 2.0; this is supposed to be just KIcon("name").pixmap(32). - m_insertRowButton->setPixmap( BarIcon( QString("insert_table_row"), + m_insertRowButton->setPixmap( BarIcon( TQString("insert_table_row"), KIcon::SizeMedium, KIcon::DefaultState, KChartFactory::global() ) ); - //m_insertRowButton = new QPushButton( i18n("Insert Row") , page); - connect( m_insertRowButton, SIGNAL( clicked() ), - this, SLOT( insertRow() ) ); + //m_insertRowButton = new TQPushButton( i18n("Insert Row") , page); + connect( m_insertRowButton, TQT_SIGNAL( clicked() ), + this, TQT_SLOT( insertRow() ) ); - m_removeRowButton = new QPushButton( page ); - m_removeRowButton->setPixmap( BarIcon( QString("delete_table_row"), + m_removeRowButton = new TQPushButton( page ); + m_removeRowButton->setPixmap( BarIcon( TQString("delete_table_row"), KIcon::SizeMedium, KIcon::DefaultState, KChartFactory::global() ) ); - //m_removeRowButton = new QPushButton( i18n("Remove Row") , page); - connect( m_removeRowButton, SIGNAL( clicked() ), - this, SLOT( removeCurrentRow() ) ); + //m_removeRowButton = new TQPushButton( i18n("Remove Row") , page); + connect( m_removeRowButton, TQT_SIGNAL( clicked() ), + this, TQT_SLOT( removeCurrentRow() ) ); - m_insertColButton = new QPushButton( page ); - m_insertColButton->setPixmap( BarIcon( QString("insert_table_col"), + m_insertColButton = new TQPushButton( page ); + m_insertColButton->setPixmap( BarIcon( TQString("insert_table_col"), KIcon::SizeMedium, KIcon::DefaultState, KChartFactory::global() ) ); - //m_insertColButton = new QPushButton( i18n("Insert Column") , page); - connect( m_insertColButton, SIGNAL( clicked() ), - this, SLOT( insertColumn() ) ); + //m_insertColButton = new TQPushButton( i18n("Insert Column") , page); + connect( m_insertColButton, TQT_SIGNAL( clicked() ), + this, TQT_SLOT( insertColumn() ) ); - m_removeColButton = new QPushButton( page ); - m_removeColButton->setPixmap( BarIcon( QString("delete_table_col"), + m_removeColButton = new TQPushButton( page ); + m_removeColButton->setPixmap( BarIcon( TQString("delete_table_col"), KIcon::SizeMedium, KIcon::DefaultState, KChartFactory::global() ) ); - //m_removeColButton = new QPushButton( i18n("Remove Column") , page); - connect( m_removeColButton, SIGNAL( clicked() ), - this, SLOT( removeCurrentColumn() ) ); + //m_removeColButton = new TQPushButton( i18n("Remove Column") , page); + connect( m_removeColButton, TQT_SIGNAL( clicked() ), + this, TQT_SLOT( removeCurrentColumn() ) ); - // Start the layout. The buttons are at the top. - QVBoxLayout *topLayout = new QVBoxLayout( page ); + // Start the tqlayout. The buttons are at the top. + TQVBoxLayout *topLayout = new TQVBoxLayout( page ); - QHBoxLayout* insertRemoveLayout = new QHBoxLayout( ); + TQHBoxLayout* insertRemoveLayout = new TQHBoxLayout( ); insertRemoveLayout->setSpacing(5); insertRemoveLayout->addWidget(m_insertRowButton); @@ -259,7 +259,7 @@ kchartDataEditor::kchartDataEditor(QWidget* parent) : topLayout->addWidget(m_table); // Then, a horizontal layer with the rows and columns settings - QHBoxLayout *hbl1 = new QHBoxLayout( ); + TQHBoxLayout *hbl1 = new TQHBoxLayout( ); hbl1->addWidget(m_rowsLA); hbl1->addWidget(m_rowsSB); hbl1->addSpacing(20); @@ -271,7 +271,7 @@ kchartDataEditor::kchartDataEditor(QWidget* parent) : #if 0 // Last, the checkboxes with "First row/column as label" - QHBoxLayout *hbl2 = new QHBoxLayout( ); + TQHBoxLayout *hbl2 = new TQHBoxLayout( ); hbl2->addWidget(m_firstRowAsLabel); hbl2->addWidget(m_firstColAsLabel); hbl2->addStretch(1); @@ -283,24 +283,24 @@ kchartDataEditor::kchartDataEditor(QWidget* parent) : topLayout->setStretchFactor(insertRemoveLayout,1); // Connect signals from the spin boxes. - connect(m_rowsSB, SIGNAL(valueChangedSpecial(int)), - this, SLOT(setRows(int))); - connect(m_colsSB, SIGNAL(valueChangedSpecial(int)), - this, SLOT(setCols(int))); + connect(m_rowsSB, TQT_SIGNAL(valueChangedSpecial(int)), + this, TQT_SLOT(setRows(int))); + connect(m_colsSB, TQT_SIGNAL(valueChangedSpecial(int)), + this, TQT_SLOT(setCols(int))); #if 0 // -- Changed data editor to use top row and leftmost column for // series names and labels so this is no longer necessary. - connect(m_table->horizontalHeader(), SIGNAL(clicked(int)), - this, SLOT(column_clicked(int)) ); - connect(m_table->verticalHeader(), SIGNAL(clicked(int)), - this, SLOT(row_clicked(int)) ); + connect(m_table->horizontalHeader(), TQT_SIGNAL(clicked(int)), + this, TQT_SLOT(column_clicked(int)) ); + connect(m_table->verticalHeader(), TQT_SIGNAL(clicked(int)), + this, TQT_SLOT(row_clicked(int)) ); #endif - connect(m_table, SIGNAL(valueChanged(int, int)), - this, SLOT(tableChanged(int, int)) ); + connect(m_table, TQT_SIGNAL(valueChanged(int, int)), + this, TQT_SLOT(tableChanged(int, int)) ); // At first, assume that any shrinking of the table is a mistake. // A confirmation dialog will make sure that the user knows what @@ -325,24 +325,24 @@ kchartDataEditor::kchartDataEditor(QWidget* parent) : void kchartDataEditor::addDocs() { // The rows settings. - QString rowwhatsthis = i18n("<p><b>Sets the number of rows in the data table." + TQString rowwhatsthis = i18n("<p><b>Sets the number of rows in the data table." "</b><br><br>Each row represents one data set.</p>"); - QToolTip::add(m_rowsSB, i18n("Number of active data rows")); - QWhatsThis::add(m_rowsLA, rowwhatsthis); - QWhatsThis::add(m_rowsSB, rowwhatsthis); + TQToolTip::add(m_rowsSB, i18n("Number of active data rows")); + TQWhatsThis::add(m_rowsLA, rowwhatsthis); + TQWhatsThis::add(m_rowsSB, rowwhatsthis); // The columns settings. - QString colwhatsthis = i18n("<p><b>Sets the number of columns in the data table." + TQString colwhatsthis = i18n("<p><b>Sets the number of columns in the data table." "</b><br><br>The number of columns defines the number of data values in each data set (row).</p>"); - QToolTip::add(m_colsSB, i18n("Number of active data columns")); - QWhatsThis::add(m_colsLA, colwhatsthis); - QWhatsThis::add(m_colsSB, colwhatsthis); + TQToolTip::add(m_colsSB, i18n("Number of active data columns")); + TQWhatsThis::add(m_colsLA, colwhatsthis); + TQWhatsThis::add(m_colsSB, colwhatsthis); // The table. - QToolTip::add(m_table, i18n("Chart data table.")); + TQToolTip::add(m_table, i18n("Chart data table.")); //GUI - //The QWhatsThis information below is incorrect since the way that the contents of the table + //The TQWhatsThis information below is incorrect since the way that the contents of the table //are displayed in the chart depends upon the data format selected (which can be //either "Data in columns" (default) or "Data in rows) //The names of the data sets / axes labels are no longer set by clicking on the table @@ -361,7 +361,7 @@ void kchartDataEditor::addDocs() #if 0 - QWhatsThis::add(m_table, i18n("<p>This table contains the data" + TQWhatsThis::add(m_table, i18n("<p>This table contains the data" " for the chart.<br><br> Each row is one data set of values." " The name of such a data set can be changed in the column header (on the left)" " of the table. In a line diagram each row is one line. In a ring diagram each row" @@ -372,10 +372,10 @@ void kchartDataEditor::addDocs() " column is one ring.</p>")); #endif - QToolTip::add( m_insertRowButton, i18n("Insert row") ); - QToolTip::add( m_removeRowButton, i18n("Delete row") ); - QToolTip::add( m_insertColButton, i18n("Insert column") ); - QToolTip::add( m_removeColButton, i18n("Delete column") ); + TQToolTip::add( m_insertRowButton, i18n("Insert row") ); + TQToolTip::add( m_removeRowButton, i18n("Delete row") ); + TQToolTip::add( m_insertColButton, i18n("Insert column") ); + TQToolTip::add( m_removeColButton, i18n("Delete column") ); } @@ -423,15 +423,15 @@ void kchartDataEditor::setData( KChartParams *params, KDChartTableData *dat ) m_table->setNumCols(colsCount); for (unsigned int row = headerRows(); row < rowsCount; row++) { for (unsigned int col = headerCols(); col < colsCount; col++) { - QVariant t = dat->cellVal(row-headerRows(), col-headerCols()); + TQVariant t = dat->cellVal(row-headerRows(), col-headerCols()); // Fill it in from the part. if (t.isValid()) { - if ( t.type() == QVariant::Double ) { + if ( t.type() == TQVariant::Double ) { m_table->setText(row, col, - QString("%1").arg(t.toDouble())); + TQString("%1").tqarg(t.toDouble())); } - else if ( t.type() == QVariant::String ) + else if ( t.type() == TQVariant::String ) kdDebug(35001) << "I cannot handle strings in the table yet" << endl; else { @@ -486,7 +486,7 @@ void kchartDataEditor::getData( KChartParams *params, KDChartTableData *dat ) for (int col = labelCols ; col < (numCols+labelCols); col++) { // Get the text and convert to double. - QString tmp = m_table->text(row, col); + TQString tmp = m_table->text(row, col); bool bOk; double val = tmp.toDouble( &bOk ); if (!bOk) @@ -506,10 +506,10 @@ void kchartDataEditor::getData( KChartParams *params, KDChartTableData *dat ) // Set the row labels in the data editor. // -void kchartDataEditor::setRowLabels(const QStringList &rowLabels) +void kchartDataEditor::setRowLabels(const TQStringList &rowLabels) { #if 0 - QHeader *rowHeader = m_table->verticalHeader(); + TQHeader *rowHeader = m_table->verticalHeader(); int row; int numRows = m_rowsSB->value(); @@ -542,10 +542,10 @@ int kchartDataEditor::headerCols() // Get the row labels from the data editor. // -void kchartDataEditor::getRowLabels(QStringList &rowLabels) +void kchartDataEditor::getRowLabels(TQStringList &rowLabels) { #if 0 - QHeader *rowHeader = m_table->verticalHeader(); + TQHeader *rowHeader = m_table->verticalHeader(); int numRows = m_rowsSB->value(); int row; @@ -565,10 +565,10 @@ void kchartDataEditor::getRowLabels(QStringList &rowLabels) // Set the column labels in the data editor. // -void kchartDataEditor::setColLabels(const QStringList &colLabels) +void kchartDataEditor::setColLabels(const TQStringList &colLabels) { #if 0 - QHeader *colHeader = m_table->horizontalHeader(); + TQHeader *colHeader = m_table->horizontalHeader(); int col; int numCols = m_colsSB->value(); @@ -592,10 +592,10 @@ void kchartDataEditor::setColLabels(const QStringList &colLabels) // Get the column labels from the data editor. // -void kchartDataEditor::getColLabels(QStringList &colLabels) +void kchartDataEditor::getColLabels(TQStringList &colLabels) { #if 0 - QHeader *colHeader = m_table->horizontalHeader(); + TQHeader *colHeader = m_table->horizontalHeader(); int numCols = m_colsSB->value(); int col; @@ -678,9 +678,9 @@ void kchartDataEditor::insertRow() // Ask user to make sure that (s)he really wants to remove a row or // column. // -static int askUserForConfirmation(QWidget *parent) +static int askUserForConfirmation(TQWidget *tqparent) { - return KMessageBox::warningContinueCancel(parent, + return KMessageBox::warningContinueCancel(tqparent, i18n("You are about to shrink the data table and remove some values. " "This will lead to loss of existing data in the table " "and/or the headers.\n\n" @@ -806,10 +806,10 @@ void kchartDataEditor::setCols(int cols) void kchartDataEditor::column_clicked(int column) { bool ok; - QString name = KInputDialog::getText(i18n("Column Name"), + TQString name = KInputDialog::getText(i18n("Column Name"), i18n("Type a new column name:"), m_table->horizontalHeader()->label(column), - &ok, this, 0, new QRegExpValidator(QRegExp(".*"), this) ); + &ok, this, 0, new TQRegExpValidator(TQRegExp(".*"), this) ); // Rename the column. if ( ok ) { @@ -824,10 +824,10 @@ void kchartDataEditor::column_clicked(int column) void kchartDataEditor::row_clicked(int row) { bool ok; - QString name = KInputDialog::getText(i18n("Row Name"), + TQString name = KInputDialog::getText(i18n("Row Name"), i18n("Type a new row name:"), m_table->verticalHeader()->label(row), - &ok, this, 0, new QRegExpValidator(QRegExp(".*"), this) ); + &ok, this, 0, new TQRegExpValidator(TQRegExp(".*"), this) ); // Rename the row. if ( ok ) { @@ -860,12 +860,12 @@ void kchartDataEditor::updateRowHeaders() { for (int i=0;i<m_table->numRows();i++) { - QHeader* header=m_table->verticalHeader(); + TQHeader* header=m_table->verticalHeader(); - QString tableCellText=m_table->text(i,0); + TQString tableCellText=m_table->text(i,0); - if (tableCellText == QString::null) - tableCellText=QString(""); + if (tableCellText == TQString()) + tableCellText=TQString(""); header->setLabel(header->mapToSection(i),tableCellText); } @@ -875,12 +875,12 @@ void kchartDataEditor::updateColHeaders() { for (int i=0;i<m_table->numCols();i++) { - QHeader* header=m_table->horizontalHeader(); + TQHeader* header=m_table->horizontalHeader(); - QString tableCellText=m_table->text(0,i); + TQString tableCellText=m_table->text(0,i); - if (tableCellText == QString::null) - tableCellText=QString(""); + if (tableCellText == TQString()) + tableCellText=TQString(""); header->setLabel(header->mapToSection(i),tableCellText); } |