diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:54:04 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:54:04 +0000 |
commit | dc6b8e72fed2586239e3514819238c520636c9d9 (patch) | |
tree | 88b200df0a0b7fab9d6f147596173556f1ed9a13 /kommander/widgets/table.cpp | |
parent | 6927d4436e54551917f600b706a8d6109e49de1c (diff) | |
download | tdewebdev-dc6b8e72fed2586239e3514819238c520636c9d9.tar.gz tdewebdev-dc6b8e72fed2586239e3514819238c520636c9d9.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdewebdev@1157656 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kommander/widgets/table.cpp')
-rw-r--r-- | kommander/widgets/table.cpp | 136 |
1 files changed, 68 insertions, 68 deletions
diff --git a/kommander/widgets/table.cpp b/kommander/widgets/table.cpp index 358b548b..b7e2d68a 100644 --- a/kommander/widgets/table.cpp +++ b/kommander/widgets/table.cpp @@ -20,11 +20,11 @@ #include <kmessagebox.h> /* QT INCLUDES */ -#include <qmetaobject.h> -#include <qstring.h> -#include <qwidget.h> -#include <qstringlist.h> -#include <qpoint.h> +#include <tqmetaobject.h> +#include <tqstring.h> +#include <tqwidget.h> +#include <tqstringlist.h> +#include <tqpoint.h> /* OTHER INCLUDES */ #include "kommanderplugin.h" @@ -47,24 +47,24 @@ enum Functions { }; -Table::Table(QWidget *a_parent, const char *a_name) - : QTable(a_parent, a_name), KommanderWidget(this) +Table::Table(TQWidget *a_parent, const char *a_name) + : TQTable(a_parent, a_name), KommanderWidget(this) { - QStringList states; + TQStringList states; states << "default"; setStates(states); setDisplayStates(states); KommanderPlugin::setDefaultGroup(Group::DCOP); - KommanderPlugin::registerFunction(TBL_sortColumnExtra, "sortColumnExtra(QString widget, int col, bool ascending, bool wholeRows)", i18n("Sets a column to sort ascending or descending. Optionally can sort with rows intact for database use."), 2, 4); - KommanderPlugin::registerFunction(TBL_keepCellVisible, "keepCellVisible(QString widget, int row, int col)", i18n("Scrolls the table so the cell indicated is visible."), 3); - KommanderPlugin::registerFunction(TBL_selectCells, "selectCells(QString widget, int row, int col, int row, int col)", i18n("Select cells using the upper left and lower right cell addresses<br /><b>Not guaranteed to have KDE4 compatiblility</b>"), 5); - KommanderPlugin::registerFunction(TBL_selectRow, "selectRow(QString widget, int row)", i18n("Select the row with the zero based index."), 2); - KommanderPlugin::registerFunction(TBL_selectColumn, "selectColumn(QString widget, int col)", i18n("Select the column with the zero based index.<br /><b>Not guaranteed to have KDE4 compatiblility</b>"), 2); - KommanderPlugin::registerFunction(TBL_setColumnReadOnly, "setColumnReadOnly(QString widget, int col, bool Readonly)", i18n("Set the column read only using zero based index.<br /><b>Not guaranteed to have KDE4 compatiblility</b>"), 3); - KommanderPlugin::registerFunction(TBL_setRowReadOnly, "setRowReadOnly(QString widget, int row, bool Readonly)", i18n("Set the row read only using zero based index.<br /><b>Not guaranteed to have KDE4 compatiblility</b>"), 3); - KommanderPlugin::registerFunction(TBL_rowCount, "rowCount(QString widget)", i18n("Returns the number of rows of the table"), 1); - KommanderPlugin::registerFunction(TBL_colHeader, "columnHeader(QString widget, int Column)", i18n("Returns the text of the header for the column index"), 2); - KommanderPlugin::registerFunction(TBL_rowHeader, "rowHeader(QString widget, int Row)", i18n("Returns the text of the header for the row index"), 2); + KommanderPlugin::registerFunction(TBL_sortColumnExtra, "sortColumnExtra(TQString widget, int col, bool ascending, bool wholeRows)", i18n("Sets a column to sort ascending or descending. Optionally can sort with rows intact for database use."), 2, 4); + KommanderPlugin::registerFunction(TBL_keepCellVisible, "keepCellVisible(TQString widget, int row, int col)", i18n("Scrolls the table so the cell indicated is visible."), 3); + KommanderPlugin::registerFunction(TBL_selectCells, "selectCells(TQString widget, int row, int col, int row, int col)", i18n("Select cells using the upper left and lower right cell addresses<br /><b>Not guaranteed to have KDE4 compatiblility</b>"), 5); + KommanderPlugin::registerFunction(TBL_selectRow, "selectRow(TQString widget, int row)", i18n("Select the row with the zero based index."), 2); + KommanderPlugin::registerFunction(TBL_selectColumn, "selectColumn(TQString widget, int col)", i18n("Select the column with the zero based index.<br /><b>Not guaranteed to have KDE4 compatiblility</b>"), 2); + KommanderPlugin::registerFunction(TBL_setColumnReadOnly, "setColumnReadOnly(TQString widget, int col, bool Readonly)", i18n("Set the column read only using zero based index.<br /><b>Not guaranteed to have KDE4 compatiblility</b>"), 3); + KommanderPlugin::registerFunction(TBL_setRowReadOnly, "setRowReadOnly(TQString widget, int row, bool Readonly)", i18n("Set the row read only using zero based index.<br /><b>Not guaranteed to have KDE4 compatiblility</b>"), 3); + KommanderPlugin::registerFunction(TBL_rowCount, "rowCount(TQString widget)", i18n("Returns the number of rows of the table"), 1); + KommanderPlugin::registerFunction(TBL_colHeader, "columnHeader(TQString widget, int Column)", i18n("Returns the text of the header for the column index"), 2); + KommanderPlugin::registerFunction(TBL_rowHeader, "rowHeader(TQString widget, int Row)", i18n("Returns the text of the header for the row index"), 2); } @@ -72,9 +72,9 @@ Table::~Table() { } -QString Table::currentState() const +TQString Table::currentState() const { - return QString("default"); + return TQString("default"); } bool Table::isKommanderWidget() const @@ -82,22 +82,22 @@ bool Table::isKommanderWidget() const return true; } -QStringList Table::associatedText() const +TQStringList Table::associatedText() const { return KommanderWidget::associatedText(); } -void Table::setAssociatedText(const QStringList& a_at) +void Table::setAssociatedText(const TQStringList& a_at) { KommanderWidget::setAssociatedText(a_at); } -void Table::setPopulationText(const QString& a_text) +void Table::setPopulationText(const TQString& a_text) { KommanderWidget::setPopulationText(a_text); } -QString Table::populationText() const +TQString Table::populationText() const { return KommanderWidget::populationText(); } @@ -107,14 +107,14 @@ void Table::populate() setWidgetText(KommanderWidget::evalAssociatedText( populationText())); } -void Table::setWidgetText(const QString&) +void Table::setWidgetText(const TQString&) { } -QString Table::selectedArea() +TQString Table::selectedArea() { - QTableSelection sel = selection(currentSelection()); - return QString("%1,%2,%3,%4").arg(sel.topRow()).arg(sel.leftCol()).arg(sel.bottomRow()).arg(sel.rightCol()); + TQTableSelection sel = selection(currentSelection()); + return TQString("%1,%2,%3,%4").arg(sel.topRow()).arg(sel.leftCol()).arg(sel.bottomRow()).arg(sel.rightCol()); } @@ -126,48 +126,48 @@ bool Table::isFunctionSupported(int f) f == DCOP::setRowCaption || f == DCOP::text || f == DCOP::setText || f == DCOP::selection || f == DCOP::geometry || f == DCOP::hasFocus || f == DCOP::getBackgroundColor || f == DCOP::setBackgroundColor || (f >= FirstFunction && f <= LastFunction); } -void Table::setCellWidget(int row, int col, const QString & _widgetName) +void Table::setCellWidget(int row, int col, const TQString & _widgetName) { KommanderWidget *w = widgetByName(_widgetName); if (w) { - QWidget *widget = static_cast<QWidget*>(w->object()); - if (QTable::cellWidget(row, col) != widget) + TQWidget *widget = static_cast<TQWidget*>(w->object()); + if (TQTable::cellWidget(row, col) != widget) { setCurrentCell(-1, -1); //hack to not delete the cellwidget after clicking away to another cell. //I don't know why it does so, but without this on a click to another cell calls endEdit, which calls //clearCellWidget, all this before the currentChanged signal is emitted. //this hack does ugly things once table starts scrolling - let's try to minize damage //we should have a way to test doe cellWidget looses focus and send it right or down too - QTable::ensureCellVisible(row, col); + TQTable::ensureCellVisible(row, col); clearCellWidget(row, col); - QTable::setCellWidget(row, col, widget); + TQTable::setCellWidget(row, col, widget); } } else clearCellWidget(row, col); } -QString Table::cellWidget(int row, int col) +TQString Table::cellWidget(int row, int col) { - QWidget *widget = QTable::cellWidget(row, col); + TQWidget *widget = TQTable::cellWidget(row, col); if (widget) { KommanderWidget *w = widgetByName(widget->name()); if (w) return widget->name(); } - return QString(); + return TQString(); } -void Table::setCellText(int row, int col, const QString& text) +void Table::setCellText(int row, int col, const TQString& text) { - QWidget *widget = QTable::cellWidget(row, col); + TQWidget *widget = TQTable::cellWidget(row, col); if (widget) { KommanderWidget *w = widgetByName(widget->name()); if (w) - widget->reparent(parentDialog(), QPoint(0,0)); + widget->reparent(parentDialog(), TQPoint(0,0)); } setText(row, col, text); endEdit(row, col, false, false); @@ -175,13 +175,13 @@ void Table::setCellText(int row, int col, const QString& text) void Table::clearCellWidget(int row, int col) { - QTable::clearCellWidget(row, col); //just for debugging + TQTable::clearCellWidget(row, col); //just for debugging } -void Table::contextMenuEvent( QContextMenuEvent * e ) +void Table::contextMenuEvent( TQContextMenuEvent * e ) { e->accept(); - QPoint p = e->globalPos(); + TQPoint p = e->globalPos(); emit contextMenuRequested(p.x(), p.y()); } @@ -194,7 +194,7 @@ void Table::columnClicked(int col) sortColumn( col, ascending, TRUE); } -QString Table::handleDCOP(int function, const QStringList& args) +TQString Table::handleDCOP(int function, const TQStringList& args) { switch (function) { @@ -218,11 +218,11 @@ QString Table::handleDCOP(int function, const QStringList& args) insertColumns(args[0].toInt(), args.count() == 1 ? 1 : args[1].toInt()); break; case DCOP::currentColumn: - return QString::number(currentColumn()); + return TQString::number(currentColumn()); case DCOP::currentRow: - return QString::number(currentRow()); + return TQString::number(currentRow()); case DCOP::columnCount: - return QString::number(numCols()); + return TQString::number(numCols()); break; case DCOP::removeColumn: if (numCols() >= args[0].toInt()) @@ -239,7 +239,7 @@ QString Table::handleDCOP(int function, const QStringList& args) break; } case TBL_rowCount: - return QString::number(numRows()); + return TQString::number(numRows()); break; case DCOP::removeRow: { @@ -259,10 +259,10 @@ QString Table::handleDCOP(int function, const QStringList& args) break; case DCOP::text: { - QString rows; + TQString rows; for (int r = 0; r < numRows(); r++) { - QString row; + TQString row; for (int c = 0; c < numCols(); c++) { if (c) @@ -280,17 +280,17 @@ QString Table::handleDCOP(int function, const QStringList& args) int r = 0, c = 0; setNumCols(0); setNumRows(0); - QStringList rows; - QStringList row; - rows = QStringList::split("\n", args[0], true); + TQStringList rows; + TQStringList row; + rows = TQStringList::split("\n", args[0], true); setNumRows(rows.count()); - for (QStringList::Iterator it = rows.begin(); it != rows.end(); ++it, ++r) + for (TQStringList::Iterator it = rows.begin(); it != rows.end(); ++it, ++r) { - row = QStringList::split("\t", *it, true); + row = TQStringList::split("\t", *it, true); if (!r) setNumCols(row.count()); c = 0; - for (QStringList::Iterator itr = row.begin(); itr != row.end(); ++itr, ++c) + for (TQStringList::Iterator itr = row.begin(); itr != row.end(); ++itr, ++c) setText(r, c, *itr); } break; @@ -303,42 +303,42 @@ QString Table::handleDCOP(int function, const QStringList& args) break; case DCOP::setBackgroundColor: { - QColor color; + TQColor color; color.setNamedColor(args[0]); this->setPaletteBackgroundColor(color); break; } case TBL_sortColumnExtra: if (numCols() >= args[0].toInt()) - QTable::sortColumn(args[0].toInt(), args[1].toInt(), args[2].toInt()); + TQTable::sortColumn(args[0].toInt(), args[1].toInt(), args[2].toInt()); break; case TBL_keepCellVisible: if (numRows() >= args[0].toInt() && numCols() >+ args[1].toInt()) - QTable::ensureCellVisible(args[0].toInt()-1, args[1].toInt()-1); + TQTable::ensureCellVisible(args[0].toInt()-1, args[1].toInt()-1); break; case TBL_selectCells: if (numRows() >= args[0].toInt() && numCols() >+ args[1].toInt() && numRows() >= args[2].toInt() && numCols() >+ args[3].toInt()) - QTable::selectCells (args[0].toInt(), args[1].toInt(), args[2].toInt(), args[3].toInt()); + TQTable::selectCells (args[0].toInt(), args[1].toInt(), args[2].toInt(), args[3].toInt()); break; case TBL_selectRow: if (numRows() >= args[0].toInt()) - QTable::selectRow (args[0].toInt()); + TQTable::selectRow (args[0].toInt()); break; case TBL_selectColumn: if (numCols() >= args[0].toInt()) - QTable::selectColumn (args[0].toInt()); + TQTable::selectColumn (args[0].toInt()); break; case TBL_setColumnReadOnly: if (numCols() >= args[0].toInt()) - QTable::setColumnReadOnly (args[0].toInt(), args[1].toUInt()); + TQTable::setColumnReadOnly (args[0].toInt(), args[1].toUInt()); break; case TBL_setRowReadOnly: if (numRows() >= args[0].toInt()) - QTable::setRowReadOnly (args[0].toInt(), args[1].toUInt()); + TQTable::setRowReadOnly (args[0].toInt(), args[1].toUInt()); break; case TBL_colHeader: { - QHeader* hdr = QTable::horizontalHeader(); + TQHeader* hdr = TQTable::horizontalHeader(); if (numCols() >= args[0].toInt()) return hdr->label(args[0].toInt()); else @@ -347,7 +347,7 @@ QString Table::handleDCOP(int function, const QStringList& args) } case TBL_rowHeader: { - QHeader* hdr = QTable::verticalHeader(); + TQHeader* hdr = TQTable::verticalHeader(); if (numRows() >= args[0].toInt()) return hdr->label(args[0].toInt()); else @@ -356,17 +356,17 @@ QString Table::handleDCOP(int function, const QStringList& args) } case DCOP::geometry: { - QString geo = QString::number(this->x())+" "+QString::number(this->y())+" "+QString::number(this->width())+" "+QString::number(this->height()); + TQString geo = TQString::number(this->x())+" "+TQString::number(this->y())+" "+TQString::number(this->width())+" "+TQString::number(this->height()); return geo; break; } case DCOP::hasFocus: - return QString::number(this->hasFocus()); + return TQString::number(this->hasFocus()); break; default: return KommanderWidget::handleDCOP(function, args); } - return QString(); + return TQString(); } #include "table.moc" |